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.
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.