Page MenuHomePhabricator

Meta Bug: Rework the 2D rendering
Closed, ResolvedPublic

Description

In order to get rid of the iil library, the mitkImageMapperGL2D has to be reworked. The aim is to replace the iil library by means of VTK without losing any functionality.

Event Timeline

We decided to use a vtkPolyDataMapper, which is in fact a 3D mapper, to render a textured plane. Orthographic projection is used to display the textured plane as a 2D image. For each view (transversal, coronal, and sagittal) a plane with the correct size is generated and transformed to the actual 3D position. The vtkCamera is also transformed to the look into the correct direction to view the plane. The texture and the transformation for all this is obtained from the vtkImageReslice being used in the old mitkImageMapperGL2D.

The name of the new mapper will be mitkImageVtkMapper2D.

Done:
-Opacity
-LevelWindow
-Lookuptables
-Zooming
-Panning
-Scaling of the image to fill the renderwindow
-Clipping

Still to implement:
-Binary images handling
-All properties
-Update -> rendering only if necessary
-There seem to some parts in the MITK part of the rendering where everything is implemented for the mitkVtkMapper3D only. This has to be enhanced for the mitkVtkMapper2D. For instance: vtkMitkRenderProp::HasTranslucentPolygonalGeometry()

Known bugs are:
-The demo data set P0214_scaled_0.55_0.55_0.55.pic.gz is not rendered at all. Reason: unknown.
-The texture is not rendered 100% horizontally. Every few millimeters very few pixels are drawn wrong. Probably this also causes the crosshair not the hit each pixel-center 100% acuratly. Reason: unknown.
-The crosshair is rendered black. Reason: OpenGL side effects from the VTK mapper.

Fixed:
-The texture is not rendered 100% horizontally.

Buglist:
-The demo data set P0214_scaled_0.55_0.55_0.55.pic.gz is not rendered at all.
Reason: unknown.
-The crosshair is rendered black. Reason: OpenGL side effects from the VTK
mapper.
-Swivil mode and crosshairotation create wrong (textured) planes and thus wrong images.

Still to implement:
-Binary images handling
-All other properties
-Update -> rendering only if necessary
-There seem to some parts in the MITK part of the rendering where everything is
implemented for the mitkVtkMapper3D only. This has to be enhanced for the
mitkVtkMapper2D. For instance:
vtkMitkRenderProp::HasTranslucentPolygonalGeometry()

The reason for the problems with the rotation could be that the planes are not rotated in the origin.

Buglist:
-The demo data set P0214_scaled_0.55_0.55_0.55.pic.gz is not rendered at all.
Reason: unknown.
-The crosshair, contours, and points are rendered black. Reason: OpenGL side effects from the VTK mapper.
-Swivil mode and crosshairotation create wrong (textured) planes and thus wrong
images. Possible explanation: Rotation not in origin.

Still to implement:
-Binary images handling
-All other properties
-Update -> rendering only if necessary
-There seem to be some parts in the MITK part of the rendering where everything is implemented for the mitkVtkMapper3D only. This has to be enhanced for the
mitkVtkMapper2D. For instance:
vtkMitkRenderProp::HasTranslucentPolygonalGeometry()

To "The crosshair, contours, and points are rendered black":
The VTK mapper sets a different state of GL_TEXTURE_2D then our openGL mappers which causes the black color.

We can fix this if we save the state of GL_TEXTURE_2D before rendering in VTK. But this is just a workarround.

Buglist:
-The demo data set P0214_scaled_0.55_0.55_0.55.pic.gz is not rendered at all.
Reason: unknown.
-The crosshair is rendered black. Reason: GL_TEXTURE_2D
-Swivil mode and crosshairotation create wrong (textured) planes and thus wrong
images.
-In translucent mode the image is rendered over the crosshair.

Still to implement:
-Binary images handling
-All other properties
-Update -> rendering only if necessary
-There seem to some parts in the MITK part of the rendering where everything is
implemented for the mitkVtkMapper3D only. This has to be enhanced for the
mitkVtkMapper2D. For instance:
vtkMitkRenderProp::HasTranslucentPolygonalGeometry() (T8150)

Fixed & implemented:
-The crosshair is rendered black. Reason: GL_TEXTURE_2D
-Binary images handling (except binary outline)
-All other properties

Buglist:
-The demo data set P0214_scaled_0.55_0.55_0.55.pic.gz is not rendered at all.
Reason: unknown.
-Swivil mode and crosshairotation create wrong (textured) planes and thus wrong
images.
-In translucent mode the image is rendered over the crosshair.

Still to implement:
-Binary outline
-Volume annation
-Update -> rendering only if necessary (T8165)
-There seem to some parts in the MITK part of the rendering where everything is
implemented for the mitkVtkMapper3D only. This has to be enhanced for the
mitkVtkMapper2D. For instance:
vtkMitkRenderProp::HasTranslucentPolygonalGeometry() (T8150)

Buglist:
-The demo data set P0214_scaled_0.55_0.55_0.55.pic.gz is not rendered at all.
Reason: unknown.
-Swivil mode and crosshairotation create wrong (textured) planes and thus wrong
images.
-In translucent mode the image is rendered over the crosshair.
-RGBA images are not rendered
-Changing a property (like color) calls first GetVtkProp() and then GenerateData(), which is a wrong pipeline flow and results in not rendered properties (T8261)

Still to implement:
-Binary outline
-Volume annation
-Update -> rendering only if necessary (T8165)
-There seem to some parts in the MITK part of the rendering where everything is
implemented for the mitkVtkMapper3D only. This has to be enhanced for the
mitkVtkMapper2D. For instance:
vtkMitkRenderProp::HasTranslucentPolygonalGeometry() (T8150)

-In translucent mode the image is rendered over the crosshair:

The method PrepareMapperQueue does not define the order of the rendered props, because the mapper rendering the crosshair does not appear there. (Because it's not a VTK mapper)

Fixed:
-In translucent mode the image is rendered over the crosshair. Workarround: The image planes are rendered in the z = 0 plane and the crosshair is now rendered into z = 1 to be above the image.

Buglist:
-The demo data set P0214_scaled_0.55_0.55_0.55.pic.gz is not rendered at all.
Reason: unknown.
-Swivil mode and crosshairotation create wrong (textured) planes and thus wrong
images. Reason: Rotation not in origin???
-RGBA images are not rendered
-Changing a property (like color) calls first GetVtkProp() and then
GenerateData(), which is a wrong pipeline flow and results in not rendered
properties (T8261)

Still to implement:
-Binary outline (T8359)
-Volume annation
-Update -> rendering only if necessary (T8165)
-There seem to some parts in the MITK part of the rendering where everything is
implemented for the mitkVtkMapper3D only. This has to be enhanced for the
mitkVtkMapper2D. For instance:
vtkMitkRenderProp::HasTranslucentPolygonalGeometry() (T8150)

I figured out that RBGA images are displayed but not dti (diffusion) images.

Buglist:
-The demo data set P0214_scaled_0.55_0.55_0.55.pic.gz is not rendered at all.
Reason: unknown.
-Swivil mode and crosshairotation create wrong (textured) planes and thus wrong
images. Reason: Rotation not in origin??? (T8389)
-dti images are not rendered
-Changing a property (like color) calls first GetVtkProp() and then
GenerateData(), which is a wrong pipeline flow and results in not rendered
properties (T8261)

Still to implement:
-Binary outline (T8359)
-Volume annation
-Update -> rendering only if necessary (T8165)
-There seem to some parts in the MITK part of the rendering where everything is
implemented for the mitkVtkMapper3D only. This has to be enhanced for the
mitkVtkMapper2D. For instance:
vtkMitkRenderProp::HasTranslucentPolygonalGeometry() (T8150)

Iggi and I figured out that the actor of the dti image is rendered correctly inside a vtkRenderWindow, the lookuptable is not responsible, and the RenderOpaque method is called. However, the image is still "invisible".

Buglist:
T8461:
-The demo data set P0214_scaled_0.55_0.55_0.55.pic.gz is not rendered at all.
Reason: No rendering method is called during the pipeline.
-dti images are not rendered. Reason: unknown

Still to implement:
-Volume annation (T8140)
-Update -> rendering only if necessary (T8165)
-There seem to some parts in the MITK part of the rendering where everything is
implemented for the mitkVtkMapper3D only. This has to be enhanced for the
mitkVtkMapper2D. For instance:
vtkMitkRenderProp::HasTranslucentPolygonalGeometry() (T8150)

Still to implement:
-Volume annation (T8140)
-Update -> rendering only if necessary (T8165)
-There seem to some parts in the MITK part of the rendering where everything is
implemented for the mitkVtkMapper3D only. This has to be enhanced for the
mitkVtkMapper2D. For instance:
vtkMitkRenderProp::HasTranslucentPolygonalGeometry() (T8150)

Everything else is fixed.

I just tested my rendering again with all my testing data:
-RBG(A) images, QBalls, Contours, etc.

Everything seems to work fine. I pushed a very stable version in branch:
bug-7027-2DRendering

Furthermore, I wrote a wiki specification page for the merge. Questions, feedback and reviews are welcome! I would like to merge into the master now! :)

Todo:
-Solve 8140, 8150 and 8165.

Removed the dependency to the volume annotation feature request. Closing this.