Page MenuHomePhabricator

Label Loss on repeatedly loaded and saved segmentations
Closed, ResolvedPublic

Assigned To
Authored By
s349i
Aug 30 2022, 11:22 AM
Referenced Files
F2564298: 5_manually_add_again.PNG
Aug 30 2022, 11:23 AM
F2564299: 6_its_back.PNG
Aug 30 2022, 11:23 AM
F2564300: 4_new_label_not_shown.PNG
Aug 30 2022, 11:23 AM
F2564301: 2_open_new_task.PNG
Aug 30 2022, 11:23 AM
F2564302: 1_save_results.PNG
Aug 30 2022, 11:23 AM
F2564303: 3_back_create_new_label.PNG
Aug 30 2022, 11:23 AM

Description

Ref T29157: NCT ISSO Annotation Support with MITK Segmentation Flow

  1. Do annotation on an existing annotation task.
  2. Save the annotated task.
  3. Open a new task.
  4. Move back to the previously saved task and add a new label. Draw annotations for the new label.
  5. Save the modified task and open again. The newly added label should be missing now.
  6. Add the new label to the task. The previously drawn annotation for the new label is rendered.

4_new_label_not_shown.PNG (1×1 px, 917 KB)

2_open_new_task.PNG (1×1 px, 881 KB)

3_back_create_new_label.PNG (1×1 px, 904 KB)

1_save_results.PNG (1×1 px, 890 KB)

5_manually_add_again.PNG (1×1 px, 876 KB)

6_its_back.PNG (1×1 px, 890 KB)

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

kislinsk triaged this task as High priority.
kislinsk added a project: MITK.
s349i raised the priority of this task from High to Needs Triage.
s349i changed the visibility from "Public (No Login Required)" to "Subscribers".
kislinsk triaged this task as High priority.
kislinsk updated the task description. (Show Details)
kislinsk changed the visibility from "Subscribers" to "Public (No Login Required)".

Findings:

  • In my example I have an image with a predefined label which works as expected.
  • When I add labels in the Segmentation View and draw something, everything seems fine.
  • Save and load again the segmentation to see that all pixels of the drawn labels are there, but only the first label appears in the Segmentation View.
  • So it seems like all the meta data for the extra labels were dismissed when saving the segmentation.
Image header for the working case with 2 labels
NRRD0004
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
type: unsigned short
dimension: 3
space: left-posterior-superior
sizes: 256 256 49
space directions: (1,0,0) (0,1,0) (0,0,3)
kinds: domain domain domain
endian: little
encoding: gzip
space origin: (0,0,0)
DICOM_0008_0060:={"values":[{"z":0, "t":0, "value":"SEG"}]}
DICOM_0008_103E:={"values":[{"z":0, "t":0, "value":"MITK Segmentation"}]}
layer_000:=3
layers:=1
modality:=org.mitk.image.multilabel
org.mitk.label_000_00000:=<?xml version="1.0" encoding="UTF-8"?>\n<Label>\n    <property key="DICOM.0062.0002.0062.0004" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"0"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0005" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Exterior"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0008" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SEMIAUTOMATIC"}]}</temporo_spatial_string>\n    </property>\n    <property key="center.coordinates" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="center.index" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="color" type="ColorProperty">\n        <color r="0" g="0" b="0"/>\n    </property>\n    <property key="layer" type="UIntProperty">\n        <unsigned value="0"/>\n    </property>\n    <property key="locked" type="BoolProperty">\n        <bool value="false"/>\n    </property>\n    <property key="name" type="StringProperty">\n        <string value="Exterior"/>\n    </property>\n    <property key="opacity" type="FloatProperty">\n        <float value="0"/>\n    </property>\n    <property key="value" type="UShortProperty">\n        <unsigned value="0"/>\n    </property>\n    <property key="visible" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n</Label>\n
org.mitk.label_000_00001:=<?xml version="1.0" encoding="UTF-8"?>\n<Label>\n    <property key="DICOM.0062.0002.0062.0003.0008.0100" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"T-D000A"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0003.0008.0102" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SRT"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0003.0008.0104" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Anatomical Structure"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0004" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"1"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0005" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Liver"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0008" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SEMIAUTOMATIC"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.000F.0008.0100" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"T-62000"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.000F.0008.0102" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SRT"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.000F.0008.0104" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Liver"}]}</temporo_spatial_string>\n    </property>\n    <property key="center.coordinates" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="center.index" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="color" type="ColorProperty">\n        <color r="0.745098054" g="0" b="0.196078435"/>\n    </property>\n    <property key="layer" type="UIntProperty">\n        <unsigned value="0"/>\n    </property>\n    <property key="locked" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n    <property key="name" type="StringProperty">\n        <string value="Liver"/>\n    </property>\n    <property key="opacity" type="FloatProperty">\n        <float value="0.600000024"/>\n    </property>\n    <property key="value" type="UShortProperty">\n        <unsigned value="1"/>\n    </property>\n    <property key="visible" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n</Label>\n
org.mitk.label_000_00002:=<?xml version="1.0" encoding="UTF-8"?>\n<Label>\n    <property key="DICOM.0062.0002.0062.0004" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"2"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0005" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Label 1"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0008" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SEMIAUTOMATIC"}]}</temporo_spatial_string>\n    </property>\n    <property key="center.coordinates" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="center.index" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="color" type="ColorProperty">\n        <color r="0.952941179" g="0.764705896" b="0"/>\n    </property>\n    <property key="layer" type="UIntProperty">\n        <unsigned value="0"/>\n    </property>\n    <property key="locked" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n    <property key="name" type="StringProperty">\n        <string value="Label 1"/>\n    </property>\n    <property key="opacity" type="FloatProperty">\n        <float value="0.600000024"/>\n    </property>\n    <property key="value" type="UShortProperty">\n        <unsigned value="2"/>\n    </property>\n    <property key="visible" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n</Label>\n
org_mitk_uid:=2a0c52f7-1b2e-4a46-88ca-f4ff9344a7e4
Image header for the corrupt case with 2 labels
NRRD0004
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
type: unsigned short
dimension: 3
space: left-posterior-superior
sizes: 256 256 49
space directions: (1,0,0) (0,1,0) (0,0,3)
kinds: domain domain domain
endian: little
encoding: gzip
space origin: (0,0,0)
DICOM_0008_0060:={"values":[{"z":0, "t":0, "value":"SEG"}]}
DICOM_0008_103E:={"values":[{"z":0, "t":0, "value":"MITK Segmentation"}]}
ITK_InputFilterName:=NrrdImageIO
MITK_IO_reader_description:=MITK Multilabel Image
MITK_IO_reader_inputlocation:=C:\\Users\\Stefan\\Desktop\\segmentation_task_lists\\results/liver.interim.nrrd
MITK_IO_reader_mime_category:=Images
MITK_IO_reader_mime_name:=application/vnd.mitk.image.nrrd
MITK_IO_reader_version:=2022.04.99-4e5d077f
layer_000:=2
layers:=1
modality:=org.mitk.image.multilabel
org.mitk.label_000_00000:=<?xml version="1.0" encoding="UTF-8"?>\n<Label>\n    <property key="DICOM.0062.0002.0062.0004" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"0"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0005" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Exterior"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0008" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SEMIAUTOMATIC"}]}</temporo_spatial_string>\n    </property>\n    <property key="center.coordinates" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="center.index" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="color" type="ColorProperty">\n        <color r="0" g="0" b="0"/>\n    </property>\n    <property key="layer" type="UIntProperty">\n        <unsigned value="0"/>\n    </property>\n    <property key="locked" type="BoolProperty">\n        <bool value="false"/>\n    </property>\n    <property key="name" type="StringProperty">\n        <string value="Exterior"/>\n    </property>\n    <property key="opacity" type="FloatProperty">\n        <float value="0"/>\n    </property>\n    <property key="value" type="UShortProperty">\n        <unsigned value="0"/>\n    </property>\n    <property key="visible" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n</Label>\n
org.mitk.label_000_00001:=<?xml version="1.0" encoding="UTF-8"?>\n<Label>\n    <property key="DICOM.0062.0002.0062.0003.0008.0100" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"T-D000A"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0003.0008.0102" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SRT"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0003.0008.0104" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Anatomical Structure"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0004" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"1"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0005" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Liver"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0008" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SEMIAUTOMATIC"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.000F.0008.0100" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"T-62000"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.000F.0008.0102" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SRT"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.000F.0008.0104" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Liver"}]}</temporo_spatial_string>\n    </property>\n    <property key="center.coordinates" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="center.index" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="color" type="ColorProperty">\n        <color r="0.745098054" g="0" b="0.196078435"/>\n    </property>\n    <property key="layer" type="UIntProperty">\n        <unsigned value="0"/>\n    </property>\n    <property key="locked" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n    <property key="name" type="StringProperty">\n        <string value="Liver"/>\n    </property>\n    <property key="opacity" type="FloatProperty">\n        <float value="0.600000024"/>\n    </property>\n    <property key="value" type="UShortProperty">\n        <unsigned value="1"/>\n    </property>\n    <property key="visible" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n</Label>\n
org.mitk.label_000_00002:=<?xml version="1.0" encoding="UTF-8"?>\n<Label>\n    <property key="DICOM.0062.0002.0062.0004" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"2"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0005" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"Label 1"}]}</temporo_spatial_string>\n    </property>\n    <property key="DICOM.0062.0002.0062.0008" type="TemporoSpatialStringProperty">\n        <temporo_spatial_string>{"values":[{"z":0, "t":0, "value":"SEMIAUTOMATIC"}]}</temporo_spatial_string>\n    </property>\n    <property key="center.coordinates" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="center.index" type="Point3dProperty">\n        <point x="0" y="0" z="0"/>\n    </property>\n    <property key="color" type="ColorProperty">\n        <color r="0.952941179" g="0.764705896" b="0"/>\n    </property>\n    <property key="layer" type="UIntProperty">\n        <unsigned value="0"/>\n    </property>\n    <property key="locked" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n    <property key="name" type="StringProperty">\n        <string value="Label 1"/>\n    </property>\n    <property key="opacity" type="FloatProperty">\n        <float value="0.600000024"/>\n    </property>\n    <property key="value" type="UShortProperty">\n        <unsigned value="2"/>\n    </property>\n    <property key="visible" type="BoolProperty">\n        <bool value="true"/>\n    </property>\n</Label>\n
org_mitk_uid:=25facd2e-7f9a-4366-b5e3-8da72f1e0bdd

The solution is to ignore default properties when loading multilabel images as it was already intended:

  • Add forgotten call of InitializeDefaultMetaDataKeys() to ctor
  • Fix names of default properties (. instead of _)
kislinsk added a revision: Restricted Differential Revision.Sep 2 2022, 2:49 PM
kislinsk renamed this task from Label Loss on Saved Tasks for Flow Bench to Label Loss on repeatedly loaded and saved segmentations.Sep 6 2022, 7:38 AM

Deleted branch from rMITK MITK: bugfix/T29274-IgnoreDefaultPropertiesOnLoad.