Page MenuHomePhabricator

ExtractSliceFilter uses wrong geometry
Closed, WontfixPublic

Description

SegmentationInterpolationTest fails, because the used ExtractSliceFilter returns displaced Slices.

Maybe due to using WorldGeometry instead of ImageGeometry.

Event Timeline

mitk::SegmentationControllerInterpolator.cpp line 445

New remote branch pushed: bug-15013-extractslicefilterGeometries

We assume that at Joesphs indicated position in the code, extractSliceFilter is called with an image geometry, though it is expecting a bounding geometry.

We tried to modify the "SetWorldGeometry" method to check the given geometry, if it is an image geometry or not, and if necessary, change it to a bounding geometry.

For yet unknown reasons, it crashes when i do not use the given geometry directly, but clone it..
however, i wanna clone it and adjust it a little before furhter use...

The cause for the crash is an issue with cloning a Geometry2D. The IndexToWorldTransform is somehow corrupted.
My approach is to consider the ImageGeometry property within GenerateData and adapt the origin and extend on the fly.

New remote branch pushed: bug-15013-wrong-Geometry-in-ExtractSliceFilter

bug-15013-wrong-Geometry-in-ExtractSliceFilter
contains the consideration of image geometry property within GenerateData. The reslice origin is adapted if a bounding geometry is used.

All rendering test passed.

The image shift can be solved this way. SegmentationInterpolationTest passes for the first slice. Unfortunately SegmentationInterpolationTest still fails after that. It seems that within the test the plane for reslicing is not changed. I checked the interpolation manually in mitkWorkbench and works fine in all plane without any shift. Therefore SegmentationInterpolationTest issue was moved to T15041

Short summary:

The reason why the SegmentationInterpolationTest failed was that the SegmentationInterpolationController passes the Geometry2D of the SlicedGeometry of the segmentation image at a given index to the ExtractSliceFilter. This is bad for two reasons:

  1. The geometry is an image geometry which should not be used for reslicing.
  2. The geometry always represents the axial view to the image. Hence the 2D interpolation does not work in other dimensions.

Solution:

Due to changes which will come with T12844 the QmitkSlicesInterpolator will listen to GeometrySliceEvents which are published by the SliceNavigationController. The SliceNavigationController also has a CurrentWorldGeometry2D which can be used for the ExtractSliceFilter. Setting the SetResliceTransformByGeometry(imageGeometry) guarantees that the slices are always extracted correctly even in case of rotated MRIs.

The according fixes will be done with T12844 but the SegmentationInterpolationTest will have to be adapted accordingly.

SetResliceTransformByGeometry was removed. The transformation is now always used to reslice bya given plane. So the resample grid is rotated within extraction step. That what was set manually by rendering so far and had to be done by any user of ExtractSliceFilter for rotated images.

Added rendering tests for rotated MRI images. One is using a 'global reinit' by default and the other one performs a 'reinit' on render window.

What is the status of this bug? Please change the target milestone to "AfterNextRelease" if this bug is not relevant or cannot be fixed in time for the 2013-06 release.

[5ab1f1]: Merge branch 'bug-15013-wrong-Geometry-in-ExtractSliceFilter'

Merged commits:

2013-06-21 11:25:18 Tobias Schroeder [00a94d]
Updated MITK-Data revision tag.


2013-06-21 11:16:31 Tobias Schroeder [433b66]
Added rendering test performing a reinit.

Test performs a reinit on the render window for the first image in the
datastorage. Added also one test to CMakeLists.txt for rotated MRI image.


2013-06-21 10:06:03 Tobias Schroeder [658a63]
Changed revision tag of MITK-Data.


2013-06-21 09:43:21 Tobias Schroeder [4b660c]
Marked function deprecated.

SetResliceTransformByGeometry(const Geometry3D*) is not necessary any
more. Transformation of the resampling grid is done automatically.


2013-06-18 14:49:47 Tobias Schroeder [f91320]
Added RenderingTest for tilted MRI.


2013-06-14 14:25:57 Tobias Schroeder [266455]
Removed function SetResliceTransformByGeometry.

The relsice transform is now always set from the image geometry.
SetResliceTransformByGeometry was removed from classes that called this
function.


2013-05-17 11:11:52 Tobias Schroeder [d423f6]
Redesign use of image transform.


2013-05-17 07:48:54 Tobias Schroeder [fc038e]
Always use transform of image.


2013-04-26 13:46:30 Tobias Schroeder [53c9b5]
COMP: Fixed usage of non bounding geometries for reslicing


2013-04-26 13:43:31 Tobias Schroeder [dd392b]
COMP: Temporarily removed SegmentationInterpolationTest

[0e0e3b]: Merge branch 'bug-15013-wrong-Geometry-in-ExtractSliceFilter'

Merged commits:

2013-06-26 15:17:28 Andreas Fetzer [df7462]
COMP fixed wrong declaration of rendering testhelper

[b9b35d]: Merge branch 'bug-15013-wrong-Geometry-in-ExtractSliceFilter'

Merged commits:

2013-06-26 16:51:04 Andreas Fetzer [201f9c]
COMP Deactivating rendering test temporarily

[83309f]: Merge branch 'bug-15013-wrong-Geometry-in-ExtractSliceFilter'

Merged commits:

2013-06-26 17:45:09 Andreas Fetzer [ca85df]
Fixed warning for clang compilers

[fdf014]: Merge branch 'bug-15013-wrong-Geometry-in-ExtractSliceFilter'

Merged commits:

2013-06-26 23:37:03 Sascha Zelzer [4d3636]
Removed unused variable to remove compiler warning.

This bug could not be fixed for release 2013-06. Setting target milestone to next release

Changes caused a shift of the feedback contours of the manual segmentation

Again a short summary:

We managed to integrate this bug for the 2013-06 release. Everything seemed to work well except one rendering test fails. The reason was simply a wrong reference screenshot (correct one will be added as attachment).

BUT: the changes cause a 0.5 pixel shift of the segmentation feedback contours.
So we reverted the changes both in the master and the release branch.

Thomas and I had a closer look at it and it seems that due to the changes in this bug, nearly all the 0.5 occurrences regarding image coordinate conversions can be removed.
Unfortunately this will touch a lot of central classes, e.g. like ImageMappers, Geometries, etc...
So we will have to put further investigation into it and discuss it separately.

New reference screenshot with cubic interpolation

tiltHead-Axial640x480.png (480×640 px, 4 KB)

New remote branch pushed: bug-15013-wrong-Geometry-in-ExtractSliceFilter-rebase-revert

Will be addressed in a separate scrum session next year

Current release is finished. Reseting target milestone...

New remote branch pushed: bug-15013-wrong-Geometry-in-ExtractSliceFilter-integration-revert

New remote branch pushed: bug-15013-v2-wrong-Geometry-in-ExtractSliceFilter-integration-revert

The reason for the 0.5 might be due some inconsistent properties of the plane that is used for the rendering. The plane has a center based origin but the flag for IsImageGeometry is set to false. Within reslicing this flag is checked during the creation of the output image. The geometry of the new slice is created from the plane that is used to resample from the image volume. If the plane is not an image-geometry (i.e. flag not set) the origin of the slice will be adapted. For our rendering planes this means the origin is no longer center based!

We should fix the creation of the planes (e.g. set flag to true) and try to enable the changes again that were done before revert. This should be our starting point for discovering the 0.5 issue and not the current status!

Resetting release_fix flag for open bugs which are not yet triaged for the 2014.03 release.

kislinsk claimed this task.

Closed because of inactivity.

kislinsk removed kislinsk as the assignee of this task.
kislinsk added a project: Bulk Edit.
kislinsk removed a project: Bulk Edit.