Page MenuHomePhabricator

Crash while loading *.vtk Images with ITK VTKImageIO
Closed, WontfixPublic

Description

When choosing ITK VTK ImageIO to load a *.vtk image the workbench crashes on MAC and Windows. To reproduce the crash load a jpeg image, save it to *.vtk and try to reload it. After loading several seconds the workbench will crash.

Event Timeline

This has been confirmed to be broken under Linux as well.

Apparently, VTK files with multiple colors channels are not being properly handled by MITK which causes the crash on the VTK threads. Yan and I noticed following behaviour with the *.vti / *.vtk files:

VTI format (generated with MITK):

  • RGB / RGBA 2D-Image: *Wrong data displayed*
  • Grayscale 2D-Image: Perfect

VTK format (generated with MITK):

  • RGB / RGBA 2D-Image with VTK Legacy Reader: *Wrong data displayed*
  • RGB / RGBA 2D-Image with ITK VTKImageIO: *Crash*
  • Grayscale 2D-Image with VTK Legacy Reader: Perfect
  • Grayscale 2D-Image with ITK VTKImageIO: Perfect

This has nothing to do with any of the VTK image readers. Any mitk::Image containing RGB/RGBA pixels as float data (like the ones VTKImageIO generates) will make the VTK helper threads crash.

Apparently, a buffer overflow of image data takes place which overwrites random addresses in memory with float values, hence causing crashes at random points. My guess is that the conversion from mitk::Image to vtkImageData is not done properly for RGB/RGBA float data which causes VTK to allocate a smaller buffer than it should.

PS: The VTK Legacy Image reader issues mentioned in the last comment are something completely different (and truly related with reader). More information at T18842.

A posssible workaround for this issue would be storing the floating-point data as unsigned chars (like the VTK Legacy Image reader already does). However this would cause a loss of precision.

I think this is related: when loading a vti/vtk image with active scalar array not set, the application crashes. Attached is a simple patch. Consider it signed-off if you like to integrate it.

I think this is related: when loading a vti/vtk image with active scalar array not set, the application crashes. Attached is a simple patch. Consider it signed-off if you like to integrate it.

kislinsk triaged this task as Normal priority.Aug 10 2016, 5:31 AM
kislinsk added a project: Auto-closed.
kislinsk added a subscriber: kislinsk.

Hi there! 🙂

This task was auto-closed according to our Task Lifecycle Management.
Please follow this link for more information and don't forget that you are encouraged to reasonable re-open tasks to revive them. 🚑

Best wishes,
The MITK devs