Hi-
Thanks for specifying that.
Some comments on âFor 1.â:
I would recommend using 3dClusterize rather than 3dmergeâthe latter is very old, and I find the syntax quite opaque. You can also input both a âdataâ volume (e.g., a beta weight or coefficient) as well as an accompanying stat (e.g., t-stat), for making maps of both simultaneously. Here is an example of the former from the help file:
3dClusterize \
-inset stats.FT+tlrc. \
-ithr 2 \
-idat 1 \
-mask mask_group+tlrc. \
-NN 1 \
-bisided -3.313 3.313 \
-clust_nvox 157 \
-pref_map ClusterMap \
-pref_dat ClusterEffEst
NB: If the stats volume was created by AFNI, then it would have header information to convert from a specified p-value to an equivalent t-stat (see 3dClusterize help examples for more info on that). Note when converting between p- and statistics-values, one needs to have an appropriate sided hypothesis specifiedâin AFNI, our default is 2sided testing (because most researchers are looking for differences between things), while in other software the default tends to be 1sided (because of the kind of statistic output). So, this is something to be aware of in mixing software outputs and commands. Not correcting for having two, 1sided tests will artificially double FPR values; see more info here: A tail of two sides: Artificially doubled false positive rates in neuroimaging due to the sidedness choice with tâtests.
If you want your positive and negative supra-threshold regions to not count as a single cluster (which I guess you wouldnât), then using the â-bisidedâ option, as above, is good. I am not sure what the equivalent would be in other software.
Also note, when you run 3dClusterize, you will get a table per cluster that tells you how many voxels there are per cluster (3dROIstats can also do the same).
Another difference between software is what it means to be a neighbor of a voxel. Do they have to share a face, or a face or an edge, or a face or an edge or a node? AFNI, FSL and SPM have typically used different definitions as a defaultâin AFNI you can specify what you want, though, using âNNâ (nearest neighbor value). See here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/FATCAT/MakingROIs.html#getting-to-know-your-neighbors
I am not sure what method you used to calculate your clustersize threshold, but this might have been calculated using one âneighborhoodâ definition, and different software might have a different one.
Note that there has also been a lot of discussion in the field about what appropriate p-values should be used for voxelwise thresholding. Several papers (and journals, too) have pushed for using p=0.001 and not p=0.01âthis is of course entirely up to you, but note that that might be a point of discussion with a reviewer.
On a scripting note: you are using â>â to redirect output in your for-loop. I think this will overwrite whatever was there previously, and it doesnât look like $outfile changes value within that loop. So you might want to adjust that by having the $outfile change each time, or by using â>>â to redirect with appending.
Some comments on âFor 2.â:
Converting BRIK/HEAD to NIFTI is fine, sure. One can use 3dAFNItoNIFTI or 3dcopy, etc. AFNI programs do read/write NIFTI files directly, in most cases, if specified (afni_proc.py uses all BRIK/HEAD, but copying output is pretty straightforward, as you have done).
The for-loop here is missing a â-prefix âŚâ for the command, I think.
In the bilateral mask, if the hemispheric masks are each binary, then the L and R hemispheres have lost their identity in this sum; if you wanted to be able to tell them apart in the output, you could use:
3dcalc \
-a 'lh_MTL_rs.nii' \
-b rh_MTL_rs.nii \
-expr 'a+2*b' \
-prefix 'MTL_rs.nii'
for example. Of course, if they arenât binary masks, this may already be accounted for. (NB: this assumes that the âaâ and âbâ datasets donât overlapâyou can check for that visually, if it might be a concern, or by seeing what the max value in the dset is after.)
In generalâ
You had initially asked about potential left-right flipping in each case. I donât see how that could happen with the above commands. You can also verify by looking at the clusters and hemispheric maps in the GUI. You can even use the âClusterizeâ button in the GUI, to see the clusterizing at work.
Sorry for the long and possibly extraneous reply!
âpt