Page MenuHomePhabricator

Initializing a mitk::Image with vtkImageData does not consider multiple scalar components
Closed, DuplicatePublic

Description

The import code in mitk::Image for a vtkImageData instance does not support multiple scalar component images from VTK:

http://mitk.org/git/?p=MITK.git;a=blob;f=Core/Code/DataManagement/mitkImage.cpp;h=05612c374f9422899a68e1cbc9b158d9a96fb63c;hb=HEAD#l954

It seems that the commented code supported multiple components in the past. We need to check how to re-establish the functionality and create a unit test for it.

Related Objects

Event Timeline

I managed to import images with multiple scalar components from VTK by taking the same steps as found in mitk::Image::Initialize, but creating the correct PixelType myself. This works flawlessly for RGB(A) images with a component type of unsigned char. Other component types, however, lead to a crash in vtkMitkLevelWindowFilter when the image is rendered. This is probably related to T18411. Another limitation is that the PixelType has to be determined at compile-time.

I'd be happy to provide a patch using my existing import method, but first I'd need to know how to deal with unsupported and/or unknown component types.

Thanks for your analysis. Reading of VTK multi-component images was fixed in T18842. The level window issues with non-integral types are already described in other bugs.