Yet another VTK, DICOM and Orientation problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Yet another VTK, DICOM and Orientation problem

Romain LEGUAY
Hello everyone,

I'm trying to create a viewer of dicom with anatomical views (axial, sagittal and coronal) from a radiologist point of view.

As starting point, I use the example provided in vtkDICOM module : testDicomDisplay
It uses vtkDICOMReader with SetMemoryRowOrderToFileNative activated.

When I try to display an axial CT scan, I don't obtain expected orientation as you can see in pic1: the sagittal view is in Posterior -> Anterior direction.
pic1.png

When I try to display a sagittal CT scan, I have different orientations:
pic2.png

To fix this orientation problem, I tried to create some transformation matrices that converts
Patient Coordinates (DICOM) to World Coordinate (VTK coordinates).

To do this, I follow those steps:
* get the patient matrix (Pm) using the method vtkDICOMReader::GetPatientMatrix (if I understand correctly, this matrix is in DICOM space)
* create the rotation (Rm) from DICOM space to VTK space (rotation on VTK X-axis around the origin point): 
1 0 0 0
0 -1 0 0
0 0 -1 0
0 0 0 1
* Multiply Pm by Rm to obtain the matrix PRm to go from Patient Coordinates to VTK Coordinates.
* Use the Matrix PRm with a point in IJK coordinates (voxel coordinates) multiplied by the spacing.

I know I made a mistake because I don't have the result expected but I don't know what I did wrong...

Can someone provide me some tips please?

Thank you,

Romain





_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Yet another VTK, DICOM and Orientation problem

David E DeMarle via vtkusers
Hi Romain,

To learn which rotation matrix would be needed, you could load the dataset into 3d Slicer and inspect the direction cosine in the Volumes module. See https://download.slicer.org/

That said, considering that VTK is orientation-less (there are no direction cosines associated with vtkImageData), building an medical image viewer is a significant amount of work.

Also worth noting that there is a proposal to add orientation into vtkImageData but some more validation is needed, see https://www.slicer.org/wiki/Documentation/Labs/VTK-Orientation

Hth
Jc

On Tue, Dec 11, 2018 at 8:12 AM Romain LEGUAY <[hidden email]> wrote:
Hello everyone,

I'm trying to create a viewer of dicom with anatomical views (axial, sagittal and coronal) from a radiologist point of view.

As starting point, I use the example provided in vtkDICOM module : testDicomDisplay
It uses vtkDICOMReader with SetMemoryRowOrderToFileNative activated.

When I try to display an axial CT scan, I don't obtain expected orientation as you can see in pic1: the sagittal view is in Posterior -> Anterior direction.
pic1.png

When I try to display a sagittal CT scan, I have different orientations:
pic2.png

To fix this orientation problem, I tried to create some transformation matrices that converts
Patient Coordinates (DICOM) to World Coordinate (VTK coordinates).

To do this, I follow those steps:
* get the patient matrix (Pm) using the method vtkDICOMReader::GetPatientMatrix (if I understand correctly, this matrix is in DICOM space)
* create the rotation (Rm) from DICOM space to VTK space (rotation on VTK X-axis around the origin point): 
1 0 0 0
0 -1 0 0
0 0 -1 0
0 0 0 1
* Multiply Pm by Rm to obtain the matrix PRm to go from Patient Coordinates to VTK Coordinates.
* Use the Matrix PRm with a point in IJK coordinates (voxel coordinates) multiplied by the spacing.

I know I made a mistake because I don't have the result expected but I don't know what I did wrong...

Can someone provide me some tips please?

Thank you,

Romain




_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers