Hi AFNI gurus:
I am wondering if there is a convenient AFNI function/command for determining whether a brain is not entirely contained in the box of FOV. The attaching picture shows such a case where some of the occipital lobe is missing.
There are probably lots of ways to test for this. I wrote this little script to do this. It tests if reducing the box of the dataset by one slice in all directions except in the inferior direction and then expanding back to the original has any differences. It doesn’t check for anything “brain” specific. This might not be as useful for the typically tighter EPI coverage, for instance. Alternatively, one could check for brain atlas or mask coverage by alignment to a template. Inverting the transformation to the native space and checking against a one slice larger could reveal the brain mask not completely fitting in the native volume. That has the larger requirement of alignment working, and for very partial volumes that would be more problematic.
#!/bin/tcsh
find a general mask - clustering but not brain specific
3dcalc -a anat_am.nii.gz -b anat_zp_origsize.nii.gz -expr ‘not(equals(a,b))’ -prefix edgetest.nii.gz -overwrite #output includes this line - which could be used too
*+ WARNING: output sub-brick 0 is all zeros!
set fovtest = 3dBrickStat -count -non-zero edgetest.nii.gz
if ($fovtest != “0”) then
echo “brain mask goes to edge”
else
echo “brain mask is not on edge”
endif
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.