Debian Codegraph @

fsliolib/imtest

raw
1 #!/bin/sh
2
3 # imtest - test to see if a valid image file exists with this name (root)
4 #
5 # Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
6 #
7 #
8 # The fslio.c file was originally part of FSL - FMRIB's Software Library
9 # http://www.fmrib.ox.ac.uk/fsl
10 # imtest 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 # return 0 if no image exists or 1 if the image exists
19
20 if [ $# -lt 1 ] ; then
21 echo "0";
22 exit;
23 fi
24
25 filename=`${FSLDIR}/bin/remove_ext $1`;
26
27 if [ -r ${filename}.nii -o -r ${filename}.nii.gz ] ; then
28 echo "1";
29 exit;
30 fi
31
32 if [ -r ${filename}.mnc -o -r ${filename}.mnc.gz ] ; then
33 echo "1";
34 exit;
35 fi
36
37 if [ ! -r ${filename}.hdr -a ! -r ${filename}.hdr.gz ] ; then
38 # return 0 here as no header exists and no single image means no image!
39 echo "0";
40 exit;
41 fi
42
43 if [ ! -r ${filename}.img -a ! -r ${filename}.img.gz ] ; then
44 # return 0 here as no img file exists and no single image means no image!
45 echo "0";
46 exit;
47 fi
48
49 # only gets to here if there was a hdr and an img file
50
51 echo "1";
52 exit;