~ubuntu-branches/ubuntu/lucid/fslview/lucid

« back to all changes in this revision

Viewing changes to fsl/fslio/imglob

  • Committer: Bazaar Package Importer
  • Author(s): Michael Hanke
  • Date: 2009-02-06 12:13:24 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090206121324-pib80tw725kqxe45
Tags: 3.0.2+4.1.2-2
* Compile internal libraries as shared libs and install them under
  /usr/lib/fsl/lib, so FSL itself can use them as well.
* Expose FSL's internal libs via RPATH to the included binaries.
  That should be appropriate, since they are built from the same package
  and are not intended to be used by other packages than FSL (hence, no -dev
  package).
* Added patch to prevent fslview from crashing with images that have dim4=0.
  Thanks to Wim Otte.
* Build package with -Wl,--no-undefined.
* Added 'XS-DM-Upload-Allowed: yes' to debian/control.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
#   imglob - expand list of image filenames
 
4
#
 
5
#   Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
 
6
#
 
7
#   Copyright (C) 1999-2004 University of Oxford
 
8
#
 
9
#   SHCOPYRIGHT
 
10
 
 
11
if [ $# -lt 1 ] ; then
 
12
  echo "Usage: $0 [-extension/extensions] <list of names>"
 
13
  echo "       -extension for one image with full extension"
 
14
  echo "       -extensions for image list with full extensions"
 
15
  exit 1;
 
16
fi
 
17
 
 
18
extension=0
 
19
onename=1;
 
20
if [ X"$1"X = "X-extensionsX" ] ; then
 
21
  onename=0;
 
22
  extension=1
 
23
  shift;
 
24
fi
 
25
 
 
26
if [ X"$1"X = "X-extensionX" ] ; then
 
27
  extension=1;
 
28
  shift;
 
29
fi
 
30
 
 
31
# process each argument, removing any possible extension and
 
32
#  then expanding for valid extensions
 
33
 
 
34
lst="";
 
35
for aa in $@ ; do
 
36
  # repeat remove_ext a few times to expand out all wildmasking
 
37
  a=`${FSLDIR}/bin/remove_ext ${aa}`;
 
38
  # at this point variable 'a' may have been expanded into a list
 
39
  for b in $a ; do
 
40
    if [ $onename = 1 ] ; then
 
41
      fn=`echo ${b}.hdr ${b}.hdr.gz ${b}.nii ${b}.nii.gz ${b}.mnc ${b}.mnc.gz`;
 
42
    else
 
43
      fn=`echo ${b}.hdr ${b}.hdr.gz ${b}.nii ${b}.nii.gz ${b}.mnc ${b}.mnc.gz ${b}.img ${b}.img.gz`;
 
44
    fi
 
45
    lst="$lst $fn";
 
46
  done
 
47
done
 
48
 
 
49
# remove any instances of unmatched wildmasks (still with * in them)
 
50
lst2="";
 
51
for fn in $lst ; do
 
52
  if [ -f $fn ] ; then
 
53
     lst2="$lst2 $fn";
 
54
  fi
 
55
done
 
56
 
 
57
# make list unique
 
58
lst=`echo $lst2 | tr ' ' '\n' | sort -u`;
 
59
if [ $extension = 0 ] ; then 
 
60
  echo `${FSLDIR}/bin/remove_ext $lst`;
 
61
else 
 
62
  echo $lst;
 
63
fi