Per 3dinfo, both the atlas file and the ROI file are of the same geometry and orientation. Which is expected, as alignment happened on the way here, but I checked.
Both report:
Geometry String: "MATRIX(-0.5,0,0,31.75,0,-0.5,0,27.625,0,0,0.5,-7.875):128,156,100"
and
[-orient LPI]
But it really looks to me as if whereami was slightly off… I tried to replicate what (I think) whereami is doing using individual commands, and it produces the same result as my Matlab script, and different from whereami. Which might actually mean that I am missing something about how whereami works. Could you please have a look?
I am focusing on one ROI and two areas of ARM level 3 (=subbrick 2)
Here is what my Matlab code says:
LesionAtlas(cd(), 3, 1)
ROI 1, region 503, overlap 1923, per ROI (size: 5519) = 0.348, per region (size: 3319) = 0.579
ROI 1, region 554, overlap 2496, per ROI (size: 5519) = 0.452, per region (size: 7020) = 0.356
[...]
So 34.8% of ROI 1 is in atlas area 503, and 45.2% of ROI 1 is in area 554. cd() is where to look for files (=pwd), 3 is the atlas level, 1 means use individual ROI files (basically = -bmask)
whereami says:
whereami -atlas 'ARM Level 3' -bmask Clust_mask_0001+tlrc
++ Input coordinates orientation set by default rules to RAI
++ In binary mode ...
++ 5519 voxels in ROI
++ 43959 voxels in atlas-resampled mask
Intersection of ROI (all non-zero values) with atlas ARM Level 3 (sb0):
41.8 % overlap with CR_dlPFC
[CR_dorsolateral_prefrontal_cortex], code 554
32.3 % overlap with CR_ACC
[CR_anterior_cingulate_cortex], code 503
[...]
-----
91.5 % of cluster accounted for.
I tried to replicate by:
- using 3dcalc to extract areas 503 and 554 from the atlas’ subbrick 2
3dcalc -a ARM_in_NMT_v2.1_sym_05mm.nii.gz[2] -exp 'equals(a, 554)' -prefix area554 -overwrite
3dcalc -a ARM_in_NMT_v2.1_sym_05mm.nii.gz[2] -exp 'equals(a, 503)' -prefix area503 -overwrite
- calculating intersection of ROI 1 with each of the extracted areas
3dcalc -a Clust_mask_0001+tlrc -b area554+tlrc -exp 'and(a,b)' -overwrite -prefix intersect554
3dcalc -a Clust_mask_0001+tlrc -b area503+tlrc -exp 'and(a,b)' -overwrite -prefix intersect503
- counting the number of voxels in each intersection and in the ROI
3dmaskdump -mask intersect554+tlrc -o /dev/null intersect554+tlrc
++ 3dmaskdump: AFNI version=AFNI_21.3.11 (Dec 9 2021) [64-bit]
++ 2496 voxels in the mask
3dmaskdump -mask intersect503+tlrc -o /dev/null intersect503+tlrc
++ 3dmaskdump: AFNI version=AFNI_21.3.11 (Dec 9 2021) [64-bit]
++ 1923 voxels in the mask
3dmaskdump -mask Clust_mask_0001+tlrc -o /dev/null Clust_mask_0001+tlrc
++ 3dmaskdump: AFNI version=AFNI_21.3.11 (Dec 9 2021) [64-bit]
++ 5519 voxels in the mask
- dividing them accordingly
awk "BEGIN {print 2496/5519}"
0.452256
awk "BEGIN {print 1923/5519}"
0.348433
So that’s what Matlab says not what whereami says. Am I missing a step, both in Matlab and in my replication, that whereami does?
One hint is that whereami reports “43959 voxels in atlas-resampled mask”. My ROIs come from thresholding of data that had been already masked using GM masks (subcortical and cortical) that come with the ARM and NMT2.1 (NMT_v2.1_sym_05mm_segmentation.nii.gz) but maybe there is some discrepancy there? Like the extent of the segmentation masks differs from the extent of the atlas?