AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
September 14, 2021 02:02PM
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
3dAutomask -overwrite -apply_prefix anat_am.nii.gz anat+orig.
# put into one slice smaller volume in all directions except inferior
# (where anatomical datasets typically include the neck)
3dZeropad -S -1 -A -1 -P -1 -R -1 -L -1 -overwrite -prefix anat_zpm1.nii.gz anat_am.nii.gz
# bump back up to original size
3dZeropad -master anat_am.nii.gz -prefix anat_zp_origsize.nii.gz -overwrite anat_zpm1.nii.gz
# calculate voxels that are different
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
Subject Author Posted

An AFNI function for "out of FOV" detection? Attachments

Zhihao_Li September 13, 2021 07:56PM

Re: An AFNI function for "out of FOV" detection?

Daniel Glen September 14, 2021 02:02PM