Open neurolabusc opened 1 year ago
Hi Chris,
This is an interesting error. It has to do with the image being a 4D image. If you run c4d on the image, the orientation is correct.
c4d ax_asc_35sl_6.nii -mean -o mean.nii
But if you run c3d, then it does output a 3D image with the reversed orientation. This seems to be related to how an ITK ImageFileReader templated for 3d images reads the NIFTI header.
A solution may be to add a warning to c3d when it is asked to read a 4D (3d+time) image?
Paul
On Sat, Sep 9, 2023 at 10:35 AM Chris Rorden @.***> wrote:
dcm2niix issue 718 https://github.com/rordenlab/dcm2niix/issues/718 appears to suggest that the itksnap tools have issues with NIfTI spatial transforms.
To replicate a minimal example, you consider the NIfTI image ax_asc_35sl_6.nii https://github.com/neurolabusc/dcm_qa/blob/master/Ref/ax_asc_35sl_6.nii which appears correctly in FSLeyes, MRIcroGL and itksnap. The header specifies a LAS orientation:
fslhd ax_asc_35sl_6.nii ... sto_xyz:1 -3.250000 0.000000 -0.000000 104.000000 sto_xyz:2 0.000000 3.230991 -0.388798 -58.684311 sto_xyz:3 0.000000 0.350998 3.578943 -84.798035 sto_xyz:4 0.000000 0.000000 0.000000 1.000000 sform_xorient Right-to-Left sform_yorient Posterior-to-Anterior sform_zorient Inferior-to-Superior
However, operations with c3d creates a NIfTI header that suggests an LPS image, and the resulting image appears flipped in the Anterior-Posterior (row) direction in FSLeyes, MRIcroGL and itksnap:
c3d ax_asc_35sl_6.nii -mean -o mean.nii ... sto_xyz:1 -3.250000 0.000000 0.000000 104.000000 sto_xyz:2 0.000000 -3.250000 0.000000 -58.684311 sto_xyz:3 0.000000 0.000000 3.600000 -84.798035 sto_xyz:4 0.000000 0.000000 0.000000 1.000000 sform_xorient Right-to-Left sform_yorient Anterior-to-Posterior sform_zorient Inferior-to-Superior
I am not sure how to determine the c3d version, but I installed it today from c3d-nightly-MacOS-arm64.dmg https://sourceforge.net/p/c3d/git/ci/master/tree/doc/c3d.md.
— Reply to this email directly, view it on GitHub https://github.com/pyushkevich/itksnap/issues/107, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJPEW2YUYBEBVXYRPDEO43XZR5DZANCNFSM6AAAAAA4RPUEPE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
dcm2niix issue 718 appears to suggest that the itksnap tools have issues with NIfTI spatial transforms.
To replicate a minimal example, you consider the NIfTI image ax_asc_35sl_6.nii which appears correctly in FSLeyes, MRIcroGL and itksnap. The header specifies a LAS orientation:
However, operations with c3d creates a NIfTI header that suggests an LPS image, and the resulting image appears flipped in the Anterior-Posterior (row) direction in FSLeyes, MRIcroGL and itksnap:
I am not sure how to determine the c3d version, but I installed it today from c3d-nightly-MacOS-arm64.dmg.