moloney / dcmstack

DICOM to Nifti conversion with meta data preservation
Other
72 stars 51 forks source link

dicom COL,ROW vs nifti ROW,COL #25

Closed kevlarkevin closed 10 years ago

kevlarkevin commented 10 years ago

The DICOM patient-centered coordinate system has its x-axis running right-to-left and its y-axis running anterior-posterior, swapped from the NIFTI standard. As far as I can tell, dcmstack does not adjust for this difference between dicom and nifti. This results in NIFTIs that are inconsistent with NIFTIs that were reconstructed with other software, such as Chris Rorden's dcm2nii.

Is this the intended behavior, to not swap rows and columns?

btw. <3 dcmstack. great stuff!

kevlarkevin commented 10 years ago

sorry about close/open. mouse finger slipped.

moloney commented 10 years ago

The axis swap is definitely handled. Perhaps you are confusing the voxel data ordering (how the 3D voxel data is stored) versus the orientation in patient space (specified with the affine). You can control the voxel data ordering with the --voxel-order option.

One relatively easy way to check is to look at the results in fslview and make sure that the orientation labels (LRAPSI) match. The way the three orthogonal images are displayed will only match if the voxel data ordering is the same, but the labels will show if the affine is correct. I hope this makes sense.

If you are still convinced there is a problem, perhaps you can share the dataset?

kevlarkevin commented 10 years ago

You were right, I was confusing voxel data ordering and orientation in patient space. Specifying the voxel order when using DicomStack.to_nifti_wrapper() fixed my problem.

Thank you very much!