Page MenuHomePhabricator

Cannot save RGB images in specific formats
Closed, WontfixPublic

Description

Saving multichannel images (e.g. 2D JPG images) in NRRD format works (see T7897). But other formats cannot handle this (e.g. PIC, GIPL, ..).

At the moment the PIC file saves a grey value image instead without giving any warning concerning the loss of data. For GIPL files, the image is completly broken.

The following standard behaviour is desirable:

  • if the image format does not support multichannel, give out an error message, recommend other file formats and abort saving process.

Event Timeline

Need to check other constraints as well. e.g. is Pixeltype possible? What about dimension? time? geometry?

Proposed Plan:

  • Create a xml file that contains possible save file formats including the specific constraints.
  • In mitk::ImageWriter::GenerateData() check if constraints are compatible with the desired file extension.
  • Also: In mitkCoreObjectFactory.cpp

void mitk::CoreObjectFactory::CreateFileExtensionsMap()
the m_SaveFileExtensionsMap should be filled with the xml file content.

  • Additionally: Move the possible file extensions for opening files to that xml file as well (see m_FileExtensionsMap in mitkCoreObjectFactory.cpp in function

void mitk::CoreObjectFactory::CreateFileExtensionsMap() )

Need to clear out, what XML reader should be used here (TinyXML? QT?)

The bug was discussed in the MITK meeting. The result:

  • No XML file! Better put in somewhere in the code.
  • Maybe use an abstract FileWriterInterface (???)

Work in progress:

  • ImageWriter inherits from "FileWriterWithInformation" instead of "FileWriter"
  • QmitkCommonFunctionality::SaveImage calls ImageWriter::DoWrite instead of ImageWriter::Write
  • FileWriterWithInformation::DoWrite performs checks, if the requested fileformat is capable of writing the image without loss of information. If that is not possible, a warning is given and the savingProcess might be aborted in some cases.

The code is basically finished.
But we still have to implement a test for this issue.
We plan to push a 2D_rgb, 3D and 4D image into the test-data repository and use these for saving tests for all available image file formats.

.. but now we discovered, that nrrd splits 4D images into single 3D volumes (which is unacceptable as standard format). Have to repair that as well. see T8211

Resetting all bugs without active assignee flag to "CONFIRMED". Change status to IN_PROGRESS if you are working on it.

kislinsk claimed this task.
kislinsk added a subscriber: kislinsk.
This task was automatically closed because it wasn't updated at least since July 2016 (over 2 years). Please re-open this task if you think that it is still relevant. This most probably means that you will resolve it.