[vtkusers] Correct anatomical orientation of volumes from Niftii and DICOM

David Gobbi david.gobbi at gmail.com
Thu May 10 19:37:57 EDT 2018


Hi Todd,

The DICOM patient coordinate system and the NIFTI world coordinate system
both follow the right hand rule (there is a sign change along two axes, not
just along one axis).  Flipping along the z axis will certainly not fix the
issue.

 - David

On Thu, May 10, 2018 at 5:26 PM, Todd <nztoddler at yahoo.com> wrote:

>
>
> On 11 May 2018 5:11 a.m., David Gobbi <david.gobbi at gmail.com> wrote:
>
> Hi Panos,
>
> It is possible to display NIFTI and DICOM together in the same program,
> but this isn't something you can achieve simply by adjusting things with
> vtkImageChangeInformation or with FileLowerLeftOn().
>
> Here are some key points:
>
> 1) NIFTI is fundamentally a 3D, volumetric, oriented image format.  In
> order to properly display a NIFTI file, you must use the orientation info
> embedded in the file (the sform or the qform).
>
> 2) DICOM is fundamentally a 2D image format, but of course the
> meta-data contains info to allow DICOM images to be reconstructed
> into a 3D volume and oriented in 3D space.
>
> Since DICOM originated as a 2D format, you can ignore the orientation
> meta-data and still display the data reasonably.  For example, if you
> show an axial CT or MR head data set, you can reasonably trust that
> the nose will point to the top of the image, and that the left ear will be
> on the right, even without checking the ImageOrientationPatient info.
>
> This is not true of NIFTI.  If you don't check the sform or the qform in
> the NIFTI header, you have no way to know whether left is left or
> left is right on the 2D slices, even if you know that the slices are axial.
> There is no way to robustly display NIFTI with the correct orientation
> unless you use the sform or qform info.
>
> 3) The 3D coordinate systems of DICOM and NIFTI differ. The 3D "y"
> direction in NIFTI maps to the 3D "-y" direction in DICOM, and
> similarly "x" maps to "-x".  Note that I'm talking about the the 3D
> directions in the oriented coordinate system, I'm not talking about
> the vertical or horizontal direction in the 2D coordinate system.
> This isn't something that you can properly account for by flipping the
> image.
>
>
> What you're describing here is a right-handed coordinate system for DICOM
> and a left-handed coordinate system for NIFTY. In that case, for
> consistency, it would be simpler just to flip the z axis of one data set.
> It doesn't really matter which is chosen, provided one is cognicient of
> what a positive axial rotation means in that CS.
>
> As an engineer I always revert to a right-handed CS, otherwise the mental
> gymnastics are too onerous.
>
>
> In order to properly map from DICOM coords to NIFTI coords, so
> that you can display DICOM and NIFTI together, you should get the
> orientation info from both the DICOM and the NIFTI, and you should
> account for the difference in the 3D coordinate systems for each.
>
> If you can be certain that the NIFTI files are from an axial scan, then
> at the very least you must check the sform or qform in order to get
> left/right and up/down correct.
>
>
> Read everything that you can find on DICOM and NIFTI orientation,
> it's a tricky subject and goes beyond what can be answered on a
> mailing list.  Here's a few links:
>
> Here's the Slicer page on coordinate systems:
> https://www.slicer.org/wiki/Coordinate_systems
>
> The official NIFTI documentation for orientation:
> https://nifti.nimh.nih.gov/nifti-1/documentation/
> nifti1fields/nifti1fields_pages/qsform.html
>
> The official DICOM documentation for orientation:
> http://dicom.nema.org/MEDICAL/dicom/current/output/chtml/
> part03/sect_C.7.6.2.html
>
> This is a program that I wrote to convert NIFTI images to DICOM,
> the code isn't easy to follow but it contains all the needed logic:
> https://github.com/dgobbi/vtk-dicom/blob/master/Programs/
> niftitodicom.cxx#L482
>
> Hope this helps.
>
>  - David
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180510/16e8ff48/attachment.html>


More information about the vtkusers mailing list