Automatically calculating mask based on data

Hi All
I couldn’t find this issue on the message board, so I thought I’d make a new post. Being an AFNI noob, I was wondering if it is possible to calculate a mask of best fit over a given dataset automatically. I was hoping to automate the process. So instead of opening up the data in AFNI, finding a threshold and then using that threshold to calculate the mask file, I was hoping to just run a few lines of code and have it auto-calculated instead.

My original setup to calculate the mask is as follows

3dcalc -a -expr ‘ispositive(a-*)’ -prefix msk [ * = a determined threshold value taken from looking at the file in AFNI and determining the best threshold]

3dDWItoDT -mask msk+orig …

I have tried replacing those two previous lines (3dcalc, 3dDWItoDT) with
3dDWItoDT -automask …
But the result is less than ideal, and forms a cylinder shape around the data instead of something more fitted, which is not what I am after.

Any suggestions?

Give 3dAutomask a try, e.g.

3dAutomask -prefix mask DSET+orig

To consider control options, please review the -help
output, as in “3dAutomask -help”, or see that output
on the web: 3dAutomask -help.

  • rick

Hi Rick
Thank you very much for that suggestion. I tested it out and it seems to fit much better than the -automask. The data set I am using though is heart related. ~ do you know if that would cause any issues with the 3dautomask function? In the output part of 3dautomask it mentions ‘brain only’ mask dataset.
Thank you for your time