Hi, Carolin-
With standard FMRI processing with afni_proc.py, one criterion to censor a particular time point is to:
+ calculate outliers at each voxel, across all time, within the brain mask
+ then count the fraction of outliers within the brain mask (and compare that fractional value to a user-chosen threshold, to decide about censoring there).
That sounds like what you want to do, per ROI? You could use either outlier counts per ROI, or outlier fraction per ROI, per time point?
The following tcsh script loops over two ROIs in an "ROI dset", and calculates the outlier fraction within the "EPI dset" at each point in time, and it dumps that result to a 1D/time-series file; it also simply plots each:
#!/bin/tcsh
set dset_roi = # user puts a dset name here
set dset_epi = # user puts a dset name here
# which ROIs to select (by ROI value)
set all_roival = ( 1 2 )
# loop over each ROI value
foreach roival ( ${all_roival} )
# compute outlier fraction for each volume,
# selecting an ROI value from the $dset_roi to be a mask
3dToutcount \
-mask ${dset_roi}"<${roival}>" \
-fraction -polort 1 -legendre \
${dset_epi} > out_frac_${roival}.txt
# plot
1dplot out_frac_${roival}.txt &
end
You can remove "-fraction" within 3dToutcount, if you want a number of outliers per time point. I "stole" the command from an afni_proc.py-generated script, using the polort level and legendre polynomial aspects.
--pt
Edited 1 time(s). Last edit at 12/23/2022 08:51AM by ptaylor.