Wrong MPR image orientation when using vtkResliceImageViewer

I am using vtkResliceImageViewer for displaying MPRs. Depending on the dataset I load, I am facing problems related to orientation. In the below example image, first row shows the image orientations displayed in Slicer3D. For the same dataset, when using vtkResliceImageViewer in my vtk source, some of the images appear rotated as shown in the second row.

I was able to fix this problem by manually rotating the actor by

> self.resliceImageViewerMPRA.GetImageActor().RotateZ(180)

but I am not happy with the solution because it is not a global solution. For some datasets, the above source line is needed and for some, it is not needed. I was wondering if we have any member functions in vtkResliceImageViewer to help me in displaying the MPRs at proper image orientation. If there are no member functions, do you have any idea on what calculation/computation I should be doing?

If you want to display the image in standard anatomical orientations then you need to take into account the IJK to LPS transformation stored in the DICOM image. It is called PatientMatrix in vtkDICOMReader.

I would not recommend to build a medical imaging application on raw VTK, though. Instead, you can build your application on any of the open-source VTK-based medical imaging frameworks, such as 3D Slicer or MITK. These frameworks have been developed for the exact purpose of allowing R&D projects to focus on science and innovation instead wasting time with redeveloping trivial features from scratch.

1 Like

Thank you Andras! Your reply gives me some direction. Unfortunately, I have to continue working on my standalone application as I am a visualization researcher. I am using a vtkNIFTIImageReader because my files are not DICOM but a NIFTI. In vtkNIFTIImageReader, I have only functions like GetQFormMatrix () and GetSFormMatrix () . What would be the corresponding member function that gives the PatientMatrix in vtkNIFTIImageReader class? Can you also please throw some light on this?

GetQFormMatrix and GetSFormMatrix provide you the patient matrix (in two slightly different forms).

If you use VTK for visualization then you can just as well use 3D Slicer or MITK, as they all use VTK for visualization. VTK cameras, renderers, shaders, etc. are all exposed the same way as in plain VTK and you are free to do whatever you need.

For example, developers of VTK-based PRISM rendering framework make available their results as a 3D Slicer extension so that it can easily be easily accessed by clinical end users and other researchers. Visualization researchers don’t need to spend time with implementing features that are essential for clinical evaluation, such as importing, positioning, pre/post-processing the images, specify input points or regions, etc. Usability and effectiveness of new visualization methods can be evaluated in for various clinical tasks, ranging from simple diagnostic workflows to intra-operative surgical navigation or virtual reality - without implementing a single line of code (because these are all provided by the application platform).

I was thinking if we can use large portion of existing code (from Slicer) into a brand new C++ application. Is that can be possible ? If it is, I would ready to be involved right away …

Yes, of course, 3D Slicer is very modular, so you can pick only the pieces what you actually need (you could even delete unneeded modules, but it is simpler to just exclude them from the build). There is even a custom application template that most companies and research groups use as a starting point to build 3D Slicer based prototypes or products. This page is a good starting point: https://blog.kitware.com/slicercat-creating-custom-applications-based-on-3d-slicer/

1 Like

A question about oblique slicing: Is there a way to show orientation labels on each of the 3 orthogonal views as we rotate the slice cursors?