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  

|
May 16, 2021 01:24PM
Hi, Mrinmayi-

[*This message edited to correct an earlier typo I made---thanks to D Glen for noticing: the integer index for time that can be used in 3dcalc below is *l*, as in the first letter of Lima, and not n, as I had mistaken put.]

With 3dcalc, you can use {i, j, k, l} as matrix indices in logic expressions, which represent the first, second and third spatial dimensions and the time dimension, respectively; to do this with coordinates, you can similarly use {x, y, z, t}. These letters will be interpreted in this way as long as you haven't used that letter to load in a datset.

Thus, with:
3dcalc -a DSET1 -expr "a*step(i-10)*step(j-15)" ...
... you should get a new dset with the same shape as DSET1 and with same values as DSET1 where the index is greater than 10 AND the [j] index is greater than 15, and 0 everywhere else.

However, if you loaded a dset like this for some reason:
3dcalc -a DSET2 -i DSET2 -expr "a*step(i-10)*step(j-15)" ...
... then "i' would be treated to represent the DSET2 dset, not the coordinate.

In general, I find using coordinates is easier: because the dset orientation could be RAI, AIR, LPI, ASL, etc., using {i,j,k} is more confusing, harder to figure out and more potentially unstable than {x,y,z} coordinates, which will be independent of dset orientation (NB: I think these coords are always interpreted as RAI). You can open your image in the AFNI GUI, click where you want and get the RAI coords from the upper left part of the GUI, and use your 3dcalc logic expression with that, something like:
3dcalc -a DSET1"<ROI_NAME>" -expr "step(27-y)*not(step(20-y))" ...
... depending on your y-axis coords.

You can verify your ROIs in the GUI. (You could also use these logic expressions to make a single 3D volume that contains your 3 ROI chunks, each just defined as a different integer value, if you want.)

--pt



Edited 1 time(s). Last edit at 05/17/2021 08:25AM by ptaylor.
Subject Author Posted

Subdivide anatomical ROI based on slice numbers

mrinmayik May 16, 2021 12:07AM

Re: Subdivide anatomical ROI based on slice numbers

ptaylor May 16, 2021 01:24PM

Re: Subdivide anatomical ROI based on slice numbers

Daniel Glen May 16, 2021 09:57PM