Debian Codegraph @

fsliolib/remove_ext

raw
1 #!/bin/sh
2
3 # remove_ext - remove extension from image filename
4 #
5 # Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
6 #
7 #
8 # The remove_ext file was originally part of FSL - FMRIB's Software Library
9 # http://www.fmrib.ox.ac.uk/fsl
10 # remove_ext has now been placed in the public domain.
11 #
12 # Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
13 # Imaging of the Brain), Department of Clinical Neurology, Oxford
14 # University, Oxford, UK
15 #
16 #
17
18
19 if [ $# -lt 1 ] ; then
20 exit 0
21 fi
22
23 lst="";
24 for fn in $@ ; do
25 # for the ones at the end of the line
26 f=`echo "$fn" | sed 's/\.hdr\.gz$//' | sed 's/\.img\.gz$//' | sed 's/\.hdr$//' | sed 's/\.img$//' | sed 's/\.nii.gz$//' | sed 's/\.nii$//' | sed 's/\.mnc.gz$//' | sed 's/\.mnc$//' | sed 's/\.$//'`;
27 # for the ones in the middle of the line
28 f=`echo "$f" | sed 's/\.hdr\.gz[ ]/ /g' | sed 's/\.img\.gz[ ]/ /g' | sed 's/\.hdr[ ]/ /g' | sed 's/\.img[ ]/ /g' | sed 's/\.nii\.gz[ ]/ /g' | sed 's/\.nii[ ]/ /g' | sed 's/\.mnc\.gz[ ]/ /g' | sed 's/\.mnc[ ]/ /g' |sed 's/\.[ ]/ /g'`;
29 lst="$lst $f";
30 done
31 echo $lst;