Why does 3dROIMaker not produce GM ROI size equal to -only_conn_top N?


I used these code to generate constant sized GM ROIs near the $fROI peak:

        3dROIMaker -inset $fROI -thresh 0 -mask $wbmask                 \
            -wm_skel $wmfa -skel_thr 0.2 -skel_stop_strict              \
            -only_conn_top 500 -inflate 1                               \
            -neigh_upto_vert -dump_no_labtab -nifti                     \
            -prefix $ifROI

I understand the inflation of GMI ROI, but why the GM ROI size did not equal to 500 exactly? Sometimes 512, or 559, or 517, or 500.


Hi, 2086-

I ran the following in the /AFNI_demos/FATCAT_DEMO/ directory of the Bootcamp dataset:

3dROIMaker \
   -inset SOME_ICA_NETS_in_DWI+orig. \
   -thresh 3 -mask mask_DWI+orig. \
   -wm_skel DTI/DT_FA+orig. \
   -skel_thr 0.2 \
   -skel_stop_strict \
   -only_conn_top 60 \
   -inflate 1 \
   -neigh_upto_vert \
   -dump_no_labtab -nifti \
   -prefix q2086

In the GM output file, I had a distribution of clusters whose largest volume was 60 voxels; some were smaller, because the “-only_conn_top 60” option finds upto or including 60 of the highest-valued voxels in that region.
In the GMI output file, I had a distribution of clusters whose largest volume was 282; the max volume was >60, because 60 “top” voxels are found in the ROI first, and then those are inflated.

So, I’m not seeing the behavior you describe. Am I doing something different? How did you determine the ROI size? (Was it a way that used different NN definition?)


Hi Paul,

Thanks for your reply. I am sorry, it was my mistake! I used “3dBrickStat -positive -count” to show the ROI size, and it reported the sum size of several ROIs.

I used a A-B_#0_Coef brick of 3dDeconvolve result, restricted to same anatomical area between subjects first, as inset for 3dROIMaker to make constant sized GM ROI near the activation peak (-only_conn_top 500) which showed preferred response to A than B (-thresh 0), and the values in the inset should be contiguous, I did not use -refset, why in some exception it caused multi ROIs?


Hi 2086,

OK, glad the ROI sizes ended up be consistent with expectations (I had just used the Clusterize plug-in to check; 3dClusterize would behave similarly in reporting cluster sizes, too).

Re. your second question: I think the reason you get multiple ROIs might be because you are thresholding at 0, while your dset can (and likely does) have negative values. By thresholding at 0, you are likely making separate islands of ‘positive’ values, and then each of those gets treated as an ROI-- a peak is found there, and 3dROIMaker is finding the top N connected values in each of those islands.

I assume that you might want to set the threshold to a large negative number, and then you will only get the N top connected voxels in the whole dataset. (This assumes that your mask is also one single blob, and not parcellating your dset undesirably.)


Hi Paul,

WoW, I understand now, thanks!