separating functionally independent clusters with 3dClusterize

I have a cluster of over 1000 voxels found using 3dClusterize, but it straddles various functionally independent regions. Is there any way I can split this cluster into a smaller number of clusters based on their region using AFNI or 3dClusterize in such a way that the number of clusters would remain the same as the number of clusters in the original large cluster? thnx


I guess if you know it straddles multiple regions, then you have a map of those regions, like an atlas? You can use that atlas parcellate the cluster, combining that information with 3dcalc, perhaps.

However, I don’t know what is meant by “split[ting] this cluster into a smaller number of clusters … in such a way that the number of clusters would remain the same as the number of clusters in the original large cluster”. The original large cluster has 1 region; splitting it will necessarily create more (>1) regions.


Sorry that should say the total number of voxels should stay the same. When I’ve parcellated with atlas maps, the total number of voxels across all resulting clusters changes from the total voxels in just the one large cluster


Thanks for clarifying. I think what was written in my earlier reply still holds. More explicitly, let:
DSET_CLUST = your clustered data
DSET_MAP = your map of regions; each region is a set of voxels with a given
then this:

3dcalc -a DSET_CLUST -b DSET_MAP -expr 'bool(a)*b' -prefix DSET_MAP_IN_CLUST

produces a new dataset DSET_MAP_IN_CLUST, which is the same map of ROIs as before limited to the region where clusters occurred.

If the region where DSET_MAP is nonzero is a superset of the region where DSET_CLUST is nonzero, then DSET_MAP_IN_CLUST will have the same number of nonzero voxels as DSET_CLUST.



Thanks! This is great, and I think we’re getting closer, but it’s still not quite what I’m after.

My resulting DSET_MAP_IN_CLUST now has the same number of voxels as the original cluster (great) and the large cluster is now split into the ROIs as I’d hoped (i.e. voxels are now different values across each of these regions, e.g. 1 in Region 1, 2 in region 2…). The only issue now is when I try to clusterize the data to get the coordinates of the COM and max voxel of each of these different clusters, it still only shows the >1000 cluster as one uniform cluster. Is there a way to get the individual coordinates and number of voxels for each cluster in the different regions?


Well, for the centers of mass of each ROI, you can use:

3dCM -all_rois DSET_MAP_IN_CLUST


To get the number of voxels per ROI,

3dROIstats -nomeanout -nzvoxels -mask DSET_MAP_IN_CLUST DSET_MAP_IN_CLUST

(where yes, the same dset appears twice)

You might also be interested in there “whereami -omask …” functionality, to find out how much overlap your ROIs have with standard atlas regions, if your data is in standard space.