Page MenuHomePhabricator

LabelSetImageIO should support time geometries and property serialization
Closed, ResolvedPublic

Description

Current status:

  1. LabelSetImageIO ignores time geometry information. As a result the timing information gets lost when stored into a file and is a simple default PropertionalTimeGeometrie if loaded again.
  2. LabelSetImageIO does not support property serialization

To fixe that the Write() and Read() method of LabelSetImageIO should be extended by the same business logic used in ItkImageIO.
There the support is done in the following locations:

  • Write time geometry: mitkItkImageIO.cpp; lines 613 - 630
    // Handle time geometry
    const auto *arbitraryTG = dynamic_cast<const ArbitraryTimeGeometry *>(image->GetTimeGeometry());
    if (arbitraryTG)

[...]

      itk::EncapsulateMetaData<std::string>(
        m_ImageIO->GetMetaDataDictionary(), PROPERTY_KEY_TIMEGEOMETRY_TIMEPOINTS, data);
    }
  • Write properties: mitkItkImageIO.cpp; lines 632 - 655
    // Handle properties
    mitk::PropertyList::Pointer imagePropertyList = image->GetPropertyList();

[...]

    ImageReadAccessor imageAccess(image);
    LocaleSwitch localeSwitch2("C");
    m_ImageIO->Write(imageAccess.GetData());
  • Read time geometry: mitkItkImageIO.cpp; lines 348 - 412
// re-initialize TimeGeometry
TimeGeometry::Pointer timeGeometry;
if (dictionary.HasKey(PROPERTY_NAME_TIMEGEOMETRY_TYPE) || dictionary.HasKey(PROPERTY_KEY_TIMEGEOMETRY_TYPE))

[...]

    timeGeometry = propTimeGeometry;
  }

  image->SetTimeGeometry(timeGeometry);
  • Read time geometry: mitkItkImageIO.cpp; lines 348 - 412
  for (auto iter = dictionary.Begin(), iterEnd = dictionary.End(); iter != iterEnd;
       ++iter)
  {
    if (iter->second->GetMetaDataObjectTypeInfo() == typeid(std::string))

[...]

      if (!isDefaultKey)
      {
        mitk::CoreServices::GetPropertyPersistence()->AddInfo(info);
      }
    }
  }

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

kislinsk removed a project: Request for Discussion.
kislinsk added a subscriber: kislinsk.

This is important to be fixed soon-ish. Potential candidate for the next bugfix release.

hettich renamed this task from LabelSetImageIO should support time geomatries and property serialization to LabelSetImageIO should support time geometries and property serialization.Mar 22 2019, 5:33 PM
floca added a revision: Restricted Differential Revision.Apr 1 2020, 5:59 PM
floca claimed this task.
floca added subscribers: gaoh, thomass, nolden.

@nolden @gaoh @thomass First step to the long road to DICOM Seg. Now at least multi lable images stored as nrrd contain all (dicom) properties needed to write DICOM Seg. Till now only projects files have everything to allow the reconstrution of a state to write DICOM Seg.