Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-origin not using NIFTI coordinates #32

Open
cookpa opened this issue Oct 25, 2023 · 0 comments
Open

-origin not using NIFTI coordinates #32

cookpa opened this issue Oct 25, 2023 · 0 comments

Comments

@cookpa
Copy link
Contributor

cookpa commented Oct 25, 2023

c3d -help origin
-origin                         : Set image origin

Syntax: `-origin vector `

Set the origin of the image. The origin is the world coordinate (in NIfTI coordinate space) of the center of the voxel (0,0,0) in the image. The origin should be specified in millimeters. 

    c3d input.img -origin 100x100x100mm -o output.img

But the code calls SetOrigin

https://github.com/pyushkevich/c3d/blob/master/ConvertImageND.cxx#L1515-L1521

which is not overridden in itkOrientedRASImage.h .

The coordinate of voxel 0,0,0 should be the value of the qoffset field in the NIFTI header. But if I do

% c3d tpl-MNI152NLin2009cAsym_res-01_T1w.nii.gz -info-full | grep qoffset
    qoffset_x = -96
    qoffset_y = -132
    qoffset_z = -78
% c3d tpl-MNI152NLin2009cAsym_res-01_T1w.nii.gz -origin -96x-132x-78mm -o origin_changed.nii.gz

the origin is changed

% c3d tpl-MNI152NLin2009cAsym_res-01_T1w.nii.gz -origin -96x-132x-78mm -info-full  | grep qoffset
    qoffset_x = 96
    qoffset_y = 132
    qoffset_z = -78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant