Sagittal

Hello. I have a question.
The first screen capture is Slicer, and the second screen capture is my program.
The original image is Axial.


Q1. Why is Sagittal plane looking right instead of left in my program?

Q2. In 3D Slicer, Sagittal is tilted. What data does this relate to?

I used vtkImageFlip to orient it once.
What is missing from my program?

Thank you.

2 Likes

Have you tried to flip it again that sagittal tile ?

Slicer displays in patient space by default. The MRI you are looking at was acquired obliquely.

https://www.slicer.org/wiki/Coordinate_systems

Until recently, VTK has not supported non-axis-aligned images, so unless you use latest VTK and test and enhance your pipeline to fully support these kind of images, then most likely your software displays the data set incorrectly.

When applying the original image, flip was used because the axial and coronal directions in vtk were incorrect. As a result, the axial and coronal were right, but the sagittal was wrong.
I don’t know how to do additional orientation correction.
If A is right, B will be incorrect, and if B is right, A will not be right. What should I do?

No flip >

You can flip the normals or rotate axes of slice views, to flip/rotate a single view.

Note that the problems that you are struggling with are all solved many years ago in numerous open-source medical imaging software that you can just take and freely customize and enhance. Redeveloping basic features is useful as a learning exercise but when you feel ready to do real work then choose a software platform that provides most features that you need and build on that.

I know what you’re talking about
However, my project doesn’t need all the features of an application like 3D Slicer or MITK, and I need a small program suitable for the UI design of my project.
This is why it is necessary to solve this problem.
VTK beginners are very hard to develop, so help is urgent.

It is much easier to disable/hide features that you don’t need than to redevelop all features you need.

It is common for software developers to think that their application will be something simple, providing only a few features. However, the truth is that unless your project dies, you will need to keep adding more features. Existing application platforms already contain all the basic features that you need in the foreseeable future. If you don’t have to worry about redeveloping and maintaining basic features, then you can spend much more time on creating new, valuable functionalities that make a difference.

Okay.
Are there any existing projects using VTK except 3D Slicer and MITK?
Thank you for answer.

2 Likes

Thank you. :wink:

@Yongun_Lee, @lassoan, @pieper,

@Yongun_Lee , did you ever solve your issue?

I’m having the same exact problem and I started with the Four Panes Viewer example recommended by many as a great starting point for performing oblique slicing.

I don’t have time to start over with another app because I need to meet a release deadline. Everything is perfect except that darn Sagittal view need to be flipped horizontally. Originally, the axial view was vertically flipped (superior on the bottom) and in the process of attempting to correct the axial orientation, The sagittal view ended up facing right. Whack-A-Mole. If I could somehow swing the camera to the other side of the body, I think that would solve it. No time to find another example to start over again. Users have high expectations and want his functionality ASAP. I think the problem might stem from the fact that for VTK’s (0 .0) origin is in the lower left corner.

I’ll keep trying things and will let y’all know if I solve this. I’ll share my app after I perfect it. Thanks.

@dgobbi, Does your vtkDICOM solve the above issue?

Image orientation in vtk-dicom is briefly described here. This link is focused on the “reader” and doesn’t talk much about the “viewer”.

In general, you are correct that getting the correct image orientation in the viewer is a matter of properly positioning and orienting the camera for each view. But I haven’t ever really looked at the Qt FourPaneViewer example so I can’t say how it would have to be modified to provide the views that you require.

Hello @sankhesh,

I have been working with your version of FourPaneViewer for usage here at the Mayo Clinic and find that it is great for using as a plug-in to our enterprise viewer, QREADS. I’ve modified it to read compressed DICOM files with GDCM, added orientation markers and removed the recording function. Now, I have having the most challenging time with the following:

  1. Setting the initial orientation to: Axial: ALPR Sagittal: SPIA Coronal: SLIR (clockwise starting at the top). This is our main issue. I was able to make some progress in getting the orientations almost there, but no matter what I do, there is always one view that is 180 degrees out of proper rotation. How do I solve this?

  2. Setting the initial zoom and window level. How do I do this.

  3. Scrolling through the slices with the mouse wheel. How do I gain better control of the mouse wheel events?

But, we love what you’ve done so far to get us started. I eagerly await your response…

@sankhesh FYI: The desired orientations are as seen in @Yongun_Lee Splicer image above.

Hi @dporter,

My apologies but I don’t quite recall which version of FourPaneViewer you’re referring to.
Neverthless, I can answer your questions in terms of general VTK usage below:

  1. I would recommend using vtkImageResliceMapper to do the volume slicing. That way, for the three slices, you would just have to provide three planes along the three orthogonal axes. Once you have the slices, the slice display orientation can be set up via camera parameters.

  2. The zoom can be set by changing the parallel scale on the camera if the view projection is orthogonal. If using perspective projection, use vtkCamera::Dolly.
    The image window width and level can be changed by passing those values through to the image property set on the image actor.

  3. You’d have to override the interactor style. Here is an example that demonstrates using the mouse wheel to control image slice numbers in a DICOM series: https://lorensen.github.io/VTKExamples/site/Cxx/IO/ReadDICOMSeries/

I hope this helps.

Thank you for your response @sankhesh, I know you’re really busy so I try to pack all of my questions in each email to minimize the quantity. Please forgive me.

  1. The version I’m using is the one from your site GitHub - sankhesh/FourPaneViewer: Modifications to the VTK example dated Feb 18th, 2018. Are there better ones out there? I’m assuming the you’re the best. :slight_smile:

  2. What is your favorite open source code that does MPR oblique slicing with Thick Slicing, W/L, zoom, pan. Yours was the best and most intuitive I could find so far. I added @dgobbi code for decompression, sorting and DICOM element access.

  3. Are you at liberty share some of your Slicer code or direct me to it? I’m sure you’ve made improvements since 2018

  4. Does Slice have Image Fusion code such as PET/CT or PET/MRI?

@dporter That is indeed quite old but yes, that was aimed at a simple but comprehensive MPR viewer.

There are some new additions to VTK since then that would provide better performance like the vtkImageResliceMapper to do the actual slicing which also lets you do thick slicing. The window/level operation as well as the camera interaction code for zooming, panning, etc. largely remain the same.

All of the Slicer code base is here: https://github.com/Slicer/Slicer. Getting to individual MPR components there might be tricky as that code is much more organized and modularized than the simple FourPaneViewer example. Having said that, if Slicer and its extensions work well for you, I’d recommend creating a custom Slicer application tailored to your needs. Kitware can help with that.

Slicer used to have a module for image fusion (https://www.slicer.org/wiki/Modules:PETCTFusion-Documentation-3.6). I am not sure of its current status though. However, the clinical term “Image Fusion” can be broken down into three steps - image registration, resampling, display. The first two steps can be achieved using ITK, and VTK would allow display of the registered images.

Wow @sankhesh!

That fusion looks really great and I’m definitely cool with using ITK for registration / resampling. Does it have reference markers similar to MPR triangulation?

Important Question: Would it be extremely difficult to extract the MPR and FUSION code from the Splicer app and create stand-alone executable MPR and Fusion modules? I could then launch it from my app passing the DICOM file paths as args. That’s my plan.

Hey Sankhesh, you have been so so helpful. I feel so much better about the potentials. Have a great weekend and stay safe.