Hi again,
Sorry, I failed to mention that the program works with GE's Ifile images. The afni bricks do not contain the necessary information required to describe the oblique plane.
If you are using other image formats you might find help in George Tourtellot's code (see posting titled oblique follow-up).
If you can get the equation of your imaging plane, figuring out the rotation to align Anatomy with EPI is not too difficult.
Say you have an EPI plane that is oblique relative to the axial plane (ie rotated about the LR axis). The equation of the EPI plane is given by:
Pepi: aX + bY + cZ + D = 0 Uepi = ( a, b, c )
The equation of the axial plane is :
Pax: Z + D' = 0 Uax = ( 0 0 1 )
The angle between Pepi and Pax is given by:
alpha = acos ( dot (Uepi, Uax) / ( |Uepi| |Uax| ) )
alphadeg = 180 alpha / pi
The line of intersection between the two planes has the direction vector u given by:
u = cross (Uepi, Uax)
In this example, the normalized u is the LR unit vector (no miracle).
The afni command used to rotate the anatomical to match the oblique EPI would be:
3drotate -rotate alphadegR 0A 0I -prefix AnatAlignedToOblique Anat
(note the R A and I labels following each rotation angle)
Details:
The XYZ axis used here corresponds to the RL, AP, IS coordinate system, make sure you use a coherent coordinate system.
I calculate the equation of the EPI plane by using the coordinates of 3 points on the slice (top left corner, top right corner, bottom right corner).
-Ziad Saad