Page MenuHomePhabricator

Create scene serialization prototype
Closed, ResolvedPublic

Assigned To
None
Authored By
maleike
Jul 3 2009, 2:38 PM
Referenced Files
F247: SceneSerialization.patch
Oct 16 2009, 3:49 PM
F246: propertyserializationtest.patch
Oct 14 2009, 6:13 PM
F245: propertyserializationtest.patch
Oct 14 2009, 5:15 PM
F244: patch-2130.patch
Jul 3 2009, 3:32 PM
F243: patch-2130.patch
Jul 3 2009, 3:30 PM

Description

This collects progress reports for an initial prototype for scene serialization.

Related Objects

Event Timeline

Commit block active, so I'll just attach some initial work here.

Patch included wrong directories

Committed basic prototzpe in rev. 18000. Can serialize images and surfaces already and put them into a single zip file.

Changes in rev 18018:

  • Added Serializers for Image, Surface, PropertyList, and for several properties
  • changed some details like storing the classname for each seralized object

Serialization is mostly solved now. Deserialization follows.

Added lists of failed nodes/propterties in rev. 18032.

to solve problematic test cases on dartclients, I now remove temp directories after zipping (rev 18125)

Described the planned implementation of LoadScene in a long comment. Committed in revision 18538.

Started implementing LoadScene in revision 18773 an ran into a Poco bug, described in T2441

Committed yesterday's work in rev 18788. Now the scene file is correctly unzipped, the unzipped directory handed to a version dependent scene reader, and finally the temp directory is deleted.

[SVN revision 19346]
ENH (#2183): implement basic loading of BaseData objects and creation of DataTreeNodes

[SVN revision 19347]
FIX (#2183): correctly parse <data> tag; correctly construct filename for BaseData files

Loading is implemented now except for properties.

We still miss

  • a deserializer for a propertylist
  • deserializers for individual properties
  • test cases (differrent bug)
  • consideration of geometries

[SVN revision 19371]
ENH (#2183): minor restructuring to make methods shorter + new method for property decoration

[SVN revision 19372]
mitkSceneReaderV1

ENH (#2183): minor restructuring to make methods shorter + new method for property decoration

[SVN revision 19381]
FIX (#2183): correctly construct file name of property list files

[SVN revision 19382]
FIX (#2183): restructure SceneReader so that it determines the file version itself

[SVN revision 19383]
FIX (#2183): implement instantiation of correct property list deserializer depending on file version

[SVN revision 19388]
FIX (#2183): name file consistent with others

[SVN revision 19391]
FIX (#2183): implement deserialization of ProperyList and BoolProperty for a start

[SVN revision 19396]
ENH (#2183): deserialize most properties now

[SVN revision 19397]
ENH (#2183): deserialize lookup table property now

[SVN revision 19398]
ENH (#2183): provide skeleton for transfer function deserialization

[SVN revision 19399]
FIX (#2183): consistent name for mitkLookupTablePropertySerializer.cpp

[SVN revision 19408]
FIX (#2183): ask user for a filename for loading/saving

Some observations:
A serializer/deserializer for Pointsets is still missing.

The same is true for MaterialProperty, but the property itself is deprecated anyways.

It would be nice if we could serialize a DataStorage::SetOfObjects. This would be the most convenient datastructure for providing a set of nodes for serialization. It can easily be created from a datastorage, but it can also be filled by hand (e.g. with the selection of a table widget or a custom selection of nodes that don't even need to be contained in a datastorage).

[SVN revision 19462]
FIX (#2183): fix title of save scene dialog

this patch contains a unit test for property serialization and deserialization.

It tries to serialize each property that exists in mitk. If successful, it tries to deserialize it again and check if the result is equal to the original property.

This leads to 154 subtests, of which currently 16 are failing. Mostly, because serializers or deserializers do not yet exist. In some cases, the result is not equal to the original property.

The failing subtests should be fixed before committing this test.

this patch contains an enhanced version of the unit test.
After testing all properties, it creates an instance of most MITK base data objects and assigns them to a DataTreeNode. This will create a property list with all default properties for this base data type.
New properties for existing data types that will be introduced in the future can be found with these testcases.
These tests add a large number of subtests (>2800).

[SVN revision 19508]
CHG (#2183): small interface change to SaveScene(): It takes a SetOfObjects now to define the nodes that should be serialized instead of DataStorage + Predicate.

[SVN revision 19510]
CHG (#2183): small interface change to SaveScene(): It takes a SetOfObjects now to define the nodes that should be serialized instead of DataStorage + Predicate.

This patch contains changes to GenericLookupTable and serializer and deserializer classes for all LookupTable types. See T2278 for details on necessary changes to GenericLookupTable.

[SVN revision 19568]
FIX (#2183): add error handling code

[SVN revision 19569]
ENH (#2183): add serialization code for TransferFunctionProperty

[SVN revision 19570]
FIX (#2183): fix serialization of color transfer function

[SVN revision 19571]
ENH (#2183): add new serializers and deserializers for different Property classes.

[SVN revision 19578]
ENH (#2183): remove debug output

[SVN revision 19579]
ENH (#2183): add new serializers and deserializers for AnnotationProperty and ClippingProperty.

[SVN revision 19581]
ENH (#2183): Fix float output for vector/point types

[SVN revision 19582]
ENH (#2183): Fix class names

[SVN revision 19583]
ENH (#2183): Add serializer and deserializer for ModalityProperty

[SVN revision 19584]
FIX (#2183): clarify structure, add comments

[SVN revision 19585]
ENH (#2183): Add serializer and deserializer for Point3iProperty

[SVN revision 19586]
ENH (#2183): Add serializer and deserializer for Point3iProperty

[SVN revision 19589]
ENH (#2183): add test for property serialization.

[SVN revision 19591]
COMP (#2183): temporarily deactivate testing of TransferFunctionProperty

[SVN revision 19604]
ADD (#2183): Add serializer and deserializer for mitk::PointSet

(In reply to comment #45)

[SVN revision 19591]
COMP (#2183): temporarily deactivate testing of TransferFunctionProperty

All other subtests are working, TransferFunctionProperty is the only one making
problems. Unfortunately, only on the continuous clients, not on my local
machine:
http://mbits/cdash/testSummary.php?project=3&name=mitkPropertySerializationTest&date=2009-10-20

Maybe, someone else can look into this.

currently, there is a bug in sceneserialization:

if the node name of an image contains ".pic", there will be a mismatch between the real file name in the scene file and the file name in the <data type="Image" file="XXX" /> tag in index.xml.

The cause of this bug is that mitk::ImageWriter will look if the filename already contains the extension and only adds it, if it is not already present.
mitk::ImageSerializer in contrast always adds the ".pic" extension to the node name.
Result:
real file name: tmp4108iaaaaa_XXXX.pic
file attribute of data tag: tmp4108iaaaaa_XXXX.pic.pic

proposed solution: mitk::ImageWriter should update its FileName member with the one it uses to write the file. mitk::ImageSerializer should read that filename instead of simply adding ".pic".

I don't know if this behavior change of mitk::ImageWriter will have side effects at other parts of MITK.

other things that might be important for saving a scene:

  • world geometry of the renderers (reinit to some data objects?)
  • camera pose

[SVN revision 19631]
FIX (#2183): use plattform specific path separator, query the used file name from ImageWriter to make sure that the correct file name is written to the scene file.

[SVN revision 19632]
FIX (#2183): report only a warning, if we are able to continue to save the data

[SVN revision 19637]
FIX (#2183): use platform specific path separator

[SVN revision 19678]
FIX (#2183): add serializer for internal data class

(In reply to comment #53)

[SVN revision 19678]
FIX (#2183): add serializer for internal data class

currently, the factory mechanism is not working correctly. The serializer that is defined in another module is not found by the CoreObjectFactory.

[SVN revision 19679]
FIX (#2183): add dependency to SceneSerialization module for new serializer class, add serializer class to files.cmake

[SVN revision 19694]
FIX (#2183): add serializer and deserializer for internal property class

Jochen, can you please comment on status?

(In reply to comment #57)

Jochen, can you please comment on status?

SceneSerialization is working pretty good.

Current issues:

  • The subtest for serializing a TransferFunctionProperty is failing on some DartClients, but not on my machine.
  • All Serializers/Deserializers are part of Module SceneSerialization. They would be better placed in the modules that define the original Data/Property classes.
  • The factory mechanism to instantiate Serializers/Deserializers from other Modules is not working for the internal module that I used for testing
  • The GUI integration is really basic. Currently, there is a org.mitk.gui.qt.sceneserialization bundle that defines a view that mainly contains a LoadScene and a SaveScene button. These buttons should be part of DataManager and maybe even integrated into the File menu and/or a toolbar.
  • Currently, only Image, Surface and Pointset datatypes can be serialized. For most other data classes, FileReader/FileWriter classes are missing.
  • Drag & Drop of scene files into the application is not yet possible.

One more issue:

  • Geometry information is not serialized at the moment.

(neither are interaction states)

Indirect issue:

  • The PointSetWriter needs a rewrite, it does not support 4D pointsets or storing PointData.

[SVN revision 20021]
FIX (#2183): use platform specific path separator

[SVN revision 20133]
FIX (#2183): use platform specific path separator

Status update:

Scene serialization is working good.

Currently, the following data types are supported:
Image, Surface, Pointset, all PlanarFigure subclasses, VesselTree

All properties but SmartPointerProperty and MaterialProperty (deprecated anyways) are serialized.

The feature should be tested by the 3M3 testing group. I wrote a test case for that in the application test area.

I will remove the hundrets of log messages and then close the bug. Enhancements like support for additional data types should be handled in separate bugs.

(In reply to comment #62)

All properties but SmartPointerProperty and MaterialProperty (deprecated
anyways) are serialized.

WeakPointerProperty is not serialized either.

Serialization of pointer properties does not make sense, since the pointers wouldn't be valid on loading anyways.

[SVN revision 20280]
CHG (#2183): remove unnecessary log statements

[SVN revision 20314]
CHG (#2183): remove unnecessary log statements

scene serialization prototype is finished.

[SVN revision 20423]
CHG (#2183): remove SceneSerialization bundle from 3M3 application - it is not needed, because the functionality is now in the icon toolbar.