c_nifti 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,65 @@
1
+ #!/bin/sh
2
+
3
+ if [ $# -lt 2 ]
4
+ then
5
+ echo Missing nifti tool and Binary directory name
6
+ exit 1
7
+ fi
8
+
9
+ NT=$1
10
+ DATA=$2
11
+
12
+
13
+ # add some comment and afni extensions, then display them
14
+ if \
15
+ ${NT} -keep_hist -prefix ${DATA}/f4.comment -infiles ${DATA}/anat0.nii \
16
+ -add_comment '4 slice time series' \
17
+ -add_afni_ext 'and an AFNI extension' \
18
+ -add_comment 'how about a question AND a comment?'
19
+ then
20
+ echo ""
21
+ else
22
+ echo "add comment failed"
23
+ exit 1
24
+ fi
25
+
26
+ if ${NT} -disp_ext -infiles ${DATA}/f4.comment.nii
27
+ then
28
+ echo ""
29
+ else
30
+ echo "failed"
31
+ exit 1
32
+ fi
33
+
34
+ if ${NT} -cbl -infiles ${DATA}/f4.comment.nii -prefix ${DATA}/f4.to.clear.nii
35
+ then
36
+ echo ""
37
+ else
38
+ echo "failed"
39
+ exit 1
40
+ fi
41
+
42
+ if ${NT} -overwrite -strip -infiles ${DATA}/f4.to.clear.nii
43
+ then
44
+ echo ""
45
+ else
46
+ echo "failed"
47
+ exit 1
48
+ fi
49
+
50
+ if ${NT} -disp_ext -infiles ${DATA}/f4.to.clear.nii
51
+ then
52
+ echo ""
53
+ else
54
+ echo "failed"
55
+ exit 1
56
+ fi
57
+
58
+ if ${NT} -diff_nim -infiles ${DATA}/f4.comment.nii ${DATA}/f4.to.clear.nii
59
+ then
60
+ echo "failed -- no changes found"
61
+ exit 1
62
+ else
63
+ echo "diff succeed -- found changes"
64
+ fi
65
+
@@ -0,0 +1,46 @@
1
+ #!/bin/sh
2
+
3
+ if [ $# -lt 2 ]
4
+ then
5
+ echo Missing nifti tool and Binary directory name
6
+ exit 1
7
+ fi
8
+
9
+ NT=$1
10
+ DATA=$2
11
+
12
+ # get the time series for a slice, get the same sub-bricks,
13
+ # compare nifti_images, and display the time series again
14
+ #
15
+ # this should match the previous
16
+
17
+ ${NT} -keep_hist -cci 3 3 3 -1 -1 -1 -1 -prefix ${DATA}/r.333 -infiles ${DATA}/run.210.nii
18
+ if [ $? -ne 0 ] ; then
19
+ echo cci failed
20
+ fi
21
+
22
+ ${NT} -keep_hist -cci 3 3 3 -1 1 1 1 -prefix ${DATA}/r.333.111 -infiles ${DATA}/run.210.nii
23
+ if [ $? -ne 0 ] ; then
24
+ echo cci failed
25
+ fi
26
+
27
+ ${NT} -disp_ci -1 -1 -1 -1 -1 -1 -1 -infiles ${DATA}/r.333.111.nii -quiet \
28
+ | tee o.10a.dci.1
29
+ if [ $? -ne 0 ] ; then
30
+ echo disp_ci failed
31
+ fi
32
+
33
+ ${NT} -disp_ci 0 0 0 -1 1 1 1 -infiles ${DATA}/r.333.nii -quiet \
34
+ | tee o.10a.dci.2
35
+ if [ $? -ne 0 ] ; then
36
+ echo disp_ci failed
37
+ fi
38
+
39
+ if diff o.10a.dci.?
40
+ then
41
+ echo ""
42
+ rm -f o.10a.dci* ${DATA}/r.333*
43
+ else
44
+ echo '** failure, o.10a.dci timeseries files differ'
45
+ exit 1
46
+ fi
@@ -0,0 +1,61 @@
1
+ #!/bin/sh
2
+
3
+ if [ $# -lt 2 ]
4
+ then
5
+ echo Missing nifti tool and Binary directory name
6
+ exit 1
7
+ fi
8
+
9
+ NT=$1
10
+ DATA=$2
11
+
12
+
13
+ # - create datasets out of nothing
14
+ #
15
+ # - modify some fields and compare against other datasets
16
+ rm -f ${DATA}/new_epi.nii
17
+ # just test a basic make im, mostly to capture the debug output
18
+ ${NT} -make_im -debug 3 -new_dim 4 64 64 21 180 0 0 0 -prefix ${DATA}/new_epi.nii
19
+ if [ $? -ne 0 ] ; then
20
+ echo failed
21
+ exit 1
22
+ fi
23
+
24
+ # compare hdr and nim in a fresh image to the existing one
25
+ ${NT} -diff_hdr -new_dim 4 64 64 21 180 0 0 0 \
26
+ -infiles MAKE_IM ${DATA}/stat0.nii
27
+ if [ $? = 0 ] ; then
28
+ echo unexpected 0 return code in diff
29
+ exit 1
30
+ fi
31
+
32
+ ${NT} -diff_nim -new_dim 4 64 64 21 180 0 0 0 \
33
+ -infiles MAKE_IM ${DATA}/stat0.nii
34
+ if [ $? = 0 ] ; then
35
+ echo unexpected 0 return code in diff
36
+ exit 1
37
+ fi
38
+
39
+
40
+ rm -f ${DATA}/epi_180_pixdim.nii
41
+
42
+ # clean up the nim by adjusting pixdim (from empty MAKE_IM)
43
+ ${NT} -mod_hdr -new_dim 4 64 64 21 180 0 0 0 \
44
+ -mod_field pixdim '0.0 4.0 4.0 6.0 3.0 1.0 1.0 1.0' \
45
+ -prefix ${DATA}/epi_180_pixdim.nii -infiles MAKE_IM
46
+ if [ $? -ne 0 ] ; then
47
+ echo mod_hdr failed
48
+ exit 1
49
+ fi
50
+
51
+
52
+ # and compare again
53
+ ${NT} -diff_nim -infiles ${DATA}/stat0.nii ${DATA}/epi_180_pixdim.nii
54
+ if [ $? -ne 0 ] ; then
55
+ echo found changes -- success.
56
+ else
57
+ echo diff failed to find differences.
58
+ exit 1
59
+ fi
60
+
61
+ exit 0
@@ -0,0 +1,75 @@
1
+ #!/bin/sh
2
+
3
+ if [ $# -lt 2 ]
4
+ then
5
+ echo Missing nifti tool and Binary directory name
6
+ exit 1
7
+ fi
8
+
9
+ NT=$1
10
+ DATA=$2
11
+
12
+ ${NT} -quiet -disp_ts 19 36 11 -infiles ${DATA}/stat0.nii | tee o.08.ts.19.36.11
13
+
14
+ if [ $? -ne 0 ] ; then
15
+ echo disp_ts failed
16
+ exit 1
17
+ fi
18
+ rm -f o.08.ts.19.36.11
19
+
20
+ ${NT} -quiet -disp_ts 19 36 11 -infiles ${DATA}/stat0.nii \
21
+ | awk '{print $(NF-1), $NF, $1, $2}' | tee o.09.ts4.1.awk
22
+
23
+ if [ $? -ne 0 ] ; then
24
+ echo disp_ts failed
25
+ exit 1
26
+ fi
27
+
28
+ ${NT} -quiet -disp_ts 19 36 11 -infiles ${DATA}/f4.nii | tee o.09.ts4.2.awk
29
+
30
+ if diff o.09.ts4.1.awk o.09.ts4.2.awk
31
+ then
32
+ echo ""
33
+ else
34
+ echo '** failure, ts4 files differ'
35
+ exit 1
36
+ fi
37
+ rm -f 0.09.ts4.1.awk o.09.ts4.2.awk ${DATA}/f4.nii
38
+ exit 0
39
+
40
+ # get the time series for a slice, get the same sub-bricks,
41
+ # compare nifti_images, and display the time series again
42
+ #
43
+ # this should match the previous
44
+
45
+ if ${NT} -keep_hist -cci 19 36 -1 -1 0 0 0 -prefix ${DATA}f.19.36 \
46
+ -infiles ${DATA}/stat0.nii
47
+ then
48
+ echo ""
49
+ else
50
+ echo cci failed
51
+ exit 1
52
+ fi
53
+
54
+ if ${NT} -keep_hist -cbl -prefix ${DATA}/f.19.36.t4.nii \
55
+ -infiles ${DATA}/f.19.36.nii'[178..$,0,1]'
56
+ then
57
+ echo ""
58
+ else
59
+ echo cbi failed
60
+ exit 0
61
+ fi
62
+
63
+ ${NT} -diff_nim -infiles ${DATA}/f.19.36.nii ${DATA}f.19.36.t4.nii | tee o.10.diff_nim
64
+ if [ $? -ne 0 ] ; then
65
+ echo f.19.36.nii and f.19.36.t4.nii differ
66
+ else
67
+ echo f.19.36.nii and f.19.36.t4.nii do not differ
68
+ fi
69
+
70
+ ${NT} -quiet -disp_ci 0 0 11 -1 0 0 0 -infiles f.19.36.t4.nii \
71
+ | tee o.10.dci.4
72
+ #diff o.09.ts4.1.awk o.10.dci.4
73
+ #if( $status ) echo '** failure, o.09 and o.10 ts files differ'
74
+
75
+ exit 0
@@ -0,0 +1,45 @@
1
+ #!/bin/sh
2
+ #
3
+ # arg[1] is TESTING_BINARY_DIR
4
+ if [ $# -lt 1 ]
5
+ then
6
+ echo Missing Binary directory name
7
+ exit 1
8
+ fi
9
+
10
+
11
+ if cd $1
12
+ then
13
+ echo working in `pwd`
14
+ else
15
+ echo can\'t cd to $1
16
+ exit 1
17
+ fi
18
+
19
+
20
+ if wget -nd http://nifti.nimh.nih.gov/pub/dist/data/nifti_regress_data.tgz
21
+ then
22
+ echo wget succeeded
23
+ else
24
+ echo wget failed
25
+ exit 1
26
+ fi
27
+
28
+ if tar xzvf nifti_regress_data.tgz
29
+ then
30
+ echo ""
31
+ else
32
+ echo failed tar xzvf nifti_regress_data.tgz
33
+ exit 1
34
+ fi
35
+
36
+ if rm -f nifti_regress_data.tgz
37
+ then
38
+ echo ""
39
+ else
40
+ echo can\'t remove ../nifti_regress_data.tgz
41
+ exit 1
42
+ fi
43
+
44
+ exit 0
45
+
@@ -0,0 +1,60 @@
1
+ #!/bin/sh
2
+
3
+ if [ $# -lt 2 ]
4
+ then
5
+ echo Missing nifti tool and Binary directory name
6
+ exit 1
7
+ fi
8
+
9
+ NT=$1
10
+ DATA=$2
11
+
12
+ rm -f ${DATA}/anat1*
13
+
14
+ if ${NT} -mod_hdr -prefix ${DATA}/anat1 \
15
+ -infiles ${DATA}/anat0.nii \
16
+ -mod_field qoffset_x -17.325 -mod_field slice_start 1 \
17
+ -mod_field descrip "beer, brats and cheese, mmmmm..."
18
+ then
19
+ echo ""
20
+ else
21
+ echo mod_field failed
22
+ exit 1
23
+ fi
24
+
25
+ if ${NT} -diff_hdr -infiles ${DATA}/anat0.nii ${DATA}/anat1.nii
26
+ then
27
+ echo diff_hdr failed '(no difference seen)!'
28
+ exit 1
29
+ else
30
+ echo ""
31
+ fi
32
+
33
+ if ${NT} -add_afni_ext "wow, my first extension" \
34
+ -add_afni_ext "look, my second.." \
35
+ -overwrite -infiles ${DATA}/anat1.nii
36
+ then
37
+ echo ""
38
+ else
39
+ echo add_afni_ext failed
40
+ exit 1
41
+ fi
42
+
43
+ if ${NT} -disp_exts -infiles ${DATA}/anat0.nii ${DATA}/anat1.nii
44
+ then
45
+ echo ""
46
+ else
47
+ echo disp_exts failed
48
+ exit 1
49
+ fi
50
+
51
+
52
+ if ${NT} -diff_hdr -infiles ${DATA}/anat0.nii ${DATA}/anat1.nii
53
+ then
54
+ echo diff_hdr failed '(no difference seen)!'
55
+ exit 1
56
+ else
57
+ echo ""
58
+ fi
59
+
60
+ exit 0
@@ -0,0 +1,36 @@
1
+ #!/bin/sh
2
+
3
+ if [ $# -lt 2 ]
4
+ then
5
+ echo Missing nifti tool and Binary directory name
6
+ exit 1
7
+ fi
8
+
9
+ NT=$1
10
+ DATA=$2
11
+
12
+ rm -f ${DATA}/new* ${DATA}/ncopy*
13
+
14
+ # test writing various output file types
15
+ ${NT} -make_im -prefix ${DATA}/new1.hdr
16
+ ${NT} -make_im -prefix ${DATA}/new2.hdr.gz
17
+ ${NT} -make_im -prefix ${DATA}/new3.img.gz
18
+ ${NT} -make_im -prefix ${DATA}/new4.nii.gz
19
+ ${NT} -make_im -prefix ${DATA}/new5.nia
20
+
21
+ # test reading them
22
+ ${NT} -copy_im -prefix ${DATA}/ncopy1.nii -infiles ${DATA}/new1.hdr
23
+ ${NT} -copy_im -prefix ${DATA}/ncopy2.nii -infiles ${DATA}/new2.hdr.gz
24
+ ${NT} -copy_im -prefix ${DATA}/ncopy3.nii -infiles ${DATA}/new3.img.gz
25
+ ${NT} -copy_im -prefix ${DATA}/ncopy4.nii -infiles ${DATA}/new4.nii.gz
26
+ ${NT} -copy_im -prefix ${DATA}/ncopy5.nii -infiles ${DATA}/new5.nia
27
+
28
+ # verify that they are all the same
29
+ set count = 0
30
+ for index in 2 3 4 5 ; do
31
+ diff ${DATA}/ncopy1.nii ${DATA}/ncopy$index.nii
32
+ if [ $? -ne 0 ] ; then
33
+ echo "-- failure on test index $index --"
34
+ exit 1
35
+ fi
36
+ done
@@ -0,0 +1,10 @@
1
+
2
+ # check the version numbers for the library and tool
3
+
4
+ nifti_tool -nifti_ver
5
+ nifti_tool -ver
6
+
7
+ # also, check whether the library was compiled with zlib support
8
+
9
+ nifti_tool -with_zlib
10
+
@@ -0,0 +1,5 @@
1
+
2
+ nifti_tool -help
3
+ nifti_tool -help_datatypes
4
+ nifti_tool -help_datatypes T
5
+
@@ -0,0 +1,5 @@
1
+
2
+ # library and tool history
3
+
4
+ nifti_tool -nifti_hist
5
+ nifti_tool -hist
@@ -0,0 +1,7 @@
1
+
2
+ # display header, nifti_image and extensions for default anat
3
+
4
+ nifti_tool -disp_hdr -infiles anat0
5
+ nifti_tool -disp_nim -infiles anat0
6
+ nifti_tool -disp_ana -infiles anat0
7
+ nifti_tool -disp_ext -infiles anat0
@@ -0,0 +1,9 @@
1
+
2
+ # modify the header of default anat, creating a new anat
3
+ #
4
+ # then compare the resulting headers
5
+
6
+ nifti_tool -mod_hdr -prefix anat1 -infiles anat0.nii \
7
+ -mod_field qoffset_x -17.325 -mod_field slice_start 1 \
8
+ -mod_field descrip 'beer, brats and cheese, mmmmm...'
9
+ nifti_tool -diff_hdr -infiles anat0.nii anat1.nii
@@ -0,0 +1,22 @@
1
+ #!/bin/tcsh
2
+
3
+ # - add junk extensions to the new anat, overwriting it
4
+ # - display extensions for the two files
5
+ # - again, compare the headers
6
+
7
+ nifti_tool -add_afni_ext 'wow, my first extension :)' \
8
+ -add_afni_ext 'look, my second..' \
9
+ -overwrite -infiles anat1.nii
10
+ nifti_tool -disp_exts -infiles anat0.nii anat1.nii
11
+ nifti_tool -diff_hdr -infiles anat0.nii anat1.nii
12
+
13
+ # add one more, via a file
14
+
15
+ cat > my.extension << EOF
16
+ here is some formatted
17
+ extension, added via
18
+ a text file
19
+ EOF
20
+
21
+ nifti_tool -add_comment_ext 'file:my.extension' -overwrite -infiles anat1.nii
22
+ nifti_tool -disp_exts -infiles anat1.nii