help
help > RE: Using acpcdetect to get pitch, roll, and yaw
Nov 2, 2018 05:11 PM | Pravesh Parekh - National Institute of Mental Health and Neurosciences
RE: Using acpcdetect to get pitch, roll, and yaw
Hello,
I am using SPM toolbox in MATLAB to perform the following:
% Read the header of original image
vol = spm_vol(filename);
% Read the matrix
data = spm_read_vols(vol);
% voxel location where the origin of the image should be set: corresponding to the antetrior commissure detected by acpcdetect
AC_voxlocation = [96.8;141.8;152.1];
% Convert AC voxel location to mm by multiplying with the rotation part of the matrix (vol.mat has the sform matrix)
AC_mm = vol.mat(1:3,1:3)*AC_voxlocation;
% Translation to be applied (i.e. need to shift the origin by these amount in mm right, forward, and up direction to get the 0,0,0 to correspond to AC)
translation = -AC_mm-vol.mat(1:3,4);
The origin is the (0,0,0) location in mm.
Regards
Pravesh
Originally posted by Babak Ardekani:
I am using SPM toolbox in MATLAB to perform the following:
% Read the header of original image
vol = spm_vol(filename);
% Read the matrix
data = spm_read_vols(vol);
% voxel location where the origin of the image should be set: corresponding to the antetrior commissure detected by acpcdetect
AC_voxlocation = [96.8;141.8;152.1];
% Convert AC voxel location to mm by multiplying with the rotation part of the matrix (vol.mat has the sform matrix)
AC_mm = vol.mat(1:3,1:3)*AC_voxlocation;
% Translation to be applied (i.e. need to shift the origin by these amount in mm right, forward, and up direction to get the 0,0,0 to correspond to AC)
translation = -AC_mm-vol.mat(1:3,4);
The origin is the (0,0,0) location in mm.
Regards
Pravesh
Originally posted by Babak Ardekani:
Originally posted by Pravesh Parekh:
Hi,
Please let me know the command line you are using.
When you say: "To figure out the translation that is needed to be applied to shift the origin",
how exactly are you defining the "origin"
-BA
To figure out the translation that is needed to
be applied to shift the origin to the AC:
Hi,
Please let me know the command line you are using.
When you say: "To figure out the translation that is needed to be applied to shift the origin",
how exactly are you defining the "origin"
-BA
Threaded View
Title | Author | Date |
---|---|---|
Pravesh Parekh | Oct 31, 2018 | |
Pravesh Parekh | Nov 2, 2018 | |
Babak Ardekani | Nov 2, 2018 | |
Babak Ardekani | Nov 2, 2018 | |
Pravesh Parekh | Nov 2, 2018 | |
Babak Ardekani | Nov 2, 2018 | |
Pravesh Parekh | Nov 3, 2018 | |
Babak Ardekani | Nov 6, 2018 | |
Babak Ardekani | Oct 31, 2018 | |
Pravesh Parekh | Nov 1, 2018 | |
Babak Ardekani | Nov 2, 2018 | |
Pravesh Parekh | Nov 2, 2018 | |