Page MenuHomePhabricator

Saving (2D) images in PNG, JPG and TIFF format will rescale the intensity
Closed, ResolvedPublic

Description

The mitk::ImageWriter::WriteByITK method will use

AccessByItk_1( image, _mitkItkPictureWrite, fileName );

to store the image in case the file ending is one of (png, tif, jpg). The Access function itself has a hard-coded OutputImage Types

  • <unsigned char, 2> OutputImageType2D
  • <unsigned char, 3> OutputImageType3D

which then define the writer. Moreover, the intensity of the input image is scaled to fit to the range of unsigned char. For this reason, MITK is not able to store a RGB(A) image as PNG or JPG or TIFF.

Event Timeline

The problem with saving of RGB(A) images was solved by introducing the _mitkItkPictureWriteComposite() method as part of the fix for T12682.

As of now the _mitkItkPictureWrite() will scale the intensity to 8-bit color space. The PNG and TIFF formats both support 16-bit greyscale, so the rescaling is not necessary for 'short' types.

JPG can handle only 8-bit so the execution paths for PNG,TIFF and JPG have to be splitted if we want support also 16-bit images.

[0e4bf7]: Merge branch 'bug-12001-BitmapFormat-Saving'

Merged commits:

2012-11-22 10:58:03 Jan Hering [49cf10]
Enhancing mitkImageWriterTest

  • to test the new features ( 16 bit PNG,TIF saving )

2012-11-22 10:56:13 Jan Hering [1a5d7b]
Enhanced saving of 2D images

  • the 16bit-PixelType images won't be rescaled when saved by the

WriteByITK method from mitk::ImageWriter

Unit tests running without errors. Closing bug.