DICOM standard allow storing of image with more than one components. As of today, only 1 or 3 components are considered valid DICOM SOP Class instances (for all IODs).
By design the itk::GDCMImageIO was designed and implemented so that an input YBR_FULL image would be loaded as such (no implicit conversion to RGB was done). The main reason for that is that ITK is a processing toolkit, so quantitative analysis is supposed to be done on the best possible pixel representation. Since conversion from integer YBR_FULL to integer RGB colorspace is a lossy operation (truncation in floating point representation), the conversion has never been implemented.
As side note MONOCHROME1 color space is not converted to MONOCHROME2 (itk::GDCMImageIO / ITK 5.0)
ITK currently does not have any standard way of noting the color space of an Image. Originally, there was a direct mapping between the `ImageIOBase::PixelType` and the intended pixel type used for the template parameter in the `Image` class. Modern usage of ITK frequently uses the generalized `VectorImage` to hold multi-component images so there may even be less knowledge of the content in the Image buffer. Additionally, we need to consider the default behavior of `ConverPixeltBuffer` (https://itk.org/Doxygen/html/classitk_1_1ConvertPixelBuffer.html), which may be applied when an image is loaded by the `ImageFileReader`. For example if the ImageIO loads a 3 component pixel buffer and the ImageFileReader is templated over a scalar image default a RGB to Gray scale conversion occurs based on the CIE luminance for the 3-components.
This behavior was considered ok, as long as the image was not directly loaded in viz application such as Slicer, where unexpectedly the image would appears with a weird color scheme. (original bug report from Mihail Isakov)
BCL: After hearing the descriptions of the issue, I considered loading YBR directly as a bug because GDCMImageIO was reporting the pixel type as `IOPixelType::RGB` and the buffer was in YBR color space. If the image is loaded in YBR color space is should have a different `IOPixelType` may be `VECTOR` or `FIXEDARRAY` for lack of a more descriptive `IOPixelType`.
The behavior for YBR_FULL vs RGB color model has been discussed and it seems consensus would be to convert to RGB always. Since DICOM, JPEG and TIFF can be somewhat relates for this matter, we should strive to keep the behavior consistent.
Current behavior of ITK 5.0:
| Photometric Interpretation | JPEG | TIFF | GDCM | DCMTK |
|---|---|---|---|---|
| MONOCHROME1 | X | MONOCHROME2 (aka min-is-black) | MONOCHROME1 | ?MONOCHROME1? |
| MONOCHROME2 | MONOCHROME2 | MONOCHROME2 (aka min-is-black) | MONOCHROME2 | MONOCHROME2 |
| PALETTE COLOR | X | RGB (??) | Converted to RGB | ?Converted to RGB? (need to check compressed LUT) |
| RGB | RGB | RGB | RGB | ?RGB? |
| HSV | ||||
| ARGB | ||||
| CMYK | ||||
| YBR_FULL | ITU 81 enforce sub-sampling | ?? | YBR_FULL | ?? |
| YBR_FULL_422 | RGB | RGB | YBR_FULL | ??Maybe RGB? |
| YBR_PARTIAL_422 | ||||
| YBR_PARTIAL_420 | ||||
| YBR_ICT | ITU 81 does not support this colorspace | ?? | RGB | no J2K plugin |
| YBR_RCT | ITU 81 does not support this colorspace | ?? | RGB | no J2K plugin |
Desired behavior of ITK 5.0:
| Photometric Interpretation | JPEG | TIFF | GDCM | DCMTK |
|---|---|---|---|---|
| MONOCHROME1 | X | MONOCHROME2 (aka min-is-black) | MONOCHROME2 | MONOCHROME2 |
| MONOCHROME2 | MONOCHROME2 | MONOCHROME2 (aka min-is-black) | MONOCHROME2 | MONOCHROME2 |
| PALETTE COLOR | X | RGB | Converted to RGB | RGB |
| RGB | RGB | RGB | RGB | ?RGB? |
| HSV | ||||
| ARGB | ||||
| CMYK | ||||
| YBR_FULL | ITU 81 enforce sub-sampling | ?? | RGB | RGB |
| YBR_FULL_422 | RGB | RGB | RGB | RGB |
| YBR_PARTIAL_422 | ||||
| YBR_PARTIAL_420 | ||||
| YBR_ICT | RGB | no J2K plugin | ||
| YBR_RCT | RGB | no J2K plugin |
When a Photometric Interpretation is specified in red, it means this is not supposed to happen (does not make any sense). When a Photometric Interpretation is specified in silver background, it means the Photometric Interpretation is retired.
Participants:
For visualization people it is important that:
The requirements for quantitative analysis may be different, please list reqs here:
For ITK consistency it is important that the `ImageIOBase::PixelType` is set correctly so that users of the `ITK::ImageIOBase` API know generally what the image buffer is and how to load and use the image. We likely should improve the documentation in the ImageIOBase class about the expectations for how these are used. Here is a list of type pertinent to this discussion: