Hi Stefan, Hi all,

I have a working implementation of scene properties. It wasn't really hard because most of the is there. The problem I have though is that I must remove some features. Persistance was depending on SceneScerialization and I can't accept that because I need SceneScerialization to depend on Persistence. So, now, Save() andLoad() in PersistenceService can only handle xml files and Save() losts its appendChanges parameter.


I have some difficulty to continue because I don't know what you guys want. I want to transform this class but I don't want to break it for you. The only real use is in IGTUI (but you use QSettings if persistence doesn't work) and in OpenCVVideoSupport (but you could use QSettings). Then there's this m_AutoLoadAndSave parameter which is never set to false because it wouldn't make any sense to do so.

So, my goal is to remove this parameter and transform the class so that each PropertyList is *either* a 'SceneProperties' *or* a 'Settings'. Saving in the .mitk scene when 'SceneProperties' and in the AppData xml file when 'Settings', but never is both.

Do you see a problem with this idea? Is this good for you?

Nil

Le 2016-11-29 à 09:19, Kislinskiy, Stefan a écrit :

Hi,

oops, when someone wrote this explicit sentence in the documentation, then I guess it is supposed to work with scene files. I remembered a discussion where it was a point that the Persistence Service is like QSettings but works without any Qt dependency and therefore has its right to exist at all. :-) When you didn’t find any code in the scene serialization I guess it never was completely implemented. If there is code, I would classify it as a bug.

We’re always interested in contributions. :-)

Best,
Stefan

*From:*Nil Goyette [mailto:nil.goye...@imeka.ca]
*Sent:* Dienstag, 29. November 2016 14:48
*To:* Kislinskiy, Stefan; mitk-users@lists.sourceforge.net
*Subject:* Re: [mitk-users] Scene properties

Hi Stefan,

Thank you for the information on DataNode. As for the persistence system... Oh. Shit. Ok :) This wasn't my understanding at all. This sentence in the documentation makes people believe something false and, if you're right, should be updated to avoid confusion:

"/These properties can be stored inside a MITK scene together with the data so that the user loads data and restores the application state at once./" http://docs.mitk.org/2016.03/PersistenceConceptPage.html#PersistenceMITKService

If I understand you correctly, the persistence system is exacly like QSettings but without the need for a Qt dependency. It's not linked at all to the saving and loading of a scene, by design.

We need this feature because we want the user to

  * have the same data+views+params when he loads his scene, so he can
    continue his work at the same point
  * be able to send his scene to a colleague and both see the exact
    same thing

so I'll try to code is the next weeks. Would MITK be interested in this contribution?

Nil

Le 2016-11-29 à 08:08, Kislinskiy, Stefan a écrit :

Hi Nil,

AFAIK the Persistence Service was intentionally designed to be not included in a scene file as it is indeed something similar to QSettings. If you want to store settings in your scene file, you can do so by using properties.

Note that there are several property lists. The lists you see by default in the Properties View are the general DataNODE properties. There are also specialized DataNODE properties per render window. Properties in these specialized lists are used instead of the general ones in the according render window if present. DataNODE properties are usually dedicated to the appearance of data. There is also a BASEData property list for each data item in your scene. This list is dedicated to meta data like the original path of an image, DICOM tags, and so on. In the Preferences you can switch on the “Developer Mode” for the Properties, which enables you to switch between the lists in the view to get an idea of all the lists.

Best,
Stefan

*From:*Nil Goyette [mailto:nil.goye...@imeka.ca]
*Sent:* Montag, 28. November 2016 21:33
*To:* mitk-users@lists.sourceforge.net <mailto:mitk-users@lists.sourceforge.net>
*Subject:* Re: [mitk-users] Scene properties

Hi all,

I was testing the persistence system again, but on MITK 2016.03 this time. I did fall on all the same traps so this old conversation helped me. I have some new questions though.

Right now, the persistence system simply creates PersistentData.xml in AppData/.../#_MitkPersistence, with '#' starting at 45 and going up.

  * The first file (45) is never used after. It's never found by MITK.
    On the second run, it creates '46' and the data are read on all
    the next runs. But the real problem comes next.
  * Why? I don't understand the point of saving a xml file in AppData.
    Isn't this a new QSettings? I thought the data was going to be
    saved in the scene.

In fact, I searched in your code using 'git grep' and I can't find where PersistenceService is used when saving a scene. I can see it is used in PersistenceService::Save() and PersistenceService::Load() when a filename is passed, but afaik it never happens. GetDataNodes() could be called by the scene-saving code but it's not. Knowing all this, I'm less surprised that BeforePropertyListReplaced() was never called!

Can someone please confirm that the persistence system is working when saving and loading a scene? And if it does, can you please tell me how!?! Where in SceneSerialization does it happens?
Thank you for your time.

Nil

Le 2016-04-06 à 12:22, Nil Goyette a écrit :

    Ah, thank you, mitk::PersistenceService::LoadModule() was the missing

    piece of information.

    The service is not a nullptr anymore and I can get the properties

    associated with an ID and they are kept during the lifetime of the

    application.

    So, I added the call to AddPropertyListReplacedObserver(this) but

    BeforePropertyListReplaced() and AfterPropertyListReplaced() are never

    called. I thought they would be called when the user saves and load a scene.

    Did I miss something?

    Le 2016-04-06 05:49, Kolb, Christoph a écrit :

        I have just tested the PersistenceService in a Plugin and got the same 
error message:

        "The calling module probably misses a US_MODULE_NAME compile definition 
and/or a call to

        US_INITIALIZE_MODULE in one of its source files."

        It worked after I added a dependency to MitkPersistence and

        called mitk::PersistenceService::LoadModule() in the constructor of my 
pluginView. I also needed to

        put US_INITIALIZE_MODULE in the source.

        Regards

        Christoph


------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to