Page MenuHomePhabricator

Introduce new interoperability/developer-friendly scene file format (including reader)
Closed, ResolvedPublic

Description

Status: the current scene file versions serves its purpose for serializing and decentralizing and MITK scene. But it is very tedious if you need to generate it externally; e.g. in order to use it for loading a set of data with renderwindow specific property settings.
Main problems are amongst others:

  • information is stored scattered over multiple files (e.g. one file per property list) which makes generation of simple scene files overly complicated. Being able to store all information in one XML file would be helpful.
  • Property lists are always overwritten. Therefore you have to construct always a fully compliant property lists the Mapper of the loading version can handle. This makes generation code overly complicated and fragile. It would be helpful if one can just use the properties set by the Mapper when the data is loaded and only overwrite properties if they are explicitly set in the scene file.

This is the first proposal the new file format could look like:

<?xml version="1.0" encoding="UTF-8"?>
<Version Writer="C:\jenkins\MITK\snap\src\MITK\Modules\SceneSerialization\src\mitkSceneIO.cpp" Revision="$Revision: 17055 $" FileVersion="3"/>

#old style
#this would behave as v2
<node UID="OBJECT_1">
    <data type="Image" file="caaaaa_brain.nrrd" UID="07df3edd-ff02-4d40-9b76-64783e6da1e8">
        <properties file="faaaaa" loadstyle="replace"/>
    </data>
    <properties file="gaaaaa" loadstyle="replace"/>
</node>

# optional property list: option to drop any property reference if you just take them as loaded
# no properties are altered. The are as loaded or for node set by the mapper
<node UID="OBJECT_1">
    <data type="Image" file="caaaaa_brain.nrrd" UID="07df3edd-ff02-4d40-9b76-64783e6da1e8">
    </data>
</node>

# property loadstyles: replace (oldstyle) / modify (new, default)
<node UID="OBJECT_1b6088d6-1770-423a-ba0f-b1f8df7df2cf">
    <data type="Image" file="daaaaa_Pic3D.nrrd" UID="ea5af460-be5c-4b9b-8f2e-224ff801fcff">
        <properties file="haaaaa" loadstyle="replace"/>
    </data>
    <properties file="iaaaaa" loadstyle="modify"/>
    <properties file="i2aaaa" contextname="renderwindowX"/> #also loadstyle=modify as it is new default
</node>

# infile property lists: if argument file is not given infile list is assumed.
# this would load the image. The only node properties that are altered/set explicit are "name" and "opacity".
# The are altered in the default context. Additionally opacity is changed for the contextname/renderwindow "renderwindowY".
# Rest of the node properties are set by the mapper.
<node UID="OBJECT_08c6dfda-d561-47a6-bdff-bf6f8903f4b9">
    <source UID="OBJECT_51885519-cf0a-41ed-a655-4ad09a68040e"/>
    <data type="LabelSetImage" file="eaaaaa_brain_labels.nrrd" UID="710a44c9-9cad-4611-8b18-91004f5ab741">
    </data>
    <properties contextname="renderwindowY">
		<property key="opacity" type="FloatProperty">
			<float value="0.5"/>
		</property>
    </properties>
    <properties>
		<property key="name" type="StringProperty">
			<string value="brain-labels"/>
		</property>
		<property key="opacity" type="FloatProperty">
			<float value="1"/>
		</property>
    </properties>
</node>

For this task as reader for the new format would be sufficient, as the old version still is sufficient for serialization purposes. We only need it to offer better interoperability with scenes written be external code to load them in MITK.

Event Timeline

floca triaged this task as Normal priority.Dec 4 2023, 2:37 PM
floca created this task.
floca added subscribers: gaoh, kislinsk.

@gaoh With that already help you? Especially the last option with in file property lists and modify mode?
I would like to keep it in XML for now because it’s much faster to realize as we do not have to change complete reader infrastructure.

floca renamed this task from Introduce new interoperability/developer-friendly scene file format to Introduce new interoperability/developer-friendly scene file format (including reader).Dec 4 2023, 2:42 PM
floca updated the task description. (Show Details)
floca added a parent task: Restricted Maniphest Task.

Thank you! Yes this would already be really helpful. Allowing to only create 1 file, and if needed, just change a few properties in it, makes it much more useable.

kislinsk claimed this task.
kislinsk added a project: Moved to git.dkfz.de.

This task was closed here on Phabricator since it was migrated to GitLab. Please continue on GitLab.