Page MenuHomePhabricator

Remove deep copy from ImageVtkMapper2D
Closed, ResolvedPublic

Description

In the ImageVtkMapper2D a DeepCopy() is used to copy the image data (the current slice) from the reslicer to the local storage.

We think there is no need to copy the data and this should be replaced by a simple pointer. However, if we do this the image is rendered 1 pixel higher in the transveral render window. Meaning: the bottom pixel line will be black and the top pixel line will be cut off.

Eric and I figured out that both, the *resliceImage data and the localStorage->m_ReslicedImage, do not change inside the GenerateData() method.

Event Timeline

I used PrintSelf() on both imageData pointers at the beginning and at the end of the method. The only difference is the pointer address and the modified time.

We tried the following, but nothing solved the bug:

  • We removed the m_reslicedImage from the localDatastorage of the ImageVTKMapper2D, so that other classes had no access. So we reduced possible sideeffects.
  • We commented out all references to m_Texture, also to reduce sideeffects.
  • We stopped reusing the single instance of vtkImageReslicd and recreated it for every invocation of the GenerateData() method.
  • We also did every steps, described above, on one render window only (using Step 1)

I figured out that the transformation of the actor was wrong.

The old transformation tried to include the 0.5 offset which is not possible. Now we take the transformation from the image reslice and re-position the actor afterwards to account for the center-based MITK coordinates.

I will verify, write the change request and push this next wednesday.

I tested everything with the test protocol and pushed it to: bug-9562-RemoveDeepCopyFromImageMapper.

[a99585]: Merge branch 'bug-9562-RemoveDeepCopyFromImageMapper'

Merged commits:

2011-11-16 15:40:04 Thomas Kilgus [5677c7]
Removed the DeepCopy. Fixed the 0.5 offset issue. Tested everything with the test protocoll.