Open ckovach opened 1 week ago
Can you please test the latest commit on the development branch and close if this resolves your issue. For Linux and MacOS you can build the branch with these commands:
git clone --branch development https://github.com/rordenlab/dcm2niix.git
cd dcm2niix/console
make
./dcm2niix ....
Describe the bug
Crossposting from the NITRC site: We encountered a confusing problem with image coregistration which we ultimately traced to a discrepancy of the qform and sform offsets in nifti files generated with the 3D crop option (-x) of dcm2niix. Evidently the srow_z value in the header is updated with cropping, but the qoffset_z is not. Some versions of ITK default to the qform transformation when xform_code > 0 for both, and we ended up with images aligned in voxel space but not in scanner space. I suggest either updating qform to match sform or setting the qform_code value to NIFTI_XFORM_UNKNOWN (0) to indicate that the qform transform no longer matches scanner space.
To reproduce
Steps to reproduce the behavior:
Expected behavior
Either qform and and sform transformations match or qform_code is changed from NIFTI_XFORM_SCANNER_ANAT (1) to NIFTI_XFORM_UNKNOWN (0) to indicate that the qform transform does not match scanner space.
Version
Chris Rorden's dcm2niiX version v1.0.20240202 Clang16.0.6 ARM (64-bit MacOS) v1.0.20240202
Workaround
Avoid running dcm2niix with the -x option.