c_nifti 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +37 -0
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/COPYING +621 -0
  7. data/COPYING.lesser +166 -0
  8. data/Gemfile +4 -0
  9. data/README.md +117 -0
  10. data/Rakefile +6 -0
  11. data/c_nifti.gemspec +31 -0
  12. data/ext/nifticlib/extconf.rb +30 -0
  13. data/ext/nifticlib/include/nifti_image.h +2 -0
  14. data/ext/nifticlib/include/nifti_image_converters.h +3 -0
  15. data/ext/nifticlib/include/nifti_image_dimensions.h +1 -0
  16. data/ext/nifticlib/include/nifti_image_intents.h +1 -0
  17. data/ext/nifticlib/include/nifti_image_metadata.h +1 -0
  18. data/ext/nifticlib/include/nifti_image_quaternions.h +1 -0
  19. data/ext/nifticlib/include/nifti_image_spacings.h +1 -0
  20. data/ext/nifticlib/include/nifti_image_timings.h +1 -0
  21. data/ext/nifticlib/include/nifti_image_transforms.h +1 -0
  22. data/ext/nifticlib/nifti_image.c +169 -0
  23. data/ext/nifticlib/nifti_image_converters.c +65 -0
  24. data/ext/nifticlib/nifti_image_dimensions.c +113 -0
  25. data/ext/nifticlib/nifti_image_intents.c +45 -0
  26. data/ext/nifticlib/nifti_image_metadata.c +133 -0
  27. data/ext/nifticlib/nifti_image_quaternions.c +59 -0
  28. data/ext/nifticlib/nifti_image_spacings.c +87 -0
  29. data/ext/nifticlib/nifti_image_timings.c +66 -0
  30. data/ext/nifticlib/nifti_image_transforms.c +38 -0
  31. data/ext/nifticlib/nifticlib-2.0.0/CMakeLists.txt +140 -0
  32. data/ext/nifticlib/nifticlib-2.0.0/CTestConfig.cmake +13 -0
  33. data/ext/nifticlib/nifticlib-2.0.0/LICENSE +9 -0
  34. data/ext/nifticlib/nifticlib-2.0.0/Makefile +265 -0
  35. data/ext/nifticlib/nifticlib-2.0.0/Makefile.cross_mingw32 +94 -0
  36. data/ext/nifticlib/nifticlib-2.0.0/README +79 -0
  37. data/ext/nifticlib/nifticlib-2.0.0/Testing/CMakeLists.txt +7 -0
  38. data/ext/nifticlib/nifticlib-2.0.0/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz +0 -0
  39. data/ext/nifticlib/nifticlib-2.0.0/Testing/Makefile +21 -0
  40. data/ext/nifticlib/nifticlib-2.0.0/Testing/README_regress +50 -0
  41. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/@show.diffs +33 -0
  42. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/@test +80 -0
  43. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/CMakeLists.txt +47 -0
  44. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/bricks_test.sh +32 -0
  45. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/comment_test.sh +65 -0
  46. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/dci_test.sh +46 -0
  47. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/dsets_test.sh +61 -0
  48. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/dts_test.sh +75 -0
  49. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/fetch_data_test.sh +45 -0
  50. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/mod_header_test.sh +60 -0
  51. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/cmake_testscripts/newfiles_test.sh +36 -0
  52. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c01.versions +10 -0
  53. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c02.nt.help +5 -0
  54. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c03.hist +5 -0
  55. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c04.disp.anat0.info +7 -0
  56. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c05.mod.hdr +9 -0
  57. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c06.add.ext +22 -0
  58. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c07.cbl.4bricks +8 -0
  59. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c08.dts.19.36.11 +4 -0
  60. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c09.dts4.compare +9 -0
  61. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c10.dci.ts4 +15 -0
  62. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c10a.dci.run.210 +16 -0
  63. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c11.add.comment +8 -0
  64. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c12.check.comments +7 -0
  65. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c13.check.hdrs +5 -0
  66. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c14.make.dsets +21 -0
  67. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c15.new.files +21 -0
  68. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c16.rand.swap +35 -0
  69. data/ext/nifticlib/nifticlib-2.0.0/Testing/nifti_regress_test/commands/c17.file.case +34 -0
  70. data/ext/nifticlib/nifticlib-2.0.0/Testing/niftilib/CMakeLists.txt +15 -0
  71. data/ext/nifticlib/nifticlib-2.0.0/Testing/niftilib/nifti_test.c +690 -0
  72. data/ext/nifticlib/nifticlib-2.0.0/Testing/niftilib/nifti_test2.c +32 -0
  73. data/ext/nifticlib/nifticlib-2.0.0/Updates.txt +110 -0
  74. data/ext/nifticlib/nifticlib-2.0.0/bin/.gitkeep +0 -0
  75. data/ext/nifticlib/nifticlib-2.0.0/docs/Doxy_nifti.txt +123 -0
  76. data/ext/nifticlib/nifticlib-2.0.0/docs/Doxyfile.ORIG +746 -0
  77. data/ext/nifticlib/nifticlib-2.0.0/examples/CMakeLists.txt +15 -0
  78. data/ext/nifticlib/nifticlib-2.0.0/examples/Makefile +48 -0
  79. data/ext/nifticlib/nifticlib-2.0.0/examples/clib_01_read_write.c +94 -0
  80. data/ext/nifticlib/nifticlib-2.0.0/examples/fsl_api_driver.c +142 -0
  81. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/CMakeLists.txt +32 -0
  82. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/Makefile +29 -0
  83. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/fslio.c +2426 -0
  84. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/fslio.tcl +83 -0
  85. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imcp +65 -0
  86. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imglob +59 -0
  87. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imln +37 -0
  88. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/immv +64 -0
  89. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imrm +29 -0
  90. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/imtest +53 -0
  91. data/ext/nifticlib/nifticlib-2.0.0/fsliolib/remove_ext +33 -0
  92. data/ext/nifticlib/nifticlib-2.0.0/include/.gitkeep +0 -0
  93. data/ext/nifticlib/nifticlib-2.0.0/nifticdf/CMakeLists.txt +28 -0
  94. data/ext/nifticlib/nifticlib-2.0.0/nifticdf/Makefile +28 -0
  95. data/ext/nifticlib/nifticlib-2.0.0/nifticdf/nifticdf.c +11107 -0
  96. data/ext/nifticlib/nifticlib-2.0.0/niftilib/CMakeLists.txt +33 -0
  97. data/ext/nifticlib/nifticlib-2.0.0/niftilib/Makefile +31 -0
  98. data/ext/nifticlib/nifticlib-2.0.0/niftilib/nifti1_io.c +7509 -0
  99. data/ext/nifticlib/nifticlib-2.0.0/packaging/DevPackage.template +18 -0
  100. data/ext/nifticlib/nifticlib-2.0.0/packaging/nifticlib.spec +62 -0
  101. data/ext/nifticlib/nifticlib-2.0.0/real_easy/nifti1_read_write.c +361 -0
  102. data/ext/nifticlib/nifticlib-2.0.0/utils/CMakeLists.txt +73 -0
  103. data/ext/nifticlib/nifticlib-2.0.0/utils/Makefile +55 -0
  104. data/ext/nifticlib/nifticlib-2.0.0/utils/nifti1_test.c +95 -0
  105. data/ext/nifticlib/nifticlib-2.0.0/utils/nifti_stats.c +95 -0
  106. data/ext/nifticlib/nifticlib-2.0.0/utils/nifti_tool.c +4193 -0
  107. data/ext/nifticlib/nifticlib-2.0.0/utils/nifti_tool.h +163 -0
  108. data/ext/nifticlib/nifticlib-2.0.0/znzlib/CMakeLists.txt +31 -0
  109. data/ext/nifticlib/nifticlib-2.0.0/znzlib/Makefile +33 -0
  110. data/ext/nifticlib/nifticlib-2.0.0/znzlib/znzlib.c +322 -0
  111. data/ext/nifticlib/nifticlib.c +107 -0
  112. data/ext/nifticlib/patches/nifticlib_fpic.patch +13 -0
  113. data/features/read_modify_write.feature +11 -0
  114. data/features/step_definitions/nifti_image_steps.rb +16 -0
  115. data/features/support/env.rb +14 -0
  116. data/features/support/fixtures/sample.nii.gz +0 -0
  117. data/lib/c_nifti.rb +9 -0
  118. data/lib/c_nifti/data.rb +70 -0
  119. data/lib/c_nifti/header.rb +16 -0
  120. data/lib/c_nifti/header_element.rb +13 -0
  121. data/lib/c_nifti/header_element/datatype.rb +49 -0
  122. data/lib/c_nifti/header_element/datatype/base.rb +9 -0
  123. data/lib/c_nifti/header_element/datatype/binary.rb +11 -0
  124. data/lib/c_nifti/header_element/datatype/double.rb +11 -0
  125. data/lib/c_nifti/header_element/datatype/float.rb +11 -0
  126. data/lib/c_nifti/header_element/datatype/long_double.rb +11 -0
  127. data/lib/c_nifti/header_element/datatype/long_long.rb +11 -0
  128. data/lib/c_nifti/header_element/datatype/signed_char.rb +11 -0
  129. data/lib/c_nifti/header_element/datatype/signed_int.rb +11 -0
  130. data/lib/c_nifti/header_element/datatype/signed_short.rb +11 -0
  131. data/lib/c_nifti/header_element/datatype/unsigned_char.rb +11 -0
  132. data/lib/c_nifti/header_element/datatype/unsigned_int.rb +11 -0
  133. data/lib/c_nifti/header_element/datatype/unsigned_long_long.rb +11 -0
  134. data/lib/c_nifti/header_element/datatype/unsigned_short.rb +11 -0
  135. data/lib/c_nifti/header_element/dimensions.rb +53 -0
  136. data/lib/c_nifti/header_element/intents.rb +25 -0
  137. data/lib/c_nifti/header_element/metadata.rb +49 -0
  138. data/lib/c_nifti/header_element/miscellaneous.rb +25 -0
  139. data/lib/c_nifti/header_element/quaternions.rb +33 -0
  140. data/lib/c_nifti/header_element/spacings.rb +45 -0
  141. data/lib/c_nifti/header_element/timings.rb +37 -0
  142. data/lib/c_nifti/header_element/transforms.rb +21 -0
  143. data/lib/c_nifti/image.rb +31 -0
  144. data/lib/c_nifti/version.rb +3 -0
  145. data/lib/nifticlib.rb +1 -0
  146. data/spec/data_spec.rb +112 -0
  147. data/spec/factories/nifti_images.rb +9 -0
  148. data/spec/header_element/datatype/base_spec.rb +9 -0
  149. data/spec/header_element/datatype/binary_spec.rb +9 -0
  150. data/spec/header_element/datatype/double_spec.rb +9 -0
  151. data/spec/header_element/datatype/float_spec.rb +9 -0
  152. data/spec/header_element/datatype/long_double_spec.rb +9 -0
  153. data/spec/header_element/datatype/long_long_spec.rb +9 -0
  154. data/spec/header_element/datatype/signed_char_spec.rb +9 -0
  155. data/spec/header_element/datatype/signed_int_spec.rb +9 -0
  156. data/spec/header_element/datatype/signed_short_spec.rb +9 -0
  157. data/spec/header_element/datatype/unsigned_char_spec.rb +9 -0
  158. data/spec/header_element/datatype/unsigned_int_spec.rb +9 -0
  159. data/spec/header_element/datatype/unsigned_long_long.rb +9 -0
  160. data/spec/header_element/datatype/unsigned_short_spec.rb +9 -0
  161. data/spec/header_element/datatype_spec.rb +109 -0
  162. data/spec/header_element/dimensions_spec.rb +105 -0
  163. data/spec/header_element/intents_spec.rb +48 -0
  164. data/spec/header_element/metadata_spec.rb +96 -0
  165. data/spec/header_element/miscellaneous_spec.rb +48 -0
  166. data/spec/header_element/quaternions_spec.rb +64 -0
  167. data/spec/header_element/spacings_spec.rb +88 -0
  168. data/spec/header_element/timings_spec.rb +72 -0
  169. data/spec/header_element/transforms_spec.rb +64 -0
  170. data/spec/image_spec.rb +39 -0
  171. data/spec/spec_helper.rb +85 -0
  172. metadata +363 -0
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/make -f
2
+ # -*- Makefile -*-
3
+ #
4
+ # This makefile was initially created by Michael Hanke
5
+ # <michael.hanke@gmail.com> to cross compile the nifticlibs for win32 on a
6
+ # Debian system -- although it should work on most Linux systems with possibly
7
+ # minor modifications. The whole process should become a lot easier once
8
+ # CMake 2.6 with cross-compiler toolchain support is released.
9
+ #
10
+ # Like the other parts of this package, this code is placed into the public
11
+ # domain.
12
+ #
13
+ # The 'devpak' target generates a DevPak suiteable for Dev-Cpp, see:
14
+ # http://www.bloodshed.net/devcpp.html
15
+ #
16
+ # Requirements:
17
+ # - cross-compiler environment (on Debian simply: apt-get install mingw32)
18
+ # - recent CMake (tested with 2.4)
19
+ # - cross-compiled zlib installed below $mingw_root_path. The easiest way to
20
+ # achieve this is using the zlib package provided by the gnuwin32 project:
21
+ # http://gnuwin32.sourceforge.net/
22
+ #
23
+ # Usage:
24
+ # Enter the root of the nifticlibs package and execute
25
+ #
26
+ # make -f Makefile.cross_mingw32
27
+ #
28
+ # now the generated DevPak should be located in the toplevel directory. This
29
+ # can be installed using the Package manager of Dev-Cpp under Windows.
30
+ #
31
+
32
+
33
+ # default settings
34
+ build_dir = mingw32_cross
35
+ devpak_dir = mingw32_devpak
36
+
37
+ # where all the cross-compiled libs and binaries are installed
38
+ mingw_root_path = /usr/local/mingw32
39
+ # where the cross-compiler itself is installed
40
+ mingw_bin_path = /usr/bin
41
+ # the common filename prefix of all cross-compiler binaries
42
+ mingw_bin_prefix = i586-mingw32msvc
43
+ # don't touch this one, unless you know what you are doing
44
+ mingw_bin = $(mingw_bin_path)/$(mingw_bin_prefix)
45
+
46
+ # extract the most recent version from the README file
47
+ nifti_version = $$(grep Version README | head -n1 | awk '{ print $$2 }')
48
+
49
+ # compile CMake flags.
50
+ cmake_flags = -DCMAKE_SYSTEM_NAME=Windows \
51
+ -DCMAKE_AR=$(mingw_bin)-ar \
52
+ -DCMAKE_RANLIB=$(mingw_bin)-ranlib \
53
+ -DCMAKE_C_COMPILER=$(mingw_bin)-gcc \
54
+ -DCMAKE_CXX_COMPILER=$(mingw_bin)-g++ \
55
+ -DCMAKE_C_FLAGS="-I$(mingw_root_path)/include -L$(mingw_root_path)/lib -DWIN32"
56
+
57
+
58
+ all: devpak
59
+
60
+
61
+ clean:
62
+ -rm -rf $(build_dir)
63
+ -rm build-devpak configure-devpak
64
+
65
+ distclean: clean
66
+ -rm -rf $(devpak_dir)
67
+
68
+ configure-devpak:
69
+ if [ ! -d $(build_dir) ]; then mkdir $(build_dir); fi
70
+ cd $(build_dir) && cmake .. $(cmake_flags) -DCMAKE_INSTALL_PREFIX=/$(devpak_dir)
71
+ touch $@
72
+
73
+ build-devpak: configure-devpak
74
+ cd $(build_dir) && make VERBOSE=1
75
+ touch $@
76
+
77
+ install-devpak: build-devpak
78
+ if [ ! -d $(devpak_dir) ]; then mkdir $(devpak_dir); fi
79
+ cd $(build_dir) && make install DESTDIR=../
80
+
81
+ devpak: install-devpak
82
+ # nifti_tool header is unecessary
83
+ rm $(devpak_dir)/include/nifti/nifti_tool.h
84
+
85
+ # generate devpak info file
86
+ sed -e s/__full_version__/$(nifti_version)/g \
87
+ -e s/__major_version__/$(nifti_version)/g \
88
+ < packaging/DevPackage.template > $(devpak_dir)/nifticlib.DevPackage
89
+
90
+ # include license and readme
91
+ cp LICENSE README $(devpak_dir)
92
+
93
+ # compress
94
+ cd $(devpak_dir) && tar cvjf ../nifticlib-$(nifti_version).DevPak *
@@ -0,0 +1,79 @@
1
+
2
+ Nifti-1 C libraries
3
+ -------------------
4
+
5
+ Version 2.0.0 beta release Jul 2010
6
+ Version 1.1.0 beta release Aug 2008
7
+ Version 1.0.0 beta release Dec 2007
8
+ Version 0.6 beta release Aug 2007
9
+ Version 0.5 beta release May 2007
10
+ Version 0.4 beta release Sept. 2006
11
+ Version 0.3 beta release April 2006
12
+ Version 0.2 beta release August 12, 2005
13
+ Version 0.1 beta release March 11, 2005
14
+
15
+ niftilib code is released into the public domain.
16
+
17
+
18
+ Library directories
19
+ -------------------
20
+ znzlib -- low level library for handling read/write of compressed files.
21
+
22
+ niftilib -- core i/o routines for reading and writing nifti-1 format files.
23
+ Primarily routines to read/write and manipulate the header field
24
+ information, including orientation matrices. Volume-wise,
25
+ timecourse-wise, access to image data.
26
+
27
+ nifticdf -- functions to compute cumulative distributions and their inverses
28
+
29
+ fsliolib -- i/o routines for reading and writing nifti-1 format files, higher
30
+ level than niftilib, includes routines for reading the data blob by
31
+ volume, timecourse, etc., and, addresses image orientation issues.
32
+ *** work in progress, subject to significant revision.....
33
+
34
+ utils -- directory containing library utility programs (nifti_tool)
35
+
36
+
37
+
38
+
39
+ Destination directories
40
+ -----------------------
41
+ bin -- destination directory for installed programs
42
+ include -- destination directory for library header files
43
+ lib -- destination directory for compiled libraries
44
+ docs -- destination directory Doxygen html (created via "make doc")
45
+
46
+
47
+
48
+ Example directories
49
+ -------------------
50
+ examples -- directory containing sample code using nifti reference library
51
+ real_easy -- code snippets to read nifti-1 files, not using nifti ref. lib.
52
+
53
+
54
+ Other directories
55
+ -----------------
56
+ Testing -- directory containing code to test the libraries
57
+ packaging -- spec file for building RPMs, and template package
58
+ description for Dev-Cpp (http://www.bloodshed.net/devcpp.html)
59
+
60
+
61
+
62
+ Instructions to build
63
+ ---------------------
64
+
65
+ command -- "make all"
66
+
67
+ results will be left in the directories: bin/ include/ lib/
68
+
69
+ command -- "make help"
70
+
71
+ will show more build options
72
+
73
+
74
+ For more information
75
+ --------------------
76
+
77
+ See the niftilib webpage at http://niftilib.sourceforge.net/
78
+ See the NIFTI webpage at http://nifti.nimh.nih.gov/
79
+
@@ -0,0 +1,7 @@
1
+ #File Generated by Hans J. Johnson
2
+ #Please contact hans-johnson@uiowa.edu for making enhancments/corrections
3
+ PROJECT(TESTING)
4
+
5
+ SUBDIRS(niftilib)
6
+ SUBDIRS(nifti_regress_test)
7
+
@@ -0,0 +1,21 @@
1
+
2
+ TAR ?= /bin/tar
3
+ RM ?= /bin/rm
4
+
5
+ # get the regression testing data tree
6
+ regress_data: nifti_regress_test/nifti_regress_data
7
+
8
+ # remove any result directories
9
+ regress_clean:
10
+ $(RM) -fr nifti_regress_test/results*
11
+
12
+ # remove any result directories, and remove the data tree
13
+ regress_clean_all: regress_clean
14
+ $(RM) -fr nifti_regress_test/nifti_regress_data
15
+
16
+ # download and unpack the regression data tree
17
+ nifti_regress_test/nifti_regress_data:
18
+ wget http://nifti.nimh.nih.gov/pub/dist/data/nifti_regress_data.tgz
19
+ ( cd nifti_regress_test; $(TAR) -xzf ../nifti_regress_data.tgz; )
20
+ $(RM) nifti_regress_data.tgz
21
+
@@ -0,0 +1,50 @@
1
+ Background:
2
+
3
+ This is to perform regression testing, which is to say, make sure the
4
+ software works the same way that it used to. This is not to test new
5
+ features (see "modify an existing tree" for that).
6
+
7
+ When code has been changed for a certain program that is involved in a
8
+ regression testing tree, go to that tree, run the test, and make sure
9
+ that the results have not changed (in any bad way). This is meant to
10
+ be fast and easy.
11
+
12
+ The test consists of command scripts that were written before. The
13
+ scripts are executed, and the output is compared with the output of
14
+ an older execution. The should ususally be identical.
15
+
16
+ ---------------------------------------------------------------------------
17
+
18
+ To perform regression testing, one needs the data (via 'make regress_data').
19
+ Given that, only the @test and @show_diffs are needed (sample commands are
20
+ shown with a preceeding prompt, '> ').
21
+
22
+ 1. Run the regression testing script. It goes through the steps:
23
+
24
+ a. Create a "results" directory, including a timestamp.
25
+ b. Copy all "data" files into it.
26
+ c. 'cd' into the "results" directory.
27
+ d. For each command script in the commands directory, execute it,
28
+ storing all output text into a file called e."command name".
29
+
30
+ > ./@test
31
+
32
+
33
+ 2. To compare against an older execution, run the @show_diffs script.
34
+ It goes through the steps:
35
+
36
+ a. Make a list of the "results" directories.
37
+ b. Create a new "diffs" directory.
38
+ c. Compare files between the newest and oldest "results" dirs:
39
+ - cd into newest "results" directory
40
+ - foreach file (*)
41
+ diff $file ../other.result/$file >& ../diffs/d.$file
42
+
43
+ > ./@show_diffs
44
+
45
+
46
+ 3. Look at the sizes of the diff files, or the contents (only
47
+ expected differences should exist).
48
+
49
+ > ls -l diffs
50
+ > cat diffs/*
@@ -0,0 +1,33 @@
1
+ #! /usr/bin/env tcsh
2
+
3
+ set ddir = diffs
4
+ set rdirs = ( results_* )
5
+
6
+ # verify that there are differences to view
7
+ if ( $#rdirs < 2 ) then
8
+ echo cannot proceed, we need at least 2 result directories
9
+ exit
10
+ endif
11
+
12
+ # make sure the output directory exists
13
+ if ( -d $ddir ) then
14
+ echo removing old diffs
15
+ \rm -f $ddir/* >& /dev/null
16
+ else
17
+ mkdir $ddir
18
+ if ( ! -d $ddir ) then
19
+ echo failed to make output directory, $ddir
20
+ exit
21
+ endif
22
+ endif
23
+
24
+ set r1 = $rdirs[1]
25
+ set r2 = $rdirs[$#rdirs]
26
+
27
+ cd $r2
28
+
29
+ foreach file (*)
30
+ echo $file...
31
+ diff ../$r1/$file $file >& ../$ddir/d.$file
32
+ end
33
+
@@ -0,0 +1,80 @@
1
+ #! /usr/bin/env tcsh
2
+
3
+ set ddir = nifti_regress_data
4
+ set prog = nifti_tool # might allow this to change
5
+
6
+ set grind = 0 # do we run with valgrind?
7
+
8
+ if ( $#argv > 0 ) then
9
+ if ( "$argv[1]" == "-grind" ) then
10
+ set grind = 1
11
+ else
12
+ echo "usage: `basename $0` [-grind]"
13
+ exit
14
+ endif
15
+ endif
16
+
17
+ # make sure $prog at least exists
18
+ # $prog -ver >& /dev/null
19
+ # if ( $status ) then
20
+ # echo "missing program '$prog' (needs to be in PATH)"
21
+ # exit
22
+ # endif
23
+
24
+ # set date and output dir (based on grind)
25
+ set date = `date +%Y_%m_%d_%H%M`
26
+ if ( $grind ) then
27
+ set odir = vg_results_${prog}_${date}
28
+ else
29
+ set odir = results_${prog}_${date}
30
+ endif
31
+
32
+ # note command files (in commands dir)
33
+ if ( ! -d commands ) then
34
+ echo "** failure: missing commands directory"
35
+ exit
36
+ endif
37
+
38
+ cd commands ; set cfiles = ( c* ) ; cd ..
39
+
40
+ if ( $#cfiles < 1 ) then
41
+ echo "** failure: no command files found in 'commands'"
42
+ exit
43
+ endif
44
+
45
+ # create the output directory
46
+ if ( -e $odir ) then
47
+ echo "** failure: output directory '$odir' already exists"
48
+ exit
49
+ endif
50
+
51
+ mkdir $odir
52
+
53
+ if ( $status ) then
54
+ echo "** failure: output directory '$odir' already exists"
55
+ exit
56
+ endif
57
+
58
+ # copy data files into output dir
59
+ cp $ddir/* $odir
60
+
61
+ cd $odir
62
+
63
+ # now begin the work
64
+
65
+ echo "++ using `which $prog` ..."
66
+
67
+ if ( $grind ) then
68
+ alias $prog "valgrind --leak-resolution=high --leak-check=full $prog"
69
+ endif
70
+
71
+ foreach cfile ( $cfiles )
72
+ echo -n $cfile ...
73
+ echo "--------------------------------------------------------" > e.$cfile
74
+ cat ../commands/$cfile >> e.$cfile
75
+ echo "" >> e.$cfile
76
+ echo "--------------------------" >> e.$cfile
77
+ echo "" >> e.$cfile
78
+ source ../commands/$cfile >>& e.$cfile # to keep alias
79
+ echo done
80
+ end
@@ -0,0 +1,47 @@
1
+ # Do all regression tests
2
+ PROJECT(REGRESSION_TEST)
3
+
4
+ SET(NT ${NIFTI_BINARY_DIR}/utils/nifti_tool )
5
+ SET(DATA ${REGRESSION_TEST_BINARY_DIR}/nifti_regress_data)
6
+ SET(TESTS ${REGRESSION_TEST_SOURCE_DIR}/cmake_testscripts)
7
+
8
+ ADD_TEST(fetch_data
9
+ sh ${TESTS}/fetch_data_test.sh ${REGRESSION_TEST_BINARY_DIR}
10
+ )
11
+
12
+ ADD_TEST(nifti_ver ${NT} -nifti_ver)
13
+ ADD_TEST(nifti_tool_ver ${NT} -ver)
14
+ ADD_TEST(nifti_help ${NT} -help)
15
+ ADD_TEST(nifti_nifti_hist ${NT} -nifti_hist)
16
+ ADD_TEST(nifti_hist ${NT} -hist)
17
+
18
+ ADD_TEST(nifti_disp_hdr ${NT} -disp_hdr -infiles ${DATA}/anat0.nii )
19
+
20
+ ADD_TEST(nifti_disp_nim ${NT} -disp_nim -infiles ${DATA}/anat0.nii )
21
+
22
+ ADD_TEST(nifti_disp_ext ${NT} -disp_ext -infiles ${DATA}/anat0.nii )
23
+
24
+ ADD_TEST(nifti_modhdr_exts
25
+ sh ${TESTS}/mod_header_test.sh ${NT} ${DATA} )
26
+
27
+ ADD_TEST(nifti_bricks_test
28
+ sh ${TESTS}/bricks_test.sh ${NT} ${DATA} )
29
+
30
+ ADD_TEST(nifti_dts_test
31
+ sh ${TESTS}/dts_test.sh ${NT} ${DATA} )
32
+
33
+ ADD_TEST(nifti_dci_test
34
+ sh ${TESTS}/dci_test.sh ${NT} ${DATA} )
35
+
36
+ ADD_TEST(nifti_comment_test
37
+ sh ${TESTS}/comment_test.sh ${NT} ${DATA} )
38
+
39
+ ADD_TEST(nifti_header_check ${NT} -check_hdr -infiles ${DATA}/anat0.nii )
40
+
41
+ ADD_TEST(nifti_nim_check ${NT} -check_nim -infiles ${DATA}/anat0.nii )
42
+
43
+ ADD_TEST(nifti_dsets_test
44
+ sh ${TESTS}/dsets_test.sh ${NT} ${DATA} )
45
+
46
+ ADD_TEST(nifti_newfiles_test
47
+ sh ${TESTS}/newfiles_test.sh ${NT} ${DATA} )
@@ -0,0 +1,32 @@
1
+
2
+ # - copy some of the sub-bricks of the default stat file,
3
+ # storing the history (command), and writing to a new 'f4.nii'
4
+ # - compare these nifti_image structs
5
+
6
+ if [ $# -lt 2 ]
7
+ then
8
+ echo Missing nifti tool and Binary directory name
9
+ exit 1
10
+ fi
11
+
12
+ NT=$1
13
+ DATA=$2
14
+
15
+ rm -fr ${DATA}/f4*
16
+
17
+ if ${NT} -keep_hist -cbl -infiles ${DATA}/stat0.nii'[178..$,0,1]' -prefix ${DATA}/f4
18
+ then
19
+ echo ""
20
+ else
21
+ echo "copy sub-bricks failed"
22
+ fi
23
+
24
+ if ${NT} -diff_nim -infiles ${DATA}/stat0.nii ${DATA}/f4.nii
25
+ then
26
+ echo diff failed '(no diffs found'
27
+ exit 1
28
+ else
29
+ echo diff succeeded
30
+ fi
31
+
32
+ exit 0