AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
Fred Tam
May 07, 2005 12:23AM
[For those who were wondering, "rotobrick" is a script I wrote a couple of years back that does the following calculations in the simpler and more common case where the anatomical is already in a normal plane. Ricky, refer to the documentation for rotobrick as you read this. Hopefully this makes sense to others as well.]

First, figure out the rotation of the anatomical from the normal (axial) plane. Do not rely on the angle displayed on the scanner--it's not precise enough. In your case, it's |arctan((22.2-(-26.9))/(79.7-(-85.4)))| = 16.562241853 deg.

Now rotate the start and end points of the anatomical back to the axial plane. In your case, you would run this (the origin is the centre of the volume):

echo -6.5 -26.9 -85.4 | 3drotate -points -origin -6.5 -2.35 -2.85 -rotate 16.562241853R 0 0
echo -6.5 22.2 79.7 | 3drotate -points -origin -6.5 -2.35 -2.85 -rotate 16.562241853R 0 0

This is the output:

-6.5 -2.35 -88.9732
-6.5 -2.35 83.2732

(where negative values are R, A, or I, and positive values are L, P, or S; make sure the coordinates only differ in the slice direction) You can now pretend that this is an axial scan and build a brick file, something like this:

to3d -spgr -prefix 3dvol -xFOV 116.5R-103.5L -yFOV 112.35A-107.65P -zSLAB 88.9732I-83.2732S 'I*'

Just keep in mind that the contents of the brick file are actually rotated 16.562241853 deg from axial because you'll need to account for that later.

[Step 1 in the rotobrick documentation] Figure out the rotation of the functional volume from the axial plane. In your case, by the same formula above, it's 17.280597764 deg.

[Step 2] Rotate the anatomical brick to match the oblique angle of the functional. Here's the twist: Since it's already rotated part-way, you just need to rotate it 17.280597764-16.562241853 = 0.718355911 deg more.

3drotate -prefix 3dvol-rot -rotate 0.718355911R 0 0 3dvol+orig

[Step 3] Rotate the functional's coordinates to align with the anatomical:

echo -6.5 21.8 54.1 | 3drotate -points -origin -6.5 -2.35 -2.85 -rotate 17.280597764R 0 0
echo -6.5 -18.3 -74.8 | 3drotate -points -origin -6.5 -2.35 -2.85 -rotate 17.280597764R 0 0

This yields

-6.5 3.79282 -76.2903
-6.5 3.79282 58.7032

Note again that the coordinates differ only in the slice direction--if they don't, you rotated in the wrong direction.

[Step 4] Now you can pretend that the functional scan is axial and build a brick file, something like this:

to3d -epan -prefix run1 -xFOV 106.5R-93.5L -yFOV 96.20718A-103.79282P -zSLAB 58.7032S-76.2903I -time:tz 177 28 2000 seq+z 3D:0:0:64:64:4956:FILE

[Step 5] Important! View the files in afni to check their alignment.

Hopefully I got it right. There's plenty of room error in stuff as tedious as this. [Which is why we have rotobrick for the more common case.]

Fred

Subject Author Posted

Oblique anat and func scans

Ricky Tong May 05, 2005 10:33AM

Re: Oblique anat and func scans

Fred Tam May 07, 2005 12:23AM

Re: Oblique anat and func scans

Ricky Tong May 10, 2005 09:54AM