I have used 3dROIstats to compute the number of non-zero voxels contained within a region-of-interest mask. I am wondering if there is a way to further compute the number of non-zero voxels within this mask that exceed a given size parameter (e.g., 1 mL contiguous). In other words, I would like to compute the number of non-zero voxels only if there are a total of approx. 296 adjoining voxels (at 1.5 isotropic resolution this would equate approx. 1mL contiguous).

Thanks in advance for your input.

Best,

Jesse

Hi, Jesse-

I think 3dClusterize is what you would want to use, maybe prefaced with 3dcalc for simpler usage.

With 3dcalc, make a mask dset of where voxels are nonzero. Then, use 3dClusterize to find the locations in that mask where clusters of voxels are bigger than a certain size; you have to specify how you want your neighborhoods formed (the “nearest neighbor” number, either 1, 2 or 3-- please check the file’s help description if that isn’t familiar), which brick number you want to threshold (the “ithr” is the volume index for thresholding, say the [0]th volume), how you want thresholding done (since your input dset is a mask in this case, then “-1sided RIGHT_TAIL 0.5” should be fine, since you are only interested in values >0.5), and your minimum clustersize in terms of volume (mL) or voxels (number):

```
# make a mask of the initial dset where values are nonzero
3dcalc \
-a DSET \
-expr 'notzero(a)' \
-prefix DSET_NONZERO
# Make a new dset of only clusters larger than a min size; I just picked NN=1 here at random, but choose whatever you feel is appropriate
3dClusterize \
-inset DSET_NONZERO \
-ithr 0 \
-NN 1 \
-1sided RIGHT_TAIL 0.5 \
-clust_nvox 296 \
-pref_map DSET_NONZERO_CLUSTMAP
```

and actually, 3dClusterize’s table will tell you how many voxels in total survived (= the sum of all voxels). Otherwise, you can use 3dROIstats for that (perhaps run on a binarized version of the DSET_NONZERO_CLUSTMAP).

–pt

pt this is great insight. Thanks so much for your help!