#! /bin/csh -f # # fast_getext # # Get's the extension of the stem by trying the following # extensions nii nii.gz mgh mgz bhdr minc # # Original Author: Doug Greve # CVS Revision Info: # $Author: nicks $ # $Date: 2007/01/09 22:41:17 $ # $Revision: 1.3 $ # # Copyright (C) 2002-2007, # The General Hospital Corporation (Boston, MA). # All rights reserved. # # Distribution, usage and copying of this software is covered under the # terms found in the License Agreement file named 'COPYING' found in the # FreeSurfer source code root directory, and duplicated here: # https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferOpenSourceLicense # # General inquiries: freesurfer@nmr.mgh.harvard.edu # Bug reports: analysis-bugs@nmr.mgh.harvard.edu # if($#argv != 1) then echo "fast_getext stem" echo '$Id: fast_getext,v 1.3 2007/01/09 22:41:17 nicks Exp $' exit 1; endif set stem = $argv[1]; foreach ext (nii nii.gz mgh mgz bhdr minc) set fname = $stem.$ext # echo Tyring $fname if(-e $fname) then echo $ext exit 0; endif end echo "ERROR: cannot determine format for stem $stem" exit 1; exit 1; ##########################################