Page MenuHomePhabricator

Problem with saving / loading rotated 2D images
Closed, ResolvedPublic

Description

After creating a rotated 2D image with the ExtractDirectedPlaneImageFilterNew, saving and loading the produced image does not work.

Conceptual Problem: 2D Image format cannot save all the geometry information needed for a 3D orientation in space, because they only have a 2D matrix.

Current behavior: No error message when saving. No error message when loading, it simply does not appear in the datamanager. However in the console, you have some error message that the itk matrix inversion does not work: Example image in different formats here:
t:\temp\Plane p4.mhd
t:\temp\Plane p4.zraw
t:\temp\Plane p4.nrrd

Desired behavior:

  • A warning should appear, that geometry information will be lost, saving this file as 2D image. The image should be rotated to fit the z-Plane, so the rotation can be displayed in a 2D image and the 3rd dimension spacing is obsolete. Then it can be saved as in 2D image format
  • The user should have the possibility to select a file format which conserves the 3D orientation of the image. Possibility 1) Increase the dimension to 3D, before saving Possibility 2) Create a new Image format, specially for 2D planes in 3D space, specially for MITK

Event Timeline

Andreas and I found two locations where the image writing as well as the reading
of 2D images are going wrong.

In the mitkImageWriter the dimension of the image is used as a counter to get
the TansformMatrix vectors of the geometry. So for the case of a 2D image this
causes a 2x2 Matrix instead of a 3x3. The Lines are 94, 101 in
mitkImageWriter.

.. still need do change something..

Could you please add a "\brief" doxygen description for the new filter class before merging?

Added documentation, moved "2D geometry loss check" to separate function in geometry 3D and added a MITK Warning in file writer

[f8e4b0]: Merge branch 'bug-11115-SaveRotated2DImages'

Merged commits:

2012-08-09 09:36:02 Bastian Graser [bab43d]
fixed bug in test


2012-08-08 23:03:52 Bastian Graser [1e2d01]
Fixed a bug where mitkFileReader might change input image


2012-08-08 17:44:10 Bastian Graser [8b23dd]
When Geometry info is lost, use identity matrix to ensure valid worldIndexTransform!
Also adapted test to test this.


2012-08-08 14:47:39 Bastian Graser [d6b359]
Added documentation, moved "2D geometry loss check" to separate function in geometry 3D and added a MITK Warning in file writer


2012-08-02 10:29:45 Bastian Graser [d89be1]
Finished Test for 2D 3D Converter. Still need to check manually. Does it freeze when i click anywhere etc


2012-08-01 15:52:12 Bastian Graser [291adf]
rotation function was not executed when no reference geometry was set. had to change that


2012-07-18 17:13:03 Bastian Graser [e7d7b7]
Rotation of image is not working yet


2012-07-18 17:07:48 Bastian Graser [820eb5]
Deleted old code function. Now, when a 3D image is loaded , a 3D image is created


2012-07-18 16:34:10 Bastian Graser [251ab6]
Integrated filter to GUI File Saving


2012-07-18 16:30:16 Bastian Graser [2b2554]
cleaned up


2012-07-18 16:29:04 Bastian Graser [4f19be]
Changed filter name due to compatibility issues. Implemented filter and test. New Issues occured: When MITK loads 3D images with one slice in z-axis, its converted to 2D.


2012-07-16 11:26:05 Bastian Graser [85ddf9]
work in progress


2012-07-11 15:34:26 Bastian Graser [828c33]
Add check and routine for rotated 2D images

[042d7a]: Merge branch 'bug-11115-SaveRotated2DImages'

Merged commits:

2012-08-09 10:08:50 Bastian Graser [b87f6a]
COMP corrected wrong datatype

[fde886]: Merge branch 'bug-11115-SaveRotated2DImages'

Merged commits:

2012-08-09 10:34:37 Bastian Graser [678481]
COMP fixed typename issue

[56dc1d]: Merge branch 'bug-11115-SaveRotated2DImages'

Merged commits:

2012-08-09 11:00:04 Bastian Graser [30ec8a]
COMP fixed again