How to set which Anatomical plane the imported image is

I learned through the ‘vtkFourPaneViewer’ example and the ‘vtkImageImport’ example, and finally I can import the Axial image into the vtkImageViewer to view the MPR and 3D View.
However, if I import a Sagittal image, the result is wrong.
I belatedly realized that I had to set the anatomical plane of the image to be imported.
What is involved in this? Which values are related to DICOM TAG, and how should I use them?
I want to know what to learn.

I would recommend to use a dedicated library to read DICOM images, such as @dgobbi’s vtkDICOM.

1 Like

The reason I used vtkImageImport is to use my company’s Dicom Library.
If you refer to the source code of vtk-DICOM you presented, can you find the answer to my question?
I want to show the mpr correctly, no matter what type of anatomical plane the original image is. Please tell me what it is related to.

DICOM stores position and orientation of each frame separately and it requires very complex logic to reliably reconstruct a 3D volume from them. It is not guaranteed that all frames (instances in a series) have the same orientation, same spacing between them, and it can be difficult to determine which frames belong to which volume when the sequence contains multiple time points.

If you need to read 3D volumes but all your current DICOM library can do is to read values of DICOM tags then you need to switch to a better DICOM toolkit.

Alternatively, you may use dcm2niix to reconstruct the image volume and just use your current DICOM library for getting metadata from an image.

Maybe you don’t know that there are excellent free, open-source, VTK-based medical image visualization and analysis frameworks that you can build your applications on, so you never have to think about reimplementing such low-level mechanisms. 3D Slicer and MITK stands out, but you can find many others, too. Building on a strong application framework allows you to focus on things that matter for you and for your company and not wasting time with reimplementing basic things. Your experience in VTK will be still very useful, as these frameworks heavily rely on VTK and allow you to customize/add features using VTK.

Can you tell me about this quote? Is it very complicated? Can’t I?

Using this framework, can I include only features in dll format in my project? Or is it an external executable program?

Please help me finish my project.
I got hope from my first question below and proceeded to develop with vtk, but I am losing hope.

3D Slicer and MITK are both completely free, open-source, restriction-free packages.

I know 3D Slicer better, as I’m one of its developers, so a bit more information about this platform: You can implement features in C++ or Python. You can just use the official package and customize the application and extend with new features. However, most companies that build their product on 3D Slicer end up creating a custom application, with their own extensions and branding (logo, design, custom set of modules, etc.) - see Slicer Custom Application template for details. To get started, check out training materials here and feel free to ask any questions on the Slicer forum.

I have read both Boot Camp and Slice CAT.
But that is not what I want.
i can guess the anatomical plane by referring to DICOM’s PatientOrientation. How should I output the correct MPR using vtk regardless of the anatomical plane of the input image?

Should I convert the plane of the input image to axial plane?
Or should I tell vtk that the input image is coronal, for example?

You cannot rely on Patient Orientation (0020,0020) attribute as it is conditional and very rarely set. 3D imaging software must almost always use Image Position (Patient) (0020,0032) and Image Orientation (Patient) (0020,0037) attributes to reconstruct a volume in LPS coordinate system.

None of these. Once your volume is reconstructed in a known physical coordinate system, the problem is solved, as MPR planes are already defined in physical coordinate system.

Before VTK9, vtkImageData could not have arbitrarily oriented coordinate system axes and you had to maintain that information outside the image data object. Now image orientation can be is all stored in vtkImageData, so things should be simpler.

Can you write a bit more about your project? What is your goal?

Sorry. There is a misunderstanding about mentioning the Patient Orientation Tag.
The DICOM Tag I was trying to say is (0020, 0037) ImageOrientation (Patient). I can know the direction of the plane through the corresponding DICOM Tag. And I know I need to pass these six values ​​to the VTK coordinate system, but I don’t know how.

know a little bit about DICOM, but I lack the basic knowledge of math and 3D programming. I thought it would be easy to implement this with the help of VTK. But even with VTK, I feel that I need some knowledge of mathematics and 3D programming.

My first goal is simply to render a series of CT or MR images in MPR and 3DView on top of the 4 parent windows created in my project.
The second goal is to get all the Dicom tags and pixeldata through my Dicom library, so use the image information in the c image and dicom tags obtained through this library. (not use gdcm, vtk-dicom, …)
It has progressed to some extent with the help of the Qt FourPaneViewer example and @dggobi, and I am currently facing this problem.

/Dicom Load using my Dicom library./
/Slice ordering using Pixel Spacing, Image Orientation, and Image Position values./
/Pass c-image and dims to vtkImageImport./

I need something here…

/code below is similar to FourPaneViewer./

I would solve this by using an existing open-source application platform and I would be happy to guide you if you choose to do so. You can of course choose to reimplement these features from scratch again and may be able to find someone to help you with that. If nobody volunteers and you cannot figure it all out from VTK’s extensive documentation and examples then you might need to contract Kitware or other VTK experts for getting help.

Thanks for the answer.
I will find the answer myself.

1 Like

Hello, Andras Lasso.
I found half what I wanted.
There were some of the things you had already told me.
vtk-dicom’s vtkDicomReader member variable Patient Matrix was related to what I needed.
PatientMatrix was created with image orientation and image position to apply the patient coordinate system.

As the contents of the quotation, the coordinate system is applied, so even if you enter the Coronal Plane, the three planes are displayed properly. (axial too)

However, it is still incorrect when you enter the Sagittal Plane.
Is there anything else I should do? (I think my previous question was too broad to answer. :wink: )

And according to the content on the page below,

vtkImageViewer is said to read from the bottom left of the pixel image.
However, in the case of DICOM’s PixelData, compatibility is required because the upper left is stored as the first pixel.
I’m using the vtkResliceImageViewer class like the FourPaneViewer example, does it apply equally? (The vtkResliceImageViewer class was inheriting vtkImageViewer2.)

Thank you.