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.
- 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,18 @@
|
|
|
1
|
+
[Setup]
|
|
2
|
+
Version=__major_version__
|
|
3
|
+
AppName=nifticlib
|
|
4
|
+
AppVersion=__full_version__
|
|
5
|
+
AppVerName=nifticlib __full_version__
|
|
6
|
+
MenuName=nifticlib
|
|
7
|
+
Description=Niftilib is a set of i/o libraries for reading and writing files in the NIfTI-1 data format. NIfTI-1 is a binary file format for storing medical image data, e.g. magnetic resonance image (MRI) and functional MRI (fMRI) brain images.
|
|
8
|
+
Url=http://niftilib.sourceforge.net/
|
|
9
|
+
License=LICENSE
|
|
10
|
+
Readme=README
|
|
11
|
+
|
|
12
|
+
[Files]
|
|
13
|
+
bin=<app>\bin\
|
|
14
|
+
include=<app>\include\
|
|
15
|
+
lib=<app>\lib\
|
|
16
|
+
|
|
17
|
+
[Icons]
|
|
18
|
+
Website=http://niftilib.sourceforge.net
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Name: nifticlib
|
|
2
|
+
Summary: Niftilib C library
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Release: 1
|
|
5
|
+
License: Public Domain
|
|
6
|
+
Group: Applications/Scientific
|
|
7
|
+
Source: %{name}-%{version}.tar.gz
|
|
8
|
+
#Patch1: nifticlib.patch
|
|
9
|
+
URL: http://niftilib.sourceforge.net/
|
|
10
|
+
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
|
11
|
+
Packager: Andy Loening <loening at alum dot mit dot edu>
|
|
12
|
+
#Requires: openssl
|
|
13
|
+
BuildRequires: cmake
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
%description
|
|
17
|
+
Nifticlib is a set of C i/o libraries for reading and writing files in
|
|
18
|
+
the nifti-1 data format. nifti-1 is a binary file format for storing
|
|
19
|
+
medical image data, e.g. magnetic resonance image (MRI) and functional
|
|
20
|
+
MRI (fMRI) brain images.
|
|
21
|
+
|
|
22
|
+
%package devel
|
|
23
|
+
Summary: static libraries and header files for nifticlib development
|
|
24
|
+
Group: Development/Libraries
|
|
25
|
+
Requires: nifticlib = %{version}
|
|
26
|
+
|
|
27
|
+
%description devel
|
|
28
|
+
|
|
29
|
+
The nifticlib-devel package contains the header files and static libraries
|
|
30
|
+
necessary for developing programs that make use of the nifticlib library.
|
|
31
|
+
|
|
32
|
+
%prep
|
|
33
|
+
%setup -q
|
|
34
|
+
|
|
35
|
+
%build
|
|
36
|
+
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix} -DNIFTI_INSTALL_INCLUDE_DIR=%{_prefix}/include/nifti .
|
|
37
|
+
make
|
|
38
|
+
|
|
39
|
+
%install
|
|
40
|
+
rm -rf $RPM_BUILD_ROOT
|
|
41
|
+
make install DESTDIR=$RPM_BUILD_ROOT
|
|
42
|
+
|
|
43
|
+
## hack to get this to work for x86_64
|
|
44
|
+
%if "%{?_lib}" == "lib64"
|
|
45
|
+
mv $RPM_BUILD_ROOT/usr/lib $RPM_BUILD_ROOT/%{_libdir}
|
|
46
|
+
%endif
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
%clean
|
|
50
|
+
rm -rf $RPM_BUILD_ROOT
|
|
51
|
+
|
|
52
|
+
%files
|
|
53
|
+
%defattr(-,root,root)
|
|
54
|
+
%doc README
|
|
55
|
+
%{_libdir}/*
|
|
56
|
+
#%{_datadir}/doc/*
|
|
57
|
+
|
|
58
|
+
%files devel
|
|
59
|
+
%defattr(-,root,root)
|
|
60
|
+
%{_bindir}/*
|
|
61
|
+
%{_includedir}/*
|
|
62
|
+
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/*********************************************************************
|
|
2
|
+
*
|
|
3
|
+
* Very simple code snippets to read/write nifti1 files
|
|
4
|
+
* This code is placed in the public domain.
|
|
5
|
+
*
|
|
6
|
+
* If you are the type who doesn't want to use a file format unless
|
|
7
|
+
* you can write your own i/o code in less than 30minutes, this
|
|
8
|
+
* example is for you.
|
|
9
|
+
*
|
|
10
|
+
* This code does not deal with wrong-endian data, compressed data,
|
|
11
|
+
* the new qform/sform orientation codes, parsing filenames, volume-
|
|
12
|
+
* wise or timecourse-wise data access or any of a million other very useful
|
|
13
|
+
* things that are in the niftilib i/o reference libraries.
|
|
14
|
+
* We encourage people to use the niftilib reference library and send
|
|
15
|
+
* feedback/suggestions, see http://niftilib.sourceforge.net/
|
|
16
|
+
* But, if that is too much to tackle and you just want to jump in, this
|
|
17
|
+
* code is a starting point.
|
|
18
|
+
* This code was written for maximum readability, not for the greatest
|
|
19
|
+
* coding style.
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
* If you are already a little familiar with reading/writing Analyze
|
|
23
|
+
* files of some flavor, and maybe even have some of your own code, here
|
|
24
|
+
* are the most important things to be aware of in transitioning to nifti1:
|
|
25
|
+
*
|
|
26
|
+
* 1. nii vs .hdr/.img
|
|
27
|
+
* nifti1 datasets can be stored either in .hdr/.img pairs of files
|
|
28
|
+
* or in 1 .nii file. In a .nii file the data will start at the byte
|
|
29
|
+
* specified by the vox_offset field, which will be 352 if no extensions
|
|
30
|
+
* have been added. And, nifti1 really does like that magic field set
|
|
31
|
+
* to "n+1" for .nii and "ni1" for .img/.hdr
|
|
32
|
+
*
|
|
33
|
+
* 2. scaling
|
|
34
|
+
* nifti1 datasets can contain a scaling factor. You need to check the
|
|
35
|
+
* scl_slope field and if that isn't 0, scale your data by
|
|
36
|
+
* Y * scl_slope + scl_inter
|
|
37
|
+
*
|
|
38
|
+
* 3. extensions
|
|
39
|
+
* nifti1 datasets can have some "extension data" stuffed after the
|
|
40
|
+
* regular header. You can just ignore it, but, be aware that a
|
|
41
|
+
* .hdr file may be longer than 348 bytes, and, in a .nii file
|
|
42
|
+
* you can't just jump to byte 352, you need to use the vox_offset
|
|
43
|
+
* field to get the start of the image data.
|
|
44
|
+
*
|
|
45
|
+
* 4. new datatypes
|
|
46
|
+
* nifti1 added a few new datatypes that were not in the Analyze 7.5
|
|
47
|
+
* format from which nifti1 is derived. If you're just working with
|
|
48
|
+
* your own data this is not an issue but if you get a foreign nifti1
|
|
49
|
+
* file, be aware of exotic datatypes like DT_COMPLEX256 and mundane
|
|
50
|
+
* things like DT_UINT16.
|
|
51
|
+
*
|
|
52
|
+
* 5. other stuff
|
|
53
|
+
* nifti1 really does like the dim[0] field set to the number of
|
|
54
|
+
* dimensions of the dataset. Other Analyze flavors might not
|
|
55
|
+
* have been so scrupulous about that.
|
|
56
|
+
* nifti1 has a bunch of other new fields such as intent codes,
|
|
57
|
+
* qform/sform, etc. but, if you just want to get your hands on
|
|
58
|
+
* the data blob you can ignore these. Example use of these fields
|
|
59
|
+
* is in the niftilib reference libraries.
|
|
60
|
+
*
|
|
61
|
+
*
|
|
62
|
+
*
|
|
63
|
+
* To compile:
|
|
64
|
+
* You need to put a copy of the nifti1.h header file in this directory.
|
|
65
|
+
* It can be obtained from the NIFTI homepage http://nifti.nimh.nih.gov/
|
|
66
|
+
* or from the niftilib SourceForge site http://niftilib.sourceforge.net/
|
|
67
|
+
*
|
|
68
|
+
* cc -o nifti1_read_write nifti1_read_write.c
|
|
69
|
+
*
|
|
70
|
+
*
|
|
71
|
+
* To run:
|
|
72
|
+
* nifti1_read_write -w abc.nii abc.nii
|
|
73
|
+
* nifti1_read_write -r abc.nii abc.nii
|
|
74
|
+
*
|
|
75
|
+
*
|
|
76
|
+
* The read method is hardcoded to read float32 data. To change
|
|
77
|
+
* to your datatype, just change the line:
|
|
78
|
+
* typedef float MY_DATATYPE;
|
|
79
|
+
*
|
|
80
|
+
* The write method is hardcoded to write float32 data. To change
|
|
81
|
+
* to your datatype, change the line:
|
|
82
|
+
* typedef float MY_DATATYPE;
|
|
83
|
+
* and change the lines:
|
|
84
|
+
* hdr.datatype = NIFTI_TYPE_FLOAT32;
|
|
85
|
+
* hdr.bitpix = 32;
|
|
86
|
+
*
|
|
87
|
+
*
|
|
88
|
+
* Written by Kate Fissell, University of Pittsburgh, May 2005.
|
|
89
|
+
*
|
|
90
|
+
*********************************************************************/
|
|
91
|
+
|
|
92
|
+
#include <stdio.h>
|
|
93
|
+
#include <stdlib.h>
|
|
94
|
+
#include <string.h>
|
|
95
|
+
#include "nifti1.h"
|
|
96
|
+
|
|
97
|
+
typedef float MY_DATATYPE;
|
|
98
|
+
|
|
99
|
+
#define MIN_HEADER_SIZE 348
|
|
100
|
+
#define NII_HEADER_SIZE 352
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
main(argc,argv)
|
|
104
|
+
int argc;
|
|
105
|
+
char *argv[];
|
|
106
|
+
{
|
|
107
|
+
|
|
108
|
+
char *hdr_file, *data_file;
|
|
109
|
+
short do_read=0;
|
|
110
|
+
short do_write=0;
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/********** process commandline parameters */
|
|
114
|
+
if (argc != 4) {
|
|
115
|
+
fprintf(stderr, "\nUsage: %s <-r|-w> <header file> <data file>\n",argv[0]);
|
|
116
|
+
exit(1);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!strncmp(argv[1],"-r",2))
|
|
120
|
+
do_read=1;
|
|
121
|
+
else if (!strncmp(argv[1],"-w",2))
|
|
122
|
+
do_write=1;
|
|
123
|
+
else {
|
|
124
|
+
fprintf(stderr, "\nUsage: %s <-r|-w> <header file> <data file>\n",argv[0]);
|
|
125
|
+
exit(1);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
hdr_file = argv[2];
|
|
129
|
+
data_file = argv[3];
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/********** do the simple read or write */
|
|
134
|
+
if (do_read)
|
|
135
|
+
read_nifti_file(hdr_file, data_file);
|
|
136
|
+
else if (do_write)
|
|
137
|
+
write_nifti_file(hdr_file, data_file);
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
exit(0);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**********************************************************************
|
|
144
|
+
*
|
|
145
|
+
* read_nifti_file
|
|
146
|
+
*
|
|
147
|
+
**********************************************************************/
|
|
148
|
+
int read_nifti_file(hdr_file, data_file)
|
|
149
|
+
char *hdr_file, *data_file;
|
|
150
|
+
{
|
|
151
|
+
nifti_1_header hdr;
|
|
152
|
+
FILE *fp;
|
|
153
|
+
int ret,i;
|
|
154
|
+
double total;
|
|
155
|
+
MY_DATATYPE *data=NULL;
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
/********** open and read header */
|
|
159
|
+
fp = fopen(hdr_file,"r");
|
|
160
|
+
if (fp == NULL) {
|
|
161
|
+
fprintf(stderr, "\nError opening header file %s\n",hdr_file);
|
|
162
|
+
exit(1);
|
|
163
|
+
}
|
|
164
|
+
ret = fread(&hdr, MIN_HEADER_SIZE, 1, fp);
|
|
165
|
+
if (ret != 1) {
|
|
166
|
+
fprintf(stderr, "\nError reading header file %s\n",hdr_file);
|
|
167
|
+
exit(1);
|
|
168
|
+
}
|
|
169
|
+
fclose(fp);
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
/********** print a little header information */
|
|
173
|
+
fprintf(stderr, "\n%s header information:",hdr_file);
|
|
174
|
+
fprintf(stderr, "\nXYZT dimensions: %d %d %d %d",hdr.dim[1],hdr.dim[2],hdr.dim[3],hdr.dim[4]);
|
|
175
|
+
fprintf(stderr, "\nDatatype code and bits/pixel: %d %d",hdr.datatype,hdr.bitpix);
|
|
176
|
+
fprintf(stderr, "\nScaling slope and intercept: %.6f %.6f",hdr.scl_slope,hdr.scl_inter);
|
|
177
|
+
fprintf(stderr, "\nByte offset to data in datafile: %ld",(long)(hdr.vox_offset));
|
|
178
|
+
fprintf(stderr, "\n");
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
/********** open the datafile, jump to data offset */
|
|
182
|
+
fp = fopen(data_file,"r");
|
|
183
|
+
if (fp == NULL) {
|
|
184
|
+
fprintf(stderr, "\nError opening data file %s\n",data_file);
|
|
185
|
+
exit(1);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
ret = fseek(fp, (long)(hdr.vox_offset), SEEK_SET);
|
|
189
|
+
if (ret != 0) {
|
|
190
|
+
fprintf(stderr, "\nError doing fseek() to %ld in data file %s\n",(long)(hdr.vox_offset), data_file);
|
|
191
|
+
exit(1);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
/********** allocate buffer and read first 3D volume from data file */
|
|
196
|
+
data = (MY_DATATYPE *) malloc(sizeof(MY_DATATYPE) * hdr.dim[1]*hdr.dim[2]*hdr.dim[3]);
|
|
197
|
+
if (data == NULL) {
|
|
198
|
+
fprintf(stderr, "\nError allocating data buffer for %s\n",data_file);
|
|
199
|
+
exit(1);
|
|
200
|
+
}
|
|
201
|
+
ret = fread(data, sizeof(MY_DATATYPE), hdr.dim[1]*hdr.dim[2]*hdr.dim[3], fp);
|
|
202
|
+
if (ret != hdr.dim[1]*hdr.dim[2]*hdr.dim[3]) {
|
|
203
|
+
fprintf(stderr, "\nError reading volume 1 from %s (%d)\n",data_file,ret);
|
|
204
|
+
exit(1);
|
|
205
|
+
}
|
|
206
|
+
fclose(fp);
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
/********** scale the data buffer */
|
|
210
|
+
if (hdr.scl_slope != 0) {
|
|
211
|
+
for (i=0; i<hdr.dim[1]*hdr.dim[2]*hdr.dim[3]; i++)
|
|
212
|
+
data[i] = (data[i] * hdr.scl_slope) + hdr.scl_inter;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
/********** print mean of data */
|
|
217
|
+
total = 0;
|
|
218
|
+
for (i=0; i<hdr.dim[1]*hdr.dim[2]*hdr.dim[3]; i++)
|
|
219
|
+
total += data[i];
|
|
220
|
+
total /= (hdr.dim[1]*hdr.dim[2]*hdr.dim[3]);
|
|
221
|
+
fprintf(stderr, "\nMean of volume 1 in %s is %.3f\n",data_file,total);
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
return(0);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
/**********************************************************************
|
|
229
|
+
*
|
|
230
|
+
* write_nifti_file
|
|
231
|
+
*
|
|
232
|
+
* write a sample nifti1 (.nii) data file
|
|
233
|
+
* datatype is float32
|
|
234
|
+
* XYZT size is 64x64x16x10
|
|
235
|
+
* XYZ voxel size is 1mm
|
|
236
|
+
* TR is 1500ms
|
|
237
|
+
*
|
|
238
|
+
**********************************************************************/
|
|
239
|
+
int write_nifti_file(hdr_file, data_file)
|
|
240
|
+
char *hdr_file, *data_file;
|
|
241
|
+
{
|
|
242
|
+
nifti_1_header hdr;
|
|
243
|
+
nifti1_extender pad={0,0,0,0};
|
|
244
|
+
FILE *fp;
|
|
245
|
+
int ret,i;
|
|
246
|
+
MY_DATATYPE *data=NULL;
|
|
247
|
+
short do_nii;
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
/********** make sure user specified .hdr/.img or .nii/.nii */
|
|
251
|
+
if ( (strlen(hdr_file) < 4) || (strlen(data_file) < 4) ) {
|
|
252
|
+
fprintf(stderr, "\nError: write files must end with .hdr/.img or .nii/.nii extension\n");
|
|
253
|
+
exit(1);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if ( (!strncmp(hdr_file+(strlen(hdr_file)-4), ".hdr",4)) &&
|
|
257
|
+
(!strncmp(data_file+(strlen(data_file)-4), ".img",4)) ) {
|
|
258
|
+
do_nii = 0;
|
|
259
|
+
}
|
|
260
|
+
else if ( (!strncmp(hdr_file+(strlen(hdr_file)-4), ".nii",4)) &&
|
|
261
|
+
(!strncmp(data_file+(strlen(data_file)-4), ".nii",4)) ) {
|
|
262
|
+
do_nii = 1;
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
fprintf(stderr, "\nError: file(s) to be written must end with .hdr/.img or .nii/.nii extension\n");
|
|
266
|
+
exit(1);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
/********** fill in the minimal default header fields */
|
|
271
|
+
bzero((void *)&hdr, sizeof(hdr));
|
|
272
|
+
hdr.sizeof_hdr = MIN_HEADER_SIZE;
|
|
273
|
+
hdr.dim[0] = 4;
|
|
274
|
+
hdr.dim[1] = 64;
|
|
275
|
+
hdr.dim[2] = 64;
|
|
276
|
+
hdr.dim[3] = 16;
|
|
277
|
+
hdr.dim[4] = 10;
|
|
278
|
+
hdr.datatype = NIFTI_TYPE_FLOAT32;
|
|
279
|
+
hdr.bitpix = 32;
|
|
280
|
+
hdr.pixdim[1] = 1.0;
|
|
281
|
+
hdr.pixdim[2] = 1.0;
|
|
282
|
+
hdr.pixdim[3] = 1.0;
|
|
283
|
+
hdr.pixdim[4] = 1.5;
|
|
284
|
+
if (do_nii)
|
|
285
|
+
hdr.vox_offset = (float) NII_HEADER_SIZE;
|
|
286
|
+
else
|
|
287
|
+
hdr.vox_offset = (float)0;
|
|
288
|
+
hdr.scl_slope = 100.0;
|
|
289
|
+
hdr.xyzt_units = NIFTI_UNITS_MM | NIFTI_UNITS_SEC;
|
|
290
|
+
if (do_nii)
|
|
291
|
+
strncpy(hdr.magic, "n+1\0", 4);
|
|
292
|
+
else
|
|
293
|
+
strncpy(hdr.magic, "ni1\0", 4);
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
/********** allocate buffer and fill with dummy data */
|
|
297
|
+
data = (MY_DATATYPE *) malloc(sizeof(MY_DATATYPE) * hdr.dim[1]*hdr.dim[2]*hdr.dim[3]*hdr.dim[4]);
|
|
298
|
+
if (data == NULL) {
|
|
299
|
+
fprintf(stderr, "\nError allocating data buffer for %s\n",data_file);
|
|
300
|
+
exit(1);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
for (i=0; i<hdr.dim[1]*hdr.dim[2]*hdr.dim[3]*hdr.dim[4]; i++)
|
|
304
|
+
data[i] = i / hdr.scl_slope;
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
/********** write first 348 bytes of header */
|
|
308
|
+
fp = fopen(hdr_file,"w");
|
|
309
|
+
if (fp == NULL) {
|
|
310
|
+
fprintf(stderr, "\nError opening header file %s for write\n",hdr_file);
|
|
311
|
+
exit(1);
|
|
312
|
+
}
|
|
313
|
+
ret = fwrite(&hdr, MIN_HEADER_SIZE, 1, fp);
|
|
314
|
+
if (ret != 1) {
|
|
315
|
+
fprintf(stderr, "\nError writing header file %s\n",hdr_file);
|
|
316
|
+
exit(1);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
/********** if nii, write extender pad and image data */
|
|
321
|
+
if (do_nii == 1) {
|
|
322
|
+
|
|
323
|
+
ret = fwrite(&pad, 4, 1, fp);
|
|
324
|
+
if (ret != 1) {
|
|
325
|
+
fprintf(stderr, "\nError writing header file extension pad %s\n",hdr_file);
|
|
326
|
+
exit(1);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
ret = fwrite(data, (size_t)(hdr.bitpix/8), hdr.dim[1]*hdr.dim[2]*hdr.dim[3]*hdr.dim[4], fp);
|
|
330
|
+
if (ret != hdr.dim[1]*hdr.dim[2]*hdr.dim[3]*hdr.dim[4]) {
|
|
331
|
+
fprintf(stderr, "\nError writing data to %s\n",hdr_file);
|
|
332
|
+
exit(1);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
fclose(fp);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
/********** if hdr/img, close .hdr and write image data to .img */
|
|
340
|
+
else {
|
|
341
|
+
|
|
342
|
+
fclose(fp); /* close .hdr file */
|
|
343
|
+
|
|
344
|
+
fp = fopen(data_file,"w");
|
|
345
|
+
if (fp == NULL) {
|
|
346
|
+
fprintf(stderr, "\nError opening data file %s for write\n",data_file);
|
|
347
|
+
exit(1);
|
|
348
|
+
}
|
|
349
|
+
ret = fwrite(data, (size_t)(hdr.bitpix/8), hdr.dim[1]*hdr.dim[2]*hdr.dim[3]*hdr.dim[4], fp);
|
|
350
|
+
if (ret != hdr.dim[1]*hdr.dim[2]*hdr.dim[3]*hdr.dim[4]) {
|
|
351
|
+
fprintf(stderr, "\nError writing data to %s\n",data_file);
|
|
352
|
+
exit(1);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
fclose(fp);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
return(0);
|
|
361
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#File Generated by Hans J. Johnson
|
|
2
|
+
#Please contact hans-johnson@uiowa.edu for making enhancments/corrections
|
|
3
|
+
PROJECT(NIFTIUTILS)
|
|
4
|
+
|
|
5
|
+
INCLUDE_DIRECTORIES(${NIFTILIB_SOURCE_DIR} ${ZNZLIB_SOURCE_DIR} ${NIFTICDFLIB_SOURCE_DIR})
|
|
6
|
+
|
|
7
|
+
ADD_EXECUTABLE(${PACKAGE_PREFIX}nifti_stats nifti_stats.c)
|
|
8
|
+
ADD_EXECUTABLE(${PACKAGE_PREFIX}nifti_tool nifti_tool.c)
|
|
9
|
+
ADD_EXECUTABLE(${PACKAGE_PREFIX}nifti1_test nifti1_test.c)
|
|
10
|
+
TARGET_LINK_LIBRARIES( nifti_stats ${PACKAGE_PREFIX}niftiio ${PACKAGE_PREFIX}nifticdf)
|
|
11
|
+
TARGET_LINK_LIBRARIES( nifti_tool ${PACKAGE_PREFIX}niftiio)
|
|
12
|
+
TARGET_LINK_LIBRARIES( nifti1_test ${PACKAGE_PREFIX}niftiio)
|
|
13
|
+
|
|
14
|
+
IF(NOT NIFTI_INSTALL_NO_DEVELOPMENT)
|
|
15
|
+
INSTALL(TARGETS ${PACKAGE_PREFIX}nifti_stats ${PACKAGE_PREFIX}nifti_tool ${PACKAGE_PREFIX}nifti1_test
|
|
16
|
+
RUNTIME DESTINATION ${NIFTI_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries
|
|
17
|
+
LIBRARY DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries
|
|
18
|
+
ARCHIVE DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT Development)
|
|
19
|
+
ENDIF(NOT NIFTI_INSTALL_NO_DEVELOPMENT)
|
|
20
|
+
|
|
21
|
+
IF(NOT NIFTI_INSTALL_NO_DEVELOPMENT)
|
|
22
|
+
FILE(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
|
|
23
|
+
INSTALL(FILES ${__files}
|
|
24
|
+
DESTINATION ${NIFTI_INSTALL_INCLUDE_DIR} COMPONENT Development)
|
|
25
|
+
ENDIF(NOT NIFTI_INSTALL_NO_DEVELOPMENT)
|
|
26
|
+
|
|
27
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti1_test_help ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti1_test)
|
|
28
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti1_test_n1 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti1_test -n1 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTIUTILS_BINARY_DIR}/n1 )
|
|
29
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti1_test_n2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti1_test -n2 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTIUTILS_BINARY_DIR}/n2 )
|
|
30
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti1_test_a2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti1_test -a2 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTIUTILS_BINARY_DIR}/a2 )
|
|
31
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti1_test_zn1 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti1_test -zn1 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTIUTILS_BINARY_DIR}/zn1 )
|
|
32
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti1_test_zn2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti1_test -zn2 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTIUTILS_BINARY_DIR}/zn2 )
|
|
33
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti1_test_za2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti1_test -za2 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTIUTILS_BINARY_DIR}/za2 )
|
|
34
|
+
|
|
35
|
+
#The help screens always return 1; ADD_TEST(${PACKAGE_PREFIX}nifti_tool_help ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool)
|
|
36
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_n1 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/n1 )
|
|
37
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_n2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/n2 )
|
|
38
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_a2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/a2 )
|
|
39
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_zn1 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/zn1 )
|
|
40
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_zn2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/zn2 )
|
|
41
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_za2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/za2 )
|
|
42
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_diff_hdr ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -diff_hdr -infile ${NIFTIUTILS_BINARY_DIR}/zn1 ${NIFTIUTILS_BINARY_DIR}/zn1 )
|
|
43
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_diff_nims ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -diff_nim -infile ${NIFTIUTILS_BINARY_DIR}/zn1 ${NIFTIUTILS_BINARY_DIR}/zn1 )
|
|
44
|
+
|
|
45
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_copy_brick_list ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -cbl -prefix cbl_zn1.nii -infile ${NIFTIUTILS_BINARY_DIR}/zn1.nii.gz[0,1])
|
|
46
|
+
#ADD_TEST(${PACKAGE_PREFIX}nifti_tool_copy_collapsed_image /bin/sh ${NIFTI_SOURCE_DIR}/utils/rmthenrun cci_zn1.nii ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -cci 2 2 2 -1 -1 -1 -1 -prefix cci_zn1.nii -infile ${NIFTIUTILS_BINARY_DIR}/zn1.nii.gz )
|
|
47
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_disp_ci ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_ci 2 2 2 -1 0 0 0 -infile ${NIFTIUTILS_BINARY_DIR}/zn1.nii.gz )
|
|
48
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_disp_ts ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_ts 2 2 2 -infile ${NIFTIUTILS_BINARY_DIR}/zn1.nii.gz )
|
|
49
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_strip_extras ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -strip_extras -infile ${NIFTIUTILS_BINARY_DIR}/zn1.nii.gz )
|
|
50
|
+
|
|
51
|
+
# This test needs a file that has extensions to remove
|
|
52
|
+
#ADD_TEST(${PACKAGE_PREFIX}nifti_tool_rm_ext /bin/sh ${NIFTI_SOURCE_DIR}/utils/rmthenrun rm_ext.nii ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -rm_ext ALL -prefix rm_ext.nii -infile ${NIFTIUTILS_BINARY_DIR}/zn1.nii.gz )
|
|
53
|
+
|
|
54
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_check_hdr ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -check_hdr -infile ${NIFTIUTILS_BINARY_DIR}/za2 )
|
|
55
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_tool_check_nim ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -check_nim -infile ${NIFTIUTILS_BINARY_DIR}/za2 )
|
|
56
|
+
|
|
57
|
+
FOREACH(DISTRIBUTION CORREL TTEST FTEST ZSCORE CHISQ BETA BINOM GAMMA POISSON NORMAL FTEST_NONC CHISQ_NONC LOGISTIC LAPLACE UNIFORM TTEST_NONC WEIBULL CHI INVGAUSS EXTVAL PVAL LOGPVAL LOG10PVAL )
|
|
58
|
+
ADD_TEST(${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats 0:4:1 ${DISTRIBUTION})
|
|
59
|
+
ADD_TEST(q${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -q 0:4:1 ${DISTRIBUTION})
|
|
60
|
+
ADD_TEST(q1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -q 0:4:1 ${DISTRIBUTION} 1 1 1)
|
|
61
|
+
ADD_TEST(d${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -d 0:4:1 ${DISTRIBUTION})
|
|
62
|
+
ADD_TEST(d1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -d 0:4:1 ${DISTRIBUTION} 1 1 1)
|
|
63
|
+
ADD_TEST(1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -1 0:4:1 ${DISTRIBUTION})
|
|
64
|
+
ADD_TEST(11${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -1 0:4:1 ${DISTRIBUTION} 1 1 1)
|
|
65
|
+
ADD_TEST(z${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -z 0:4:1 ${DISTRIBUTION})
|
|
66
|
+
ADD_TEST(z1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -z 0:4:1 ${DISTRIBUTION} 1 1 1)
|
|
67
|
+
ADD_TEST(h${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -h 0:4:1 ${DISTRIBUTION})
|
|
68
|
+
ADD_TEST(h1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -h 0:4:1 ${DISTRIBUTION} 1 1 1)
|
|
69
|
+
ENDFOREACH(DISTRIBUTION)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|