c_nifti 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +37 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/COPYING +621 -0
- data/COPYING.lesser +166 -0
- data/Gemfile +4 -0
- data/README.md +117 -0
- data/Rakefile +6 -0
- data/c_nifti.gemspec +31 -0
- data/ext/nifticlib/extconf.rb +30 -0
- data/ext/nifticlib/include/nifti_image.h +2 -0
- data/ext/nifticlib/include/nifti_image_converters.h +3 -0
- data/ext/nifticlib/include/nifti_image_dimensions.h +1 -0
- data/ext/nifticlib/include/nifti_image_intents.h +1 -0
- data/ext/nifticlib/include/nifti_image_metadata.h +1 -0
- data/ext/nifticlib/include/nifti_image_quaternions.h +1 -0
- data/ext/nifticlib/include/nifti_image_spacings.h +1 -0
- data/ext/nifticlib/include/nifti_image_timings.h +1 -0
- data/ext/nifticlib/include/nifti_image_transforms.h +1 -0
- data/ext/nifticlib/nifti_image.c +169 -0
- data/ext/nifticlib/nifti_image_converters.c +65 -0
- data/ext/nifticlib/nifti_image_dimensions.c +113 -0
- data/ext/nifticlib/nifti_image_intents.c +45 -0
- data/ext/nifticlib/nifti_image_metadata.c +133 -0
- data/ext/nifticlib/nifti_image_quaternions.c +59 -0
- data/ext/nifticlib/nifti_image_spacings.c +87 -0
- data/ext/nifticlib/nifti_image_timings.c +66 -0
- data/ext/nifticlib/nifti_image_transforms.c +38 -0
- data/ext/nifticlib/nifticlib-2.0.0/CMakeLists.txt +140 -0
- data/ext/nifticlib/nifticlib-2.0.0/CTestConfig.cmake +13 -0
- data/ext/nifticlib/nifticlib-2.0.0/LICENSE +9 -0
- data/ext/nifticlib/nifticlib-2.0.0/Makefile +265 -0
- data/ext/nifticlib/nifticlib-2.0.0/Makefile.cross_mingw32 +94 -0
- data/ext/nifticlib/nifticlib-2.0.0/README +79 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/CMakeLists.txt +7 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz +0 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/Makefile +21 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/README_regress +50 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/@show.diffs +33 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/@test +80 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/CMakeLists.txt +47 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/bricks_test.sh +32 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/comment_test.sh +65 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/dci_test.sh +46 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/dsets_test.sh +61 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/dts_test.sh +75 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/fetch_data_test.sh +45 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/mod_header_test.sh +60 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/newfiles_test.sh +36 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c01.versions +10 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c02.nt.help +5 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c03.hist +5 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c04.disp.anat0.info +7 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c05.mod.hdr +9 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c06.add.ext +22 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c07.cbl.4bricks +8 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c08.dts.19.36.11 +4 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c09.dts4.compare +9 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c10.dci.ts4 +15 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c10a.dci.run.210 +16 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c11.add.comment +8 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c12.check.comments +7 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c13.check.hdrs +5 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c14.make.dsets +21 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c15.new.files +21 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c16.rand.swap +35 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c17.file.case +34 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/niftilib/CMakeLists.txt +15 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/niftilib/nifti_test.c +690 -0
- data/ext/nifticlib/nifticlib-2.0.0/Testing/niftilib/nifti_test2.c +32 -0
- data/ext/nifticlib/nifticlib-2.0.0/Updates.txt +110 -0
- data/ext/nifticlib/nifticlib-2.0.0/bin/.gitkeep +0 -0
- data/ext/nifticlib/nifticlib-2.0.0/docs/Doxy_nifti.txt +123 -0
- data/ext/nifticlib/nifticlib-2.0.0/docs/Doxyfile.ORIG +746 -0
- data/ext/nifticlib/nifticlib-2.0.0/examples/CMakeLists.txt +15 -0
- data/ext/nifticlib/nifticlib-2.0.0/examples/Makefile +48 -0
- data/ext/nifticlib/nifticlib-2.0.0/examples/clib_01_read_write.c +94 -0
- data/ext/nifticlib/nifticlib-2.0.0/examples/fsl_api_driver.c +142 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/CMakeLists.txt +32 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/Makefile +29 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/fslio.c +2426 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/fslio.tcl +83 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imcp +65 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imglob +59 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imln +37 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/immv +64 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imrm +29 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imtest +53 -0
- data/ext/nifticlib/nifticlib-2.0.0/fsliolib/remove_ext +33 -0
- data/ext/nifticlib/nifticlib-2.0.0/include/.gitkeep +0 -0
- data/ext/nifticlib/nifticlib-2.0.0/nifticdf/CMakeLists.txt +28 -0
- data/ext/nifticlib/nifticlib-2.0.0/nifticdf/Makefile +28 -0
- data/ext/nifticlib/nifticlib-2.0.0/nifticdf/nifticdf.c +11107 -0
- data/ext/nifticlib/nifticlib-2.0.0/niftilib/CMakeLists.txt +33 -0
- data/ext/nifticlib/nifticlib-2.0.0/niftilib/Makefile +31 -0
- data/ext/nifticlib/nifticlib-2.0.0/niftilib/nifti1_io.c +7509 -0
- data/ext/nifticlib/nifticlib-2.0.0/packaging/DevPackage.template +18 -0
- data/ext/nifticlib/nifticlib-2.0.0/packaging/nifticlib.spec +62 -0
- data/ext/nifticlib/nifticlib-2.0.0/real_easy/nifti1_read_write.c +361 -0
- data/ext/nifticlib/nifticlib-2.0.0/utils/CMakeLists.txt +73 -0
- data/ext/nifticlib/nifticlib-2.0.0/utils/Makefile +55 -0
- data/ext/nifticlib/nifticlib-2.0.0/utils/nifti1_test.c +95 -0
- data/ext/nifticlib/nifticlib-2.0.0/utils/nifti_stats.c +95 -0
- data/ext/nifticlib/nifticlib-2.0.0/utils/nifti_tool.c +4193 -0
- data/ext/nifticlib/nifticlib-2.0.0/utils/nifti_tool.h +163 -0
- data/ext/nifticlib/nifticlib-2.0.0/znzlib/CMakeLists.txt +31 -0
- data/ext/nifticlib/nifticlib-2.0.0/znzlib/Makefile +33 -0
- data/ext/nifticlib/nifticlib-2.0.0/znzlib/znzlib.c +322 -0
- data/ext/nifticlib/nifticlib.c +107 -0
- data/ext/nifticlib/patches/nifticlib_fpic.patch +13 -0
- data/features/read_modify_write.feature +11 -0
- data/features/step_definitions/nifti_image_steps.rb +16 -0
- data/features/support/env.rb +14 -0
- data/features/support/fixtures/sample.nii.gz +0 -0
- data/lib/c_nifti.rb +9 -0
- data/lib/c_nifti/data.rb +70 -0
- data/lib/c_nifti/header.rb +16 -0
- data/lib/c_nifti/header_element.rb +13 -0
- data/lib/c_nifti/header_element/datatype.rb +49 -0
- data/lib/c_nifti/header_element/datatype/base.rb +9 -0
- data/lib/c_nifti/header_element/datatype/binary.rb +11 -0
- data/lib/c_nifti/header_element/datatype/double.rb +11 -0
- data/lib/c_nifti/header_element/datatype/float.rb +11 -0
- data/lib/c_nifti/header_element/datatype/long_double.rb +11 -0
- data/lib/c_nifti/header_element/datatype/long_long.rb +11 -0
- data/lib/c_nifti/header_element/datatype/signed_char.rb +11 -0
- data/lib/c_nifti/header_element/datatype/signed_int.rb +11 -0
- data/lib/c_nifti/header_element/datatype/signed_short.rb +11 -0
- data/lib/c_nifti/header_element/datatype/unsigned_char.rb +11 -0
- data/lib/c_nifti/header_element/datatype/unsigned_int.rb +11 -0
- data/lib/c_nifti/header_element/datatype/unsigned_long_long.rb +11 -0
- data/lib/c_nifti/header_element/datatype/unsigned_short.rb +11 -0
- data/lib/c_nifti/header_element/dimensions.rb +53 -0
- data/lib/c_nifti/header_element/intents.rb +25 -0
- data/lib/c_nifti/header_element/metadata.rb +49 -0
- data/lib/c_nifti/header_element/miscellaneous.rb +25 -0
- data/lib/c_nifti/header_element/quaternions.rb +33 -0
- data/lib/c_nifti/header_element/spacings.rb +45 -0
- data/lib/c_nifti/header_element/timings.rb +37 -0
- data/lib/c_nifti/header_element/transforms.rb +21 -0
- data/lib/c_nifti/image.rb +31 -0
- data/lib/c_nifti/version.rb +3 -0
- data/lib/nifticlib.rb +1 -0
- data/spec/data_spec.rb +112 -0
- data/spec/factories/nifti_images.rb +9 -0
- data/spec/header_element/datatype/base_spec.rb +9 -0
- data/spec/header_element/datatype/binary_spec.rb +9 -0
- data/spec/header_element/datatype/double_spec.rb +9 -0
- data/spec/header_element/datatype/float_spec.rb +9 -0
- data/spec/header_element/datatype/long_double_spec.rb +9 -0
- data/spec/header_element/datatype/long_long_spec.rb +9 -0
- data/spec/header_element/datatype/signed_char_spec.rb +9 -0
- data/spec/header_element/datatype/signed_int_spec.rb +9 -0
- data/spec/header_element/datatype/signed_short_spec.rb +9 -0
- data/spec/header_element/datatype/unsigned_char_spec.rb +9 -0
- data/spec/header_element/datatype/unsigned_int_spec.rb +9 -0
- data/spec/header_element/datatype/unsigned_long_long.rb +9 -0
- data/spec/header_element/datatype/unsigned_short_spec.rb +9 -0
- data/spec/header_element/datatype_spec.rb +109 -0
- data/spec/header_element/dimensions_spec.rb +105 -0
- data/spec/header_element/intents_spec.rb +48 -0
- data/spec/header_element/metadata_spec.rb +96 -0
- data/spec/header_element/miscellaneous_spec.rb +48 -0
- data/spec/header_element/quaternions_spec.rb +64 -0
- data/spec/header_element/spacings_spec.rb +88 -0
- data/spec/header_element/timings_spec.rb +72 -0
- data/spec/header_element/transforms_spec.rb +64 -0
- data/spec/image_spec.rb +39 -0
- data/spec/spec_helper.rb +85 -0
- metadata +363 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
#{{{ copyright and setup
|
2
|
+
|
3
|
+
# FEAT TCL FSLIO wrappers
|
4
|
+
#
|
5
|
+
# Stephen Smith, FMRIB Image Analysis Group
|
6
|
+
#
|
7
|
+
#
|
8
|
+
#
|
9
|
+
# The fslio.tcl file was originally part of FSL - FMRIB's Software Library
|
10
|
+
# http://www.fmrib.ox.ac.uk/fsl
|
11
|
+
# fslio.tcl has now been placed in the public domain.
|
12
|
+
#
|
13
|
+
# Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
|
14
|
+
# Imaging of the Brain), Department of Clinical Neurology, Oxford
|
15
|
+
# University, Oxford, UK
|
16
|
+
#
|
17
|
+
#
|
18
|
+
|
19
|
+
#}}}
|
20
|
+
|
21
|
+
proc imcp { args } {
|
22
|
+
global FSLDIR
|
23
|
+
|
24
|
+
regsub -all "\{" $args "" cleanedargs
|
25
|
+
regsub -all "\}" $cleanedargs "" cleanedargs
|
26
|
+
|
27
|
+
return [ exec sh -c "${FSLDIR}/bin/imcp $args" ]
|
28
|
+
}
|
29
|
+
|
30
|
+
proc imglob { args } {
|
31
|
+
global FSLDIR
|
32
|
+
|
33
|
+
regsub -all "\{" $args "" cleanedargs
|
34
|
+
regsub -all "\}" $cleanedargs "" cleanedargs
|
35
|
+
|
36
|
+
return [ exec sh -c "${FSLDIR}/bin/imglob $args" ]
|
37
|
+
}
|
38
|
+
|
39
|
+
proc imln { args } {
|
40
|
+
global FSLDIR
|
41
|
+
|
42
|
+
regsub -all "\{" $args "" cleanedargs
|
43
|
+
regsub -all "\}" $cleanedargs "" cleanedargs
|
44
|
+
|
45
|
+
return [ exec sh -c "${FSLDIR}/bin/imln $args" ]
|
46
|
+
}
|
47
|
+
|
48
|
+
proc immv { args } {
|
49
|
+
global FSLDIR
|
50
|
+
|
51
|
+
regsub -all "\{" $args "" cleanedargs
|
52
|
+
regsub -all "\}" $cleanedargs "" cleanedargs
|
53
|
+
|
54
|
+
return [ exec sh -c "${FSLDIR}/bin/immv $args" ]
|
55
|
+
}
|
56
|
+
|
57
|
+
proc imrm { args } {
|
58
|
+
global FSLDIR
|
59
|
+
|
60
|
+
regsub -all "\{" $args "" cleanedargs
|
61
|
+
regsub -all "\}" $cleanedargs "" cleanedargs
|
62
|
+
|
63
|
+
return [ exec sh -c "${FSLDIR}/bin/imrm $args" ]
|
64
|
+
}
|
65
|
+
|
66
|
+
proc imtest { args } {
|
67
|
+
global FSLDIR
|
68
|
+
|
69
|
+
regsub -all "\{" $args "" cleanedargs
|
70
|
+
regsub -all "\}" $cleanedargs "" cleanedargs
|
71
|
+
|
72
|
+
return [ exec sh -c "${FSLDIR}/bin/imtest $args" ]
|
73
|
+
}
|
74
|
+
|
75
|
+
proc remove_ext { args } {
|
76
|
+
global FSLDIR
|
77
|
+
|
78
|
+
regsub -all "\{" $args "" cleanedargs
|
79
|
+
regsub -all "\}" $cleanedargs "" cleanedargs
|
80
|
+
|
81
|
+
return [ exec sh -c "${FSLDIR}/bin/remove_ext $cleanedargs" ]
|
82
|
+
}
|
83
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# imcp - copy image files
|
4
|
+
#
|
5
|
+
# Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# The imcp file was originally part of FSL - FMRIB's Software Library
|
9
|
+
# http://www.fmrib.ox.ac.uk/fsl
|
10
|
+
# imcp has now been placed in the public domain.
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
|
14
|
+
# Imaging of the Brain), Department of Clinical Neurology, Oxford
|
15
|
+
# University, Oxford, UK
|
16
|
+
#
|
17
|
+
#
|
18
|
+
|
19
|
+
if [ $# -lt 1 ] ; then
|
20
|
+
echo "Usage: $0 <file1> <file2>"
|
21
|
+
echo "Usage: $0 <file1> <file2> ... <fileN> <directory>"
|
22
|
+
echo " Copies images from file1 to file2 (including all extensions)"
|
23
|
+
echo " NB: filenames can be basenames or include an extension"
|
24
|
+
exit 1;
|
25
|
+
fi
|
26
|
+
|
27
|
+
if [ $# -eq 2 -a ! -d $2 ] ; then
|
28
|
+
f1=`${FSLDIR}/bin/remove_ext $1`;
|
29
|
+
f2=`${FSLDIR}/bin/remove_ext $2`;
|
30
|
+
# do the copies
|
31
|
+
if [ -f ${f1}.hdr ] ; then /bin/cp ${f1}.hdr ${f2}.hdr ; fi
|
32
|
+
if [ -f ${f1}.hdr.gz ] ; then /bin/cp ${f1}.hdr.gz ${f2}.hdr.gz ; fi
|
33
|
+
if [ -f ${f1}.img ] ; then /bin/cp ${f1}.img ${f2}.img ; fi
|
34
|
+
if [ -f ${f1}.img.gz ] ; then /bin/cp ${f1}.img.gz ${f2}.img.gz ; fi
|
35
|
+
if [ -f ${f1}.nii ] ; then /bin/cp ${f1}.nii ${f2}.nii ; fi
|
36
|
+
if [ -f ${f1}.nii.gz ] ; then /bin/cp ${f1}.nii.gz ${f2}.nii.gz ; fi
|
37
|
+
if [ -f ${f1}.mnc ] ; then /bin/cp ${f1}.mnc ${f2}.mnc ; fi
|
38
|
+
if [ -f ${f1}.mnc.gz ] ; then /bin/cp ${f1}.mnc.gz ${f2}.mnc.gz ; fi
|
39
|
+
fi
|
40
|
+
|
41
|
+
if [ $# -gt 2 -o -d $2 ] ; then
|
42
|
+
for nm in $@ ; do
|
43
|
+
dir=$nm;
|
44
|
+
done
|
45
|
+
if [ ! -d $dir ] ; then
|
46
|
+
echo "When using multiple arguments, last name must be a directory"
|
47
|
+
exit 1;
|
48
|
+
fi
|
49
|
+
# remove directory from list of files
|
50
|
+
flist="echo $@ | sed s/$dir \*\$//";
|
51
|
+
for fn in $flist ; do
|
52
|
+
f1=`${FSLDIR}/bin/remove_ext $fn`;
|
53
|
+
# do the copies
|
54
|
+
if [ -f ${f1}.hdr ] ; then /bin/cp ${f1}.hdr ${dir} ; fi
|
55
|
+
if [ -f ${f1}.hdr.gz ] ; then /bin/cp ${f1}.hdr.gz ${dir} ; fi
|
56
|
+
if [ -f ${f1}.img ] ; then /bin/cp ${f1}.img ${dir} ; fi
|
57
|
+
if [ -f ${f1}.img.gz ] ; then /bin/cp ${f1}.img.gz ${dir} ; fi
|
58
|
+
if [ -f ${f1}.nii ] ; then /bin/cp ${f1}.nii ${dir} ; fi
|
59
|
+
if [ -f ${f1}.nii.gz ] ; then /bin/cp ${f1}.nii.gz ${dir} ; fi
|
60
|
+
if [ -f ${f1}.mnc ] ; then /bin/cp ${f1}.mnc ${dir} ; fi
|
61
|
+
if [ -f ${f1}.mnc.gz ] ; then /bin/cp ${f1}.mnc.gz ${dir} ; fi
|
62
|
+
done
|
63
|
+
fi
|
64
|
+
|
65
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# imglob - expand list of image filenames
|
4
|
+
#
|
5
|
+
# Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# The imglob file was originally part of FSL - FMRIB's Software Library
|
9
|
+
# http://www.fmrib.ox.ac.uk/fsl
|
10
|
+
# imglob has now been placed in the public domain.
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
|
14
|
+
# Imaging of the Brain), Department of Clinical Neurology, Oxford
|
15
|
+
# University, Oxford, UK
|
16
|
+
#
|
17
|
+
#
|
18
|
+
|
19
|
+
if [ $# -lt 1 ] ; then
|
20
|
+
echo "Usage: $0 [-oneperimage] <list of names>"
|
21
|
+
exit 0;
|
22
|
+
fi
|
23
|
+
|
24
|
+
oneperimg=0;
|
25
|
+
if [ X"$1"X = "X-oneperimageX" ] ; then
|
26
|
+
oneperimg=1;
|
27
|
+
shift;
|
28
|
+
fi
|
29
|
+
|
30
|
+
# process each argument, removing any possible extension and
|
31
|
+
# then expanding for valid extensions
|
32
|
+
|
33
|
+
lst="";
|
34
|
+
for aa in $@ ; do
|
35
|
+
# repeat remove_ext a few times to expand out all wildmasking
|
36
|
+
a=`${FSLDIR}/bin/remove_ext ${aa}`;
|
37
|
+
# at this point variable 'a' may have been expanded into a list
|
38
|
+
for b in $a ; do
|
39
|
+
if [ $oneperimg = 1 ] ; then
|
40
|
+
fn=`echo ${b}.hdr ${b}.hdr.gz ${b}.nii ${b}.nii.gz ${b}.mnc ${b}.mnc.gz`;
|
41
|
+
else
|
42
|
+
fn=`echo ${b}.hdr ${b}.hdr.gz ${b}.nii ${b}.nii.gz ${b}.mnc ${b}.mnc.gz ${b}.img ${b}.img.gz`;
|
43
|
+
fi
|
44
|
+
lst="$lst $fn";
|
45
|
+
done
|
46
|
+
done
|
47
|
+
|
48
|
+
# remove any instances of unmatched wildmasks (still with * in them)
|
49
|
+
lst2="";
|
50
|
+
for fn in $lst ; do
|
51
|
+
if [ -f $fn ] ; then
|
52
|
+
lst2="$lst2 $fn";
|
53
|
+
fi
|
54
|
+
done
|
55
|
+
|
56
|
+
# make list unique
|
57
|
+
lst=`echo $lst2 | tr ' ' '\n' | sort -u`;
|
58
|
+
echo $lst
|
59
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# imln - make symbolic link(s) to image file(s)
|
4
|
+
#
|
5
|
+
# Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# The imln file was originally part of FSL - FMRIB's Software Library
|
9
|
+
# http://www.fmrib.ox.ac.uk/fsl
|
10
|
+
# imln has now been placed in the public domain.
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
|
14
|
+
# Imaging of the Brain), Department of Clinical Neurology, Oxford
|
15
|
+
# University, Oxford, UK
|
16
|
+
#
|
17
|
+
#
|
18
|
+
|
19
|
+
if [ $# -lt 2 ] ; then
|
20
|
+
echo "Usage: $0 <file1> <file2>"
|
21
|
+
echo " Makes a link (called file2) to file1"
|
22
|
+
echo " NB: filenames can be basenames or include an extension"
|
23
|
+
exit 1;
|
24
|
+
fi
|
25
|
+
|
26
|
+
f1=`${FSLDIR}/bin/remove_ext $1`;
|
27
|
+
f2=`${FSLDIR}/bin/remove_ext $2`;
|
28
|
+
|
29
|
+
if [ -f ${f1}.hdr ] ; then ln -fs ${f1}.hdr ${f2}.hdr ; fi
|
30
|
+
if [ -f ${f1}.hdr.gz ] ; then ln -fs ${f1}.hdr.gz ${f2}.hdr.gz ; fi
|
31
|
+
if [ -f ${f1}.img ] ; then ln -fs ${f1}.img ${f2}.img ; fi
|
32
|
+
if [ -f ${f1}.img.gz ] ; then ln -fs ${f1}.img.gz ${f2}.img.gz ; fi
|
33
|
+
if [ -f ${f1}.nii ] ; then ln -fs ${f1}.nii ${f2}.nii ; fi
|
34
|
+
if [ -f ${f1}.nii.gz ] ; then ln -fs ${f1}.nii.gz ${f2}.nii.gz ; fi
|
35
|
+
if [ -f ${f1}.mnc ] ; then ln -fs ${f1}.mnc ${f2}.mnc ; fi
|
36
|
+
if [ -f ${f1}.mnc.gz ] ; then ln -fs ${f1}.mnc.gz ${f2}.mnc.gz ; fi
|
37
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# immv - rename/move image files
|
4
|
+
#
|
5
|
+
# Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# The immv file was originally part of FSL - FMRIB's Software Library
|
9
|
+
# http://www.fmrib.ox.ac.uk/fsl
|
10
|
+
# immv has now been placed in the public domain.
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
|
14
|
+
# Imaging of the Brain), Department of Clinical Neurology, Oxford
|
15
|
+
# University, Oxford, UK
|
16
|
+
#
|
17
|
+
#
|
18
|
+
|
19
|
+
if [ $# -lt 1 ] ; then
|
20
|
+
echo "Usage: $0 <file1> <file2>"
|
21
|
+
echo " Moves images from file1 to file2 (including all extensions)"
|
22
|
+
echo " NB: filenames can be basenames or include an extension"
|
23
|
+
exit 1;
|
24
|
+
fi
|
25
|
+
|
26
|
+
if [ $# -eq 2 -a ! -d $2 ] ; then
|
27
|
+
f1=`${FSLDIR}/bin/remove_ext $1`;
|
28
|
+
f2=`${FSLDIR}/bin/remove_ext $2`;
|
29
|
+
# do the moves
|
30
|
+
if [ -f ${f1}.hdr ] ; then /bin/mv ${f1}.hdr ${f2}.hdr ; fi
|
31
|
+
if [ -f ${f1}.hdr.gz ] ; then /bin/mv ${f1}.hdr.gz ${f2}.hdr.gz ; fi
|
32
|
+
if [ -f ${f1}.img ] ; then /bin/mv ${f1}.img ${f2}.img ; fi
|
33
|
+
if [ -f ${f1}.img.gz ] ; then /bin/mv ${f1}.img.gz ${f2}.img.gz ; fi
|
34
|
+
if [ -f ${f1}.nii ] ; then /bin/mv ${f1}.nii ${f2}.nii ; fi
|
35
|
+
if [ -f ${f1}.nii.gz ] ; then /bin/mv ${f1}.nii.gz ${f2}.nii.gz ; fi
|
36
|
+
if [ -f ${f1}.mnc ] ; then /bin/mv ${f1}.mnc ${f2}.mnc ; fi
|
37
|
+
if [ -f ${f1}.mnc.gz ] ; then /bin/mv ${f1}.mnc.gz ${f2}.mnc.gz ; fi
|
38
|
+
fi
|
39
|
+
|
40
|
+
if [ $# -gt 2 -o -d $2 ] ; then
|
41
|
+
for nm in $@ ; do
|
42
|
+
dir=$nm;
|
43
|
+
done
|
44
|
+
if [ ! -d $dir ] ; then
|
45
|
+
echo "When using multiple arguments, last name must be a directory"
|
46
|
+
exit 1;
|
47
|
+
fi
|
48
|
+
# remove directory from list of files
|
49
|
+
flist="echo $@ | sed s/$dir \*\$//";
|
50
|
+
for fn in $flist ; do
|
51
|
+
f1=`${FSLDIR}/bin/remove_ext $fn`;
|
52
|
+
# do the copies
|
53
|
+
if [ -f ${f1}.hdr ] ; then /bin/mv ${f1}.hdr ${dir} ; fi
|
54
|
+
if [ -f ${f1}.hdr.gz ] ; then /bin/mv ${f1}.hdr.gz ${dir} ; fi
|
55
|
+
if [ -f ${f1}.img ] ; then /bin/mv ${f1}.img ${dir} ; fi
|
56
|
+
if [ -f ${f1}.img.gz ] ; then /bin/mv ${f1}.img.gz ${dir} ; fi
|
57
|
+
if [ -f ${f1}.nii ] ; then /bin/mv ${f1}.nii ${dir} ; fi
|
58
|
+
if [ -f ${f1}.nii.gz ] ; then /bin/mv ${f1}.nii.gz ${dir} ; fi
|
59
|
+
if [ -f ${f1}.mnc ] ; then /bin/mv ${f1}.mnc ${dir} ; fi
|
60
|
+
if [ -f ${f1}.mnc.gz ] ; then /bin/mv ${f1}.mnc.gz ${dir} ; fi
|
61
|
+
done
|
62
|
+
fi
|
63
|
+
|
64
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# imrm - remove image files
|
4
|
+
#
|
5
|
+
# Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# The imrm file was originally part of FSL - FMRIB's Software Library
|
9
|
+
# http://www.fmrib.ox.ac.uk/fsl
|
10
|
+
# imrm 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
|
+
if [ $# -lt 1 ] ; then
|
19
|
+
echo "Usage: $0 <list of image names to remove>"
|
20
|
+
echo "NB: filenames can be basenames or not"
|
21
|
+
exit 1;
|
22
|
+
fi
|
23
|
+
|
24
|
+
for f in $@ ; do
|
25
|
+
fn=`${FSLDIR}/bin/remove_ext $f`;
|
26
|
+
# do the rm silently
|
27
|
+
/bin/rm -f ${fn}.img ${fn}.hdr ${fn}.hdr.gz ${fn}.img.gz ${fn}.nii ${fn}.nii.gz ${fn}.mnc ${fn}.mnc.gz
|
28
|
+
done
|
29
|
+
|
@@ -0,0 +1,53 @@
|
|
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;
|
53
|
+
|
@@ -0,0 +1,33 @@
|
|
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;
|
32
|
+
|
33
|
+
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
PROJECT(NIFTICDFLIB)
|
2
|
+
|
3
|
+
INCLUDE_DIRECTORIES(${NIFTILIB_SOURCE_DIR})
|
4
|
+
#INCLUDE_DIRECTORIES(/usr/include/nifti)
|
5
|
+
SET(NIFTICDFLIB_SRC nifticdf.c)
|
6
|
+
|
7
|
+
SET(NIFTI_CDFLIB_NAME ${PACKAGE_PREFIX}nifticdf)
|
8
|
+
|
9
|
+
ADD_LIBRARY(${NIFTI_CDFLIB_NAME} ${NIFTICDFLIB_SRC} )
|
10
|
+
|
11
|
+
IF (BUILD_SHARED_LIBS)
|
12
|
+
SET_TARGET_PROPERTIES(${NIFTI_CDFLIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES})
|
13
|
+
ENDIF (BUILD_SHARED_LIBS)
|
14
|
+
|
15
|
+
|
16
|
+
IF(NOT NIFTI_INSTALL_NO_LIBRARIES)
|
17
|
+
INSTALL(TARGETS ${NIFTI_CDFLIB_NAME}
|
18
|
+
RUNTIME DESTINATION ${NIFTI_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries
|
19
|
+
LIBRARY DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries
|
20
|
+
ARCHIVE DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT Development)
|
21
|
+
ENDIF(NOT NIFTI_INSTALL_NO_LIBRARIES)
|
22
|
+
|
23
|
+
IF(NOT NIFTI_INSTALL_NO_DEVELOPMENT)
|
24
|
+
FILE(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
|
25
|
+
INSTALL(FILES ${__files}
|
26
|
+
DESTINATION ${NIFTI_INSTALL_INCLUDE_DIR}
|
27
|
+
COMPONENT Development)
|
28
|
+
ENDIF(NOT NIFTI_INSTALL_NO_DEVELOPMENT)
|