diff -Nru nifticlib-2.0.0/debian/changelog nifticlib-2.0.0/debian/changelog --- nifticlib-2.0.0/debian/changelog 2010-07-20 20:14:16.000000000 +0000 +++ nifticlib-2.0.0/debian/changelog 2014-10-06 07:29:54.000000000 +0000 @@ -1,3 +1,21 @@ +nifticlib (2.0.0-2) unstable; urgency=medium + + * The "I am not dead" release. General packaging updates, uncrufting, + and making lintian v2.5.27 be satisfied. + - Add all three patches commited to the upstream VCS since the 2.0.0 + release: e.g. improved memory management in case of IO errors. + * Update uploader's email address. + * Switch to debhelper compatibility level 9. + * Replace custom makefile logic with dpkg-buildflags. This + also enabled hardening features for compilation. + * Bumped Standards-version to 3.9.5. + * Removed obsolete DM-Upload tag. + * Replace embedded jquery.js with a proper package dependency. + * Rectify shell brace expansion in libnifti-dev.install. + * + + -- Michael Hanke Mon, 06 Oct 2014 07:59:50 +0200 + nifticlib (2.0.0-1) unstable; urgency=low * New release. Library changed API, hence bumped SO version to 2.0 diff -Nru nifticlib-2.0.0/debian/compat nifticlib-2.0.0/debian/compat --- nifticlib-2.0.0/debian/compat 2010-07-20 19:34:24.000000000 +0000 +++ nifticlib-2.0.0/debian/compat 2014-10-06 05:57:40.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru nifticlib-2.0.0/debian/control nifticlib-2.0.0/debian/control --- nifticlib-2.0.0/debian/control 2010-07-20 19:40:49.000000000 +0000 +++ nifticlib-2.0.0/debian/control 2014-10-06 06:06:35.000000000 +0000 @@ -1,14 +1,13 @@ Source: nifticlib Priority: optional Maintainer: NeuroDebian Team -Uploaders: Michael Hanke , Yaroslav Halchenko -Build-Depends: debhelper (>= 7.0.50~), cmake, zlib1g-dev, doxygen, python -Standards-Version: 3.9.0 +Uploaders: Michael Hanke , Yaroslav Halchenko +Build-Depends: debhelper (>= 9~), cmake, zlib1g-dev, doxygen, python +Standards-Version: 3.9.5 Section: libs Homepage: http://niftilib.sourceforge.net Vcs-Browser: http://git.debian.org/?p=pkg-exppsy/nifticlib.git Vcs-Git: git://git.debian.org/git/pkg-exppsy/nifticlib.git -XS-DM-Upload-Allowed: yes Package: libnifti2 @@ -59,7 +58,7 @@ Package: libnifti-doc Section: doc Architecture: all -Depends: ${misc:Depends} +Depends: ${misc:Depends}, libjs-jquery Description: NIfTI library API documentation 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 diff -Nru nifticlib-2.0.0/debian/libnifti-dev.install nifticlib-2.0.0/debian/libnifti-dev.install --- nifticlib-2.0.0/debian/libnifti-dev.install 2010-07-20 19:34:24.000000000 +0000 +++ nifticlib-2.0.0/debian/libnifti-dev.install 2014-10-06 06:17:35.000000000 +0000 @@ -1,3 +1,4 @@ usr/include/nifti -usr/lib/*.{so,a} +usr/lib/*.so +usr/lib/*.a diff -Nru nifticlib-2.0.0/debian/libnifti-doc.links nifticlib-2.0.0/debian/libnifti-doc.links --- nifticlib-2.0.0/debian/libnifti-doc.links 1970-01-01 00:00:00.000000000 +0000 +++ nifticlib-2.0.0/debian/libnifti-doc.links 2014-10-06 06:11:08.000000000 +0000 @@ -0,0 +1 @@ +/usr/share/javascript/jquery/jquery.js /usr/share/doc/libnifti-doc/html/jquery.js diff -Nru nifticlib-2.0.0/debian/patches/0001-ENH-Merged-ITK-and-official-nifti-branch-to-improve-.patch nifticlib-2.0.0/debian/patches/0001-ENH-Merged-ITK-and-official-nifti-branch-to-improve-.patch --- nifticlib-2.0.0/debian/patches/0001-ENH-Merged-ITK-and-official-nifti-branch-to-improve-.patch 1970-01-01 00:00:00.000000000 +0000 +++ nifticlib-2.0.0/debian/patches/0001-ENH-Merged-ITK-and-official-nifti-branch-to-improve-.patch 2014-10-06 07:15:39.000000000 +0000 @@ -0,0 +1,6142 @@ +From fc5cf7c05938a78cff51f13c39e4faa0e2450245 Mon Sep 17 00:00:00 2001 +From: hjmjohnson +Date: Thu, 25 Nov 2010 00:03:39 +0000 +Subject: [PATCH 1/3] ENH: Merged ITK and official nifti branch to improve + code compatibility across a large number of compilers by removing compiler + warnings for MSVS 6,7,8,9,10, Sun compilers, gcc 3,4 compilers, intel + compilers, 32bit and 64 bit versions. + +--- + CMakeLists.txt | 180 ++--- + CTestConfig.cmake | 4 +- + Makefile | 6 +- + Makefile.cross_mingw32 | 2 +- + README | 4 +- + Testing/CMakeLists.txt | 6 +- + Testing/nifti_regress_test/CMakeLists.txt | 67 +- + .../cmake_testscripts/fetch_data_test.sh | 14 +- + .../cmake_testscripts/newfiles_test.sh | 2 +- + Testing/nifti_regress_test/commands/c05.mod.hdr | 2 +- + Testing/nifti_regress_test/commands/c06.add.ext | 2 +- + Testing/nifti_regress_test/commands/c16.rand.swap | 1 - + Testing/nifti_regress_test/commands/c17.file.case | 1 - + Testing/niftilib/CMakeLists.txt | 14 +- + Testing/niftilib/nifti_test.c | 36 +- + Testing/niftilib/nifti_test2.c | 2 +- + Updates.txt | 8 +- + docs/Doxy_nifti.txt | 76 +-- + docs/Doxyfile.ORIG | 760 ++++++++++----------- + examples/CMakeLists.txt | 13 +- + examples/fsl_api_driver.c | 4 +- + fsliolib/CMakeLists.txt | 31 +- + fsliolib/dbh.h | 10 +- + fsliolib/fslio.c | 348 +++++----- + fsliolib/fslio.h | 34 +- + fsliolib/fslio.tcl | 10 +- + fsliolib/imcp | 36 +- + fsliolib/imglob | 8 +- + fsliolib/imln | 22 +- + fsliolib/immv | 36 +- + fsliolib/imrm | 6 +- + fsliolib/imtest | 6 +- + fsliolib/remove_ext | 6 +- + nifticdf/CMakeLists.txt | 31 +- + niftilib/CMakeLists.txt | 37 +- + niftilib/Makefile | 2 +- + niftilib/nifti1.h | 4 +- + niftilib/nifti1_io.c | 675 +++++++++--------- + niftilib/nifti1_io.h | 26 +- + packaging/nifticlib.spec | 2 +- + real_easy/nifti1_read_write.c | 20 +- + utils/CMakeLists.txt | 106 ++- + utils/nifti1_test.c | 2 +- + utils/nifti_tool.c | 42 +- + znzlib/CMakeLists.txt | 31 +- + znzlib/znzlib.c | 12 +- + znzlib/znzlib.h | 9 +- + 47 files changed, 1389 insertions(+), 1367 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9a241ac..66e310c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,15 +1,17 @@ + #File Generated by Hans J. Johnson + #Please contact hans-johnson@uiowa.edu for making enhancments/corrections +-PROJECT(NIFTI) +-# Configure Dart testing support. +-INCLUDE(${CMAKE_ROOT}/Modules/Dart.cmake) ++project(NIFTI) ++cmake_minimum_required(VERSION 2.6) ++if(COMMAND cmake_policy) ++ cmake_policy(SET CMP0003 NEW) ++endif(COMMAND cmake_policy) + +-SUBDIRS(znzlib niftilib) +-ADD_DEFINITIONS(-DHAVE_ZLIB) ++subdirs(znzlib niftilib) ++add_definitions(-DHAVE_ZLIB) + + # add option to build shared libraries. The default is OFF to maintain the + # current build behavior +-OPTION ( BUILD_SHARED_LIBS "Toggle building shared libraries") ++option( BUILD_SHARED_LIBS "Toggle building shared libraries") + + # Michael Hanke 2007-04-25 Note: + # 'Utilities' is merged into the include install path to be able to easily +@@ -17,120 +19,126 @@ OPTION ( BUILD_SHARED_LIBS "Toggle building shared libraries") + # include dir for standalone builds are only set if not yet defined. + + ### USE AS PART OF ITK +-IF("${ITK_VERSION_MAJOR}" GREATER 0.0) +-# MESSAGE(STATUS "---------------------ITK ZLIB ${ITK_ZLIB_LIBRARIES}") +- ADD_DEFINITIONS(-DHAVE_ZLIB) +- ADD_DEFINITIONS(-DITKZLIB) +- SET(PACKAGE_PREFIX "ITK") +- SET(NIFTI_LIBRARY_PROPERTIES ${ITK_LIBRARY_PROPERTIES}) +- SET(NIFTI_INSTALL_BIN_DIR "${ITK_INSTALL_BIN_DIR_CM24}") +- SET(NIFTI_INSTALL_LIB_DIR "${ITK_INSTALL_LIB_DIR_CM24}") +- SET(NIFTI_INSTALL_INCLUDE_DIR "${ITK_INSTALL_INCLUDE_DIR_CM24}/Utilities") +- SET(NIFTI_ZLIB_LIBRARIES ${ITK_ZLIB_LIBRARIES}) +- SET(NIFTI_INSTALL_NO_DEVELOPMENT ${ITK_INSTALL_NO_DEVELOPMENT}) +- SET(NIFTI_INSTALL_NO_LIBRARIES ${ITK_INSTALL_NO_LIBRARIES}) +- +-ELSE("${ITK_VERSION_MAJOR}" GREATER 0.0) +- SET(CPACK_PACKAGE_VERSION_MAJOR "2") +- SET(CPACK_PACKAGE_VERSION_MINOR "0") +- SET(CPACK_PACKAGE_VERSION_PATCH "0") ++if("${ITK_VERSION_MAJOR}" GREATER 0.0) ++# message(STATUS "---------------------ITK ZLIB ${ITK_ZLIB_LIBRARIES}") ++ add_definitions(-DHAVE_ZLIB) ++ add_definitions(-DITKZLIB) ++ set(PACKAGE_PREFIX "ITK") ++ set(NIFTI_LIBRARY_PROPERTIES ${ITK_LIBRARY_PROPERTIES}) ++ set(NIFTI_INSTALL_BIN_DIR "${ITK_INSTALL_BIN_DIR_CM24}") ++ set(NIFTI_INSTALL_LIB_DIR "${ITK_INSTALL_LIB_DIR_CM24}") ++ ++ if(ITK_USE_FLAT_DIRECTORY_INSTALL) ++ set(NIFTI_INSTALL_INCLUDE_DIR "${ITK_INSTALL_INCLUDE_DIR_CM24}") ++ else(ITK_USE_FLAT_DIRECTORY_INSTALL) ++ set(NIFTI_INSTALL_INCLUDE_DIR "${ITK_INSTALL_INCLUDE_DIR_CM24}/Utilities") ++ endif(ITK_USE_FLAT_DIRECTORY_INSTALL) ++ ++ set(NIFTI_ZLIB_LIBRARIES ${ITK_ZLIB_LIBRARIES}) ++ set(NIFTI_INSTALL_NO_DEVELOPMENT ${ITK_INSTALL_NO_DEVELOPMENT}) ++ set(NIFTI_INSTALL_NO_LIBRARIES ${ITK_INSTALL_NO_LIBRARIES}) ++ ++else("${ITK_VERSION_MAJOR}" GREATER 0.0) ++ set(CPACK_PACKAGE_VERSION_MAJOR "2") ++ set(CPACK_PACKAGE_VERSION_MINOR "0") ++ set(CPACK_PACKAGE_VERSION_PATCH "0") + ### USE AS STAND ALONE PACKAGE +- FIND_PACKAGE(ZLIB) +-# MESSAGE(STATUS "---------------------SYSTEM ZLIB ${ZLIB_LIBRARY}") +- SET(PACKAGE_PREFIX "") ++ find_package(ZLIB) ++# message(STATUS "---------------------SYSTEM ZLIB ${ZLIB_LIBRARY}") ++ set(PACKAGE_PREFIX "") + # Set default shared library version + # This library version will be applied to all libraries in the package + # unless it is not explicitely for a certain lib. +- SET(NIFTI_SHAREDLIB_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH} ) +- STRING( REGEX MATCH "^[0-9]+" NIFTI_SHAREDLIB_SOVERSION ${NIFTI_SHAREDLIB_VERSION}) +- SET(NIFTI_LIBRARY_PROPERTIES VERSION ${NIFTI_SHAREDLIB_VERSION} SOVERSION ${NIFTI_SHAREDLIB_SOVERSION}) ++ set(NIFTI_SHAREDLIB_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH} ) ++ string( REGEX MATCH "^[0-9]+" NIFTI_SHAREDLIB_SOVERSION ${NIFTI_SHAREDLIB_VERSION}) ++ set(NIFTI_LIBRARY_PROPERTIES VERSION ${NIFTI_SHAREDLIB_VERSION} SOVERSION ${NIFTI_SHAREDLIB_SOVERSION}) + +- SET(NIFTI_INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin") +- SET(NIFTI_INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") +- SET(NIFTI_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/nifti") +- SET(NIFTI_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}) +- SET(NIFTI_INSTALL_NO_DEVELOPMENT 0) +- SET(NIFTI_INSTALL_NO_LIBRARIES 0) ++ set(NIFTI_INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin") ++ set(NIFTI_INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ++ set(NIFTI_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/nifti") ++ set(NIFTI_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}) ++ set(NIFTI_INSTALL_NO_DEVELOPMENT 0) ++ set(NIFTI_INSTALL_NO_LIBRARIES 0) + + #Needs an if clause and more work before testing can take place. +- SUBDIRS(Testing) +- SUBDIRS(nifticdf utils) ++ subdirs(Testing) ++ subdirs(nifticdf utils) + +- OPTION(USE_FSL_CODE "If OFF, The copyright of this code is questionable for inclusion with nifti." OFF) +- MARK_AS_ADVANCED(USE_FSL_CODE) ++ option(USE_FSL_CODE "If OFF, The copyright of this code is questionable for inclusion with nifti." OFF) ++ mark_as_advanced(USE_FSL_CODE) + + # the order of subdirs is important! fsliolob has to preceed examples + # as otherwise FSLIOLIB_SOURCE_DIR is undefined and hence the examples + # will fail to compile +- IF(USE_FSL_CODE) +- SUBDIRS(fsliolib) +- SUBDIRS(examples) +- ENDIF(USE_FSL_CODE) +- ENABLE_TESTING() +- INCLUDE(Dart) ++ if(USE_FSL_CODE) ++ subdirs(fsliolib) ++ subdirs(examples) ++ endif(USE_FSL_CODE) ++ enable_testing() ++ include(CTest) + + #################################### + ### Define information necessary for packaging with CPACK (http://www.cmake.org/Wiki/CMake:Packaging_With_CPack) + ### The last section is concerned with installing the binaries and making distributions. +-INCLUDE(InstallRequiredSystemLibraries) ++include(InstallRequiredSystemLibraries) + +-SET(CPACK_PACKAGE_NAME "NIFTI") ++set(CPACK_PACKAGE_NAME "NIFTI") + +-SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-dev") +-SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "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.") +-SET(CPACK_PACKAGE_DESCRIPTION_FILE "${NIFTI_SOURCE_DIR}/README") +-#SET(CPACK_RESOURCE_FILE_LICENSE "${NIFTI_SOURCE_DIR}/Copyright.txt") +-SET(CPACK_RESOURCE_FILE_LICENSE "${NIFTI_SOURCE_DIR}/README") ++set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-dev") ++set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "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.") ++set(CPACK_PACKAGE_DESCRIPTION_FILE "${NIFTI_SOURCE_DIR}/README") ++#set(CPACK_RESOURCE_FILE_LICENSE "${NIFTI_SOURCE_DIR}/Copyright.txt") ++set(CPACK_RESOURCE_FILE_LICENSE "${NIFTI_SOURCE_DIR}/README") + +-SET(CPACK_PACKAGE_DEFAULT_LOCATION "/opt/${CPACK_PACKAGE_NAME}") +-#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "NIFTI ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") +-SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${NIFTI}") +-SET(CPACK_PACKAGING_INSTALL_PREFIX "/") +-SET(CPACK_SET_DESTDIR ON) ++set(CPACK_PACKAGE_DEFAULT_LOCATION "/opt/${CPACK_PACKAGE_NAME}") ++#set(CPACK_PACKAGE_INSTALL_DIRECTORY "NIFTI ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") ++set(CPACK_PACKAGE_INSTALL_DIRECTORY "${NIFTI}") ++set(CPACK_PACKAGING_INSTALL_PREFIX "/") ++set(CPACK_SET_DESTDIR ON) + +-SET(CPACK_PACKAGE_VENDOR "NIFTI DFWG") ++set(CPACK_PACKAGE_VENDOR "NIFTI DFWG") + +-SET(CPACK_SOURCE_GENERATOR "TGZ;TZ") +-#SET(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\.svn/;\\.swp$;\\.#;/#;\\.*~") +-SET(CPACK_SOURCE_IGNORE_FILES "") +-SET(CPACK_PACKAGE_EXECUTABLES "NIFTI";"A program for registering medical ++set(CPACK_SOURCE_GENERATOR "TGZ;TZ") ++#set(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\.svn/;\\.swp$;\\.#;/#;\\.*~") ++set(CPACK_SOURCE_IGNORE_FILES "") ++set(CPACK_PACKAGE_EXECUTABLES "NIFTI";"A program for registering medical + images with mutual information.") + +-IF(WIN32 AND NOT UNIX) +- SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY ++if(WIN32 AND NOT UNIX) ++ set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY + "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + # There is a bug in NSI that does not handle full unix paths properly. Make + # sure there is at least one set of four (4) backlasshes. +- SET(CPACK_PACKAGE_ICON ++ set(CPACK_PACKAGE_ICON + "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp") +- SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe") +- SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous ++ set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe") ++ set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous + Project") +- SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.nitrc.org") +- SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.nitrc.org") +- SET(CPACK_NSIS_CONTACT "xyz@domain.edu") +- SET(CPACK_NSIS_MODIFY_PATH ON) +-ELSE(WIN32 AND NOT UNIX) +- SET(CPACK_STRIP_FILES OFF) +- SET(CPACK_SOURCE_STRIP_FILES OFF) +-ENDIF(WIN32 AND NOT UNIX) ++ set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.nitrc.org") ++ set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.nitrc.org") ++ set(CPACK_NSIS_CONTACT "xyz@domain.edu") ++ set(CPACK_NSIS_MODIFY_PATH ON) ++else(WIN32 AND NOT UNIX) ++ set(CPACK_STRIP_FILES OFF) ++ set(CPACK_SOURCE_STRIP_FILES OFF) ++endif(WIN32 AND NOT UNIX) + +-INCLUDE(CPack) ++include(CPack) + + +-ENDIF("${ITK_VERSION_MAJOR}" GREATER 0.0) ++endif("${ITK_VERSION_MAJOR}" GREATER 0.0) + + + +-IF(NOT DEFINED NIFTI_INSTALL_LIB_DIR) +- MESSAGE(FATAL_ERROR "Must set NIFTI_INSTALL_LIB_DIR.") +-ENDIF(NOT DEFINED NIFTI_INSTALL_LIB_DIR) +-IF(NOT DEFINED NIFTI_INSTALL_BIN_DIR) +- MESSAGE(FATAL_ERROR "Must set NIFTI_INSTALL_BIN_DIR.") +-ENDIF(NOT DEFINED NIFTI_INSTALL_BIN_DIR) +-IF(NOT DEFINED NIFTI_INSTALL_INCLUDE_DIR) +- MESSAGE(FATAL_ERROR "Must set NIFTI_INSTALL_INCLUDE_DIR.") +-ENDIF(NOT DEFINED NIFTI_INSTALL_INCLUDE_DIR) ++if(NOT DEFINED NIFTI_INSTALL_LIB_DIR) ++ message(FATAL_ERROR "Must set NIFTI_INSTALL_LIB_DIR.") ++endif(NOT DEFINED NIFTI_INSTALL_LIB_DIR) ++if(NOT DEFINED NIFTI_INSTALL_BIN_DIR) ++ message(FATAL_ERROR "Must set NIFTI_INSTALL_BIN_DIR.") ++endif(NOT DEFINED NIFTI_INSTALL_BIN_DIR) ++if(NOT DEFINED NIFTI_INSTALL_INCLUDE_DIR) ++ message(FATAL_ERROR "Must set NIFTI_INSTALL_INCLUDE_DIR.") ++endif(NOT DEFINED NIFTI_INSTALL_INCLUDE_DIR) + + + +diff --git a/CTestConfig.cmake b/CTestConfig.cmake +index 01c4b88..fbc6ce7 100644 +--- a/CTestConfig.cmake ++++ b/CTestConfig.cmake +@@ -2,8 +2,8 @@ + ## Then modify the CMakeLists.txt file in the root directory of your + ## project to incorporate the testing dashboard. + ## # The following are required to uses Dart and the Cdash dashboard +-## ENABLE_TESTING() +-## INCLUDE(Dart) ++## enable_testing() ++## include(CTest) + set(CTEST_PROJECT_NAME "NIFTI") + set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") + +diff --git a/Makefile b/Makefile +index 8fafe85..c76a212 100644 +--- a/Makefile ++++ b/Makefile +@@ -27,7 +27,7 @@ ANSI_FLAGS = ${GNU_ANSI_FLAGS} + CFLAGS = $(ANSI_FLAGS) + + ## Command defines +-## gmake does not work on MacOSX or some versions of linux MAKE = gmake ++## gmake does not work on MacOSX or some versions of linux MAKE = gmake + RM = rm + MV = mv + CP = cp +@@ -43,7 +43,7 @@ INSTALL_INC_DIR = include + ## Zlib defines + ZLIB_INC = -I/usr/include + ZLIB_PATH = -L/usr/lib +-ZLIB_LIBS = $(ZLIB_PATH) -lm -lz ++ZLIB_LIBS = $(ZLIB_PATH) -lm -lz + + ############################################################## + # platform specific redefines (to use, set ARCH appropriately) +@@ -63,7 +63,7 @@ else + ifeq ($(ARCH),X86_64) ## 64-bit Linux + ZLIB_INC = + ZLIB_PATH = +-ZLIB_LIBS = $(ZLIB_PATH) -lm -lz ++ZLIB_LIBS = $(ZLIB_PATH) -lm -lz + TAR = /bin/tar + endif + endif +diff --git a/Makefile.cross_mingw32 b/Makefile.cross_mingw32 +index 3eadcd5..2de7c6d 100644 +--- a/Makefile.cross_mingw32 ++++ b/Makefile.cross_mingw32 +@@ -1,6 +1,6 @@ + #!/usr/bin/make -f + # -*- Makefile -*- +-# ++# + # This makefile was initially created by Michael Hanke + # to cross compile the nifticlibs for win32 on a + # Debian system -- although it should work on most Linux systems with possibly +diff --git a/README b/README +index f712630..62dcc91 100644 +--- a/README ++++ b/README +@@ -22,7 +22,7 @@ znzlib -- low level library for handling read/write of compressed files. + niftilib -- core i/o routines for reading and writing nifti-1 format files. + Primarily routines to read/write and manipulate the header field + information, including orientation matrices. Volume-wise, +- timecourse-wise, access to image data. ++ timecourse-wise, access to image data. + + nifticdf -- functions to compute cumulative distributions and their inverses + +@@ -62,7 +62,7 @@ packaging -- spec file for building RPMs, and template package + Instructions to build + --------------------- + +-command -- "make all" ++command -- "make all" + + results will be left in the directories: bin/ include/ lib/ + +diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt +index ec439b8..19da5a8 100644 +--- a/Testing/CMakeLists.txt ++++ b/Testing/CMakeLists.txt +@@ -1,7 +1,7 @@ + #File Generated by Hans J. Johnson + #Please contact hans-johnson@uiowa.edu for making enhancments/corrections +-PROJECT(TESTING) + +-SUBDIRS(niftilib) +-SUBDIRS(nifti_regress_test) ++include_directories(${NIFTI_SOURCE_DIR}/niftilib ${NIFTI_SOURCE_DIR}/znzlib ${NIFTI_SOURCE_DIR}/nifticdf) ++subdirs(niftilib) ++subdirs(nifti_regress_test) + +diff --git a/Testing/nifti_regress_test/CMakeLists.txt b/Testing/nifti_regress_test/CMakeLists.txt +index 4530b3e..2bf4ed0 100644 +--- a/Testing/nifti_regress_test/CMakeLists.txt ++++ b/Testing/nifti_regress_test/CMakeLists.txt +@@ -1,47 +1,52 @@ + # Do all regression tests +-PROJECT(REGRESSION_TEST) + +-SET(NT ${NIFTI_BINARY_DIR}/utils/nifti_tool ) +-SET(DATA ${REGRESSION_TEST_BINARY_DIR}/nifti_regress_data) +-SET(TESTS ${REGRESSION_TEST_SOURCE_DIR}/cmake_testscripts) ++set(NT ${NIFTI_BINARY_DIR}/utils/nifti_tool ) ++set(DATA ${NIFTI_BINARY_DIR}/Testing/nifti_regress_test/nifti_regress_data) ++set(TESTS ${NIFTI_SOURCE_DIR}/Testing/nifti_regress_test/cmake_testscripts) + +-ADD_TEST(fetch_data +-sh ${TESTS}/fetch_data_test.sh ${REGRESSION_TEST_BINARY_DIR} ++ ++add_test(nifti_ver ${NT} -nifti_ver) ++add_test(nifti_tool_ver ${NT} -ver) ++add_test(nifti_help ${NT} -help) ++add_test(nifti_nifti_hist ${NT} -nifti_hist) ++add_test(nifti_hist ${NT} -hist) ++ ++add_test(fetch_data ++sh ${TESTS}/fetch_data_test.sh ${NIFTI_BINARY_DIR}/Testing/nifti_regress_test + ) + +-ADD_TEST(nifti_ver ${NT} -nifti_ver) +-ADD_TEST(nifti_tool_ver ${NT} -ver) +-ADD_TEST(nifti_help ${NT} -help) +-ADD_TEST(nifti_nifti_hist ${NT} -nifti_hist) +-ADD_TEST(nifti_hist ${NT} -hist) ++add_test(nifti_disp_hdr ${NT} -disp_hdr -infiles ${DATA}/anat0.nii ) ++set_tests_properties( nifti_disp_hdr PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_disp_hdr ${NT} -disp_hdr -infiles ${DATA}/anat0.nii ) ++add_test(nifti_disp_nim ${NT} -disp_nim -infiles ${DATA}/anat0.nii ) ++set_tests_properties( nifti_disp_nim PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_disp_nim ${NT} -disp_nim -infiles ${DATA}/anat0.nii ) ++add_test(nifti_disp_ext ${NT} -disp_ext -infiles ${DATA}/anat0.nii ) ++set_tests_properties( nifti_disp_ext PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_disp_ext ${NT} -disp_ext -infiles ${DATA}/anat0.nii ) ++add_test(nifti_modhdr_exts sh ${TESTS}/mod_header_test.sh ${NT} ${DATA} ) ++set_tests_properties( nifti_modhdr_exts PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_modhdr_exts +-sh ${TESTS}/mod_header_test.sh ${NT} ${DATA} ) ++add_test(nifti_bricks_test sh ${TESTS}/bricks_test.sh ${NT} ${DATA} ) ++set_tests_properties( nifti_bricks_test PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_bricks_test +-sh ${TESTS}/bricks_test.sh ${NT} ${DATA} ) ++add_test(nifti_dts_test sh ${TESTS}/dts_test.sh ${NT} ${DATA} ) ++set_tests_properties( nifti_dts_test PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_dts_test +-sh ${TESTS}/dts_test.sh ${NT} ${DATA} ) ++add_test(nifti_dci_test sh ${TESTS}/dci_test.sh ${NT} ${DATA} ) ++set_tests_properties( nifti_dci_test PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_dci_test +-sh ${TESTS}/dci_test.sh ${NT} ${DATA} ) ++add_test(nifti_comment_test sh ${TESTS}/comment_test.sh ${NT} ${DATA} ) ++set_tests_properties( nifti_comment_test PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_comment_test +-sh ${TESTS}/comment_test.sh ${NT} ${DATA} ) +- +-ADD_TEST(nifti_header_check ${NT} -check_hdr -infiles ${DATA}/anat0.nii ) ++add_test(nifti_header_check ${NT} -check_hdr -infiles ${DATA}/anat0.nii ) ++set_tests_properties( nifti_header_check PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_nim_check ${NT} -check_nim -infiles ${DATA}/anat0.nii ) ++add_test(nifti_nim_check ${NT} -check_nim -infiles ${DATA}/anat0.nii ) ++set_tests_properties( nifti_nim_check PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_dsets_test +-sh ${TESTS}/dsets_test.sh ${NT} ${DATA} ) ++add_test(nifti_dsets_test sh ${TESTS}/dsets_test.sh ${NT} ${DATA} ) ++set_tests_properties( nifti_dsets_test PROPERTIES DEPENDS fetch_data) + +-ADD_TEST(nifti_newfiles_test +-sh ${TESTS}/newfiles_test.sh ${NT} ${DATA} ) ++add_test(nifti_newfiles_test sh ${TESTS}/newfiles_test.sh ${NT} ${DATA} ) ++set_tests_properties( nifti_newfiles_test PROPERTIES DEPENDS fetch_data) +diff --git a/Testing/nifti_regress_test/cmake_testscripts/fetch_data_test.sh b/Testing/nifti_regress_test/cmake_testscripts/fetch_data_test.sh +index ca88d05..8bb56dd 100644 +--- a/Testing/nifti_regress_test/cmake_testscripts/fetch_data_test.sh ++++ b/Testing/nifti_regress_test/cmake_testscripts/fetch_data_test.sh +@@ -16,13 +16,19 @@ echo can\'t cd to $1 + exit 1 + fi + +- + if wget -nd http://nifti.nimh.nih.gov/pub/dist/data/nifti_regress_data.tgz + then +-echo wget succeeded ++ echo wget succeeded + else +-echo wget failed +-exit 1 ++ ## Note: On MacOSX, wget is not installed by default, but curl is ++ ## so use this fall back strategy when wget can not be found ++ if curl -O http://nifti.nimh.nih.gov/pub/dist/data/nifti_regress_data.tgz ++ then ++ echo curl succeeded ++ else ++ echo Both curl and wget failed ++ exit 1 ++ fi + fi + + if tar xzvf nifti_regress_data.tgz +diff --git a/Testing/nifti_regress_test/cmake_testscripts/newfiles_test.sh b/Testing/nifti_regress_test/cmake_testscripts/newfiles_test.sh +index a79a7a9..9301c29 100644 +--- a/Testing/nifti_regress_test/cmake_testscripts/newfiles_test.sh ++++ b/Testing/nifti_regress_test/cmake_testscripts/newfiles_test.sh +@@ -29,7 +29,7 @@ ${NT} -copy_im -prefix ${DATA}/ncopy5.nii -infiles ${DATA}/new5.nia + set count = 0 + for index in 2 3 4 5 ; do + diff ${DATA}/ncopy1.nii ${DATA}/ncopy$index.nii +- if [ $? -ne 0 ] ; then ++ if [ $? -ne 0 ] ; then + echo "-- failure on test index $index --" + exit 1 + fi +diff --git a/Testing/nifti_regress_test/commands/c05.mod.hdr b/Testing/nifti_regress_test/commands/c05.mod.hdr +index 35a8975..c2d179a 100644 +--- a/Testing/nifti_regress_test/commands/c05.mod.hdr ++++ b/Testing/nifti_regress_test/commands/c05.mod.hdr +@@ -1,6 +1,6 @@ + + # modify the header of default anat, creating a new anat +-# ++# + # then compare the resulting headers + + nifti_tool -mod_hdr -prefix anat1 -infiles anat0.nii \ +diff --git a/Testing/nifti_regress_test/commands/c06.add.ext b/Testing/nifti_regress_test/commands/c06.add.ext +index 8922da3..e9c1424 100644 +--- a/Testing/nifti_regress_test/commands/c06.add.ext ++++ b/Testing/nifti_regress_test/commands/c06.add.ext +@@ -1,7 +1,7 @@ + #!/bin/tcsh + + # - add junk extensions to the new anat, overwriting it +-# - display extensions for the two files ++# - display extensions for the two files + # - again, compare the headers + + nifti_tool -add_afni_ext 'wow, my first extension :)' \ +diff --git a/Testing/nifti_regress_test/commands/c16.rand.swap b/Testing/nifti_regress_test/commands/c16.rand.swap +index 25a505f..a384548 100644 +--- a/Testing/nifti_regress_test/commands/c16.rand.swap ++++ b/Testing/nifti_regress_test/commands/c16.rand.swap +@@ -32,4 +32,3 @@ nifti_tool -diff_hdr -debug 2 -infiles swap.old.hdr swap.ana.hdr \ + echo '------------- DIFF old/new nifti -------------' + nifti_tool -diff_hdr -debug 2 -infiles swap.new_nifti.hdr swap.old_nifti.hdr \ + > out.rand.swap.compare.nifti +- +diff --git a/Testing/nifti_regress_test/commands/c17.file.case b/Testing/nifti_regress_test/commands/c17.file.case +index d29f0fd..f062ccd 100644 +--- a/Testing/nifti_regress_test/commands/c17.file.case ++++ b/Testing/nifti_regress_test/commands/c17.file.case +@@ -31,4 +31,3 @@ nifti_tool -disp_hdr -infiles $prefix.6.IMG.GZ + echo should be errors: + nifti_tool -disp_hdr -infiles small.NII + nifti_tool -disp_hdr -infiles $prefix.4.NII.gz +- +diff --git a/Testing/niftilib/CMakeLists.txt b/Testing/niftilib/CMakeLists.txt +index 6fe87bd..03a3c6f 100644 +--- a/Testing/niftilib/CMakeLists.txt ++++ b/Testing/niftilib/CMakeLists.txt +@@ -1,15 +1,15 @@ + #File Generated by Hans J. Johnson + #Please contact hans-johnson@uiowa.edu for making enhancments/corrections +-PROJECT(NIFTILIB_TESTS) + +-INCLUDE_DIRECTORIES(${NIFTILIB_SOURCE_DIR} ${ZNZLIB_SOURCE_DIR} ${NIFTILIB_SOURCE_DIR}/../utils) ++include_directories(${NIFTI_SOURCE_DIR}/niftilib ${NIFTI_SOURCE_DIR}/znzlib ++ ${NIFTI_SOURCE_DIR}/nifticdf ${NIFTI_SOURCE_DIR}/utils) + +-ADD_EXECUTABLE(first_test nifti_test.c) +-TARGET_LINK_LIBRARIES(first_test niftiio ) ++add_executable(first_test nifti_test.c) ++target_link_libraries(first_test niftiio ) + +-ADD_EXECUTABLE(second_test nifti_test2.c) +-TARGET_LINK_LIBRARIES(second_test niftiio ) ++add_executable(second_test nifti_test2.c) ++target_link_libraries(second_test niftiio ) + + +-ADD_TEST(first_test first_test ) ++add_test(first_test first_test ) + +diff --git a/Testing/niftilib/nifti_test.c b/Testing/niftilib/nifti_test.c +index 3af8346..8c4f051 100644 +--- a/Testing/niftilib/nifti_test.c ++++ b/Testing/niftilib/nifti_test.c +@@ -141,7 +141,7 @@ void compare_reference_image_values(nifti_image const * const reference_image, n + for(; CurrVoxel < NumVoxels ; CurrVoxel++) + { + /*printf("%d ",CurrVoxel); fflush(stdout);*/ +- if( ((int *)(reference_image->data))[CurrVoxel] != ((int *)(reloaded_image->data))[CurrVoxel]) ++ if( ((int *)(reference_image->data))[CurrVoxel] != ((int *)(reloaded_image->data))[CurrVoxel]) + { + PrintTest("Incorrect Pixel Value Found",0,NIFTITEST_FALSE,Errors); + } +@@ -213,7 +213,7 @@ int main (int argc, char *argv[]) + PrintTest("nifti_copy_extension", + nifti_copy_extensions(nim,reference_image), + NIFTITEST_FALSE,&Errors); +- ++ + nifti_image_free(nim); + nim = nifti_copy_nim_info(reference_image); + PrintTest("nifti_copy_nim_info", +@@ -222,15 +222,15 @@ int main (int argc, char *argv[]) + PrintTest("nifti_nim_is_valid", + nifti_nim_is_valid(nim,0) == 0, + NIFTITEST_FALSE,&Errors); +- +- ++ ++ + nifti_image_free(nim); +- ++ + } + { + nifti_image * reloaded_image = nifti_image_read(reference_image->fname,1); + PrintTest("Reload of image ",reloaded_image==0,NIFTITEST_TRUE,&Errors); +- ++ + { + /* + * if the file is named '.img', '.hdr', '.img.gz', or '.hdr.gz', then +@@ -266,7 +266,7 @@ int main (int argc, char *argv[]) + PrintTest("Reload of bricked image",nim_orig == 0,NIFTITEST_FALSE,&Errors); + nifti_free_NBL(&NB_orig); + nifti_image_free(nim_orig); +- ++ + nim_select = nifti_image_read_bricks(reference_image->fname, 5, blist, &NB_select); + PrintTest("Reload of bricked image with blist",nim_orig == 0,NIFTITEST_FALSE,&Errors); + nifti_free_NBL(&NB_select); +@@ -300,7 +300,7 @@ int main (int argc, char *argv[]) + { + char *imgname = nifti_findimgname("ATestReferenceImageForReadingAndWriting.hdr",2); + PrintTest("nifti_findimgname", +- imgname == 0 || ++ imgname == 0 || + strcmp(imgname,"ATestReferenceImageForReadingAndWriting.img") != 0, + NIFTITEST_FALSE,&Errors); + free(imgname); +@@ -320,13 +320,13 @@ int main (int argc, char *argv[]) + PrintTest("is_nifti_file2", + IsNiftiFile != 2,NIFTITEST_FALSE,&Errors); + } +- ++ + } + { + /* + * test writing and reading an ascii file + */ +- nifti_image * reference_image = ++ nifti_image * reference_image = + generate_reference_image("TestAsciiImage.nia",&Errors); + reference_image->nifti_type = 3; + nifti_image_write(reference_image); +@@ -399,7 +399,7 @@ int main (int argc, char *argv[]) + snprintf(TEMP_STR,256,"nifti_makebasename(\"%s\")=\"%s\"",FILE_NAMES[fni],basename); + PrintTest(TEMP_STR,strcmp(basename,KNOWN_FILE_BASENAMES[fni]) != 0,NIFTITEST_FALSE,&Errors); + free(basename); +- ++ + } + } + /* +@@ -435,7 +435,7 @@ int main (int argc, char *argv[]) + NIFTITEST_FALSE, \ + &Errors); \ + } +- nifti_datatype_test(DT_UNKNOWN,"UNKNOWN"); ++ nifti_datatype_test(DT_UNKNOWN,"UNKNOWN"); + nifti_datatype_test(DT_BINARY, "BINARY"); + nifti_datatype_test(DT_INT8, "INT8"); + nifti_datatype_test(DT_UINT8, "UINT8"); +@@ -619,9 +619,9 @@ int main (int argc, char *argv[]) + float qfac; + nifti_mat44_to_quatern(R,&qb,&qc,&qd,&qx,&qy,&qz,&dx,&dy,&dz,&qfac); + PrintTest("nifti_mat44_to_quatern", +- qb != 0.000000 || qc != 0.000000 || qd != 0.000000 || +- qx != 0.000000 || qy != 0.000000 || qd != 0.000000 || +- dx != 1.000000 || dy != 1.000000 || dz != 1.000000 || ++ qb != 0.000000 || qc != 0.000000 || qd != 0.000000 || ++ qx != 0.000000 || qy != 0.000000 || qd != 0.000000 || ++ dx != 1.000000 || dy != 1.000000 || dz != 1.000000 || + qfac != 1.000000, + NIFTITEST_FALSE,&Errors); + } +@@ -629,7 +629,7 @@ int main (int argc, char *argv[]) + mat44 x = nifti_make_orthog_mat44(0.14,0.0,0.0, + 0.0,0.9,0.0, + 0.0,0.0,1.1); +- ++ + PrintTest("nifti_make_orthog_mat44", + x.m[0][0] != 1.0 || x.m[1][1] != 1.0 || + x.m[2][2] != 1.0 || x.m[3][3] != 1.0, +@@ -645,7 +645,7 @@ int main (int argc, char *argv[]) + x[8] != 'h' || x[9] != 'g' || x[10] != 'f' || x[11] != 'e' || + x[12] != 'd' || x[13] != 'c' || x[14] != 'b' || x[15] != 'a', + NIFTITEST_FALSE,&Errors); +- ++ + } + { + static char x[8] = { 'a','b','c','d','D','C','B','A' }; +@@ -654,7 +654,7 @@ int main (int argc, char *argv[]) + x[0] != 'A' || x[1] != 'B' || x[2] != 'C' || x[3] != 'D' || + x[4] != 'd' || x[5] != 'c' || x[6] != 'b' || x[7] != 'a', + NIFTITEST_FALSE,&Errors); +- ++ + } + { + /* +diff --git a/Testing/niftilib/nifti_test2.c b/Testing/niftilib/nifti_test2.c +index 9892995..a509368 100644 +--- a/Testing/niftilib/nifti_test2.c ++++ b/Testing/niftilib/nifti_test2.c +@@ -11,7 +11,7 @@ int main (int argc, char *argv[]) + */ + nifti_image *i1 = nifti_simple_init_nim(); + nifti_image *i2; +- ++ + /* + * add an extension to the dummy + */ +diff --git a/Updates.txt b/Updates.txt +index a82b872..b61c91a 100644 +--- a/Updates.txt ++++ b/Updates.txt +@@ -51,12 +51,12 @@ Updated in version 0.6 August 27, 2007 + - RR allowed for datasets with a single volume > 2^31 bytes + - RR allowed for datasets with total size > 2^32 bytes + - RR added regression testing under Testing/nifti_regress_test +- - KF added upper level packaging directory and put Andy Loenings's ++ - KF added upper level packaging directory and put Andy Loenings's + rpm spec file in it +- - HJ Changed default installation path of header files into include/nifti ++ - HJ Changed default installation path of header files into include/nifti + from CMakeLists.txt + - HJ/KW Added exposing Analyze75 orientation codes +- - HJ/KW Added function to allow any sized subregion of the image to be read ++ - HJ/KW Added function to allow any sized subregion of the image to be read + from disk + - RR/KF znzlib/config.h incorporated into znzlib.h and removed + +@@ -106,5 +106,3 @@ Updated in version 2.0.0 July 20, 2010 + + ----------------------------------------------------------------- + Recent Updates +- +- +diff --git a/docs/Doxy_nifti.txt b/docs/Doxy_nifti.txt +index 2011c62..4ee32fd 100644 +--- a/docs/Doxy_nifti.txt ++++ b/docs/Doxy_nifti.txt +@@ -13,69 +13,69 @@ + # General configuration options + #--------------------------------------------------------------------------- + +-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +-# by quotes) that should identify the project. ++# The PROJECT_NAME tag is a single word (or a sequence of words surrounded ++# by quotes) that should identify the project. + + PROJECT_NAME = nifti1_io + + +-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +-# base path where the generated documentation will be put. +-# If a relative path is entered, it will be relative to the location ++# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) ++# base path where the generated documentation will be put. ++# If a relative path is entered, it will be relative to the location + # where doxygen was started. If left blank the current directory will be used. + +-OUTPUT_DIRECTORY = ++OUTPUT_DIRECTORY = + + + #--------------------------------------------------------------------------- + # configuration options related to the input files + #--------------------------------------------------------------------------- + +-# The INPUT tag can be used to specify the files and/or directories that contain +-# documented source files. You may enter file names like "myfile.cpp" or +-# directories like "/usr/src/myproject". Separate the files or directories +-# with spaces. ++# The INPUT tag can be used to specify the files and/or directories that contain ++# documented source files. You may enter file names like "myfile.cpp" or ++# directories like "/usr/src/myproject". Separate the files or directories ++# with spaces. + + INPUT = ../fsliolib ../niftilib ../znzlib + +-# If the value of the INPUT tag contains directories, you can use the +-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +-# and *.h) to filter out the source-files in the directories. If left +-# blank all files are included. ++# If the value of the INPUT tag contains directories, you can use the ++# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp ++# and *.h) to filter out the source-files in the directories. If left ++# blank all files are included. + + FILE_PATTERNS = *.c *.h + +-# The RECURSIVE tag can be used to turn specify whether or not subdirectories +-# should be searched for input files as well. Possible values are YES and NO. +-# If left blank NO is used. ++# The RECURSIVE tag can be used to turn specify whether or not subdirectories ++# should be searched for input files as well. Possible values are YES and NO. ++# If left blank NO is used. + + RECURSIVE = NO + +-# The EXCLUDE tag can be used to specify files and/or directories that should +-# excluded from the INPUT source files. This way you can easily exclude a +-# subdirectory from a directory tree whose root is specified with the INPUT tag. ++# The EXCLUDE tag can be used to specify files and/or directories that should ++# excluded from the INPUT source files. This way you can easily exclude a ++# subdirectory from a directory tree whose root is specified with the INPUT tag. + + EXCLUDE = testprog.c nifti1_test.c mjtest.c + +-# If the value of the INPUT tag contains directories, you can use the +-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +-# certain files from those directories. ++# If the value of the INPUT tag contains directories, you can use the ++# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude ++# certain files from those directories. + +-EXCLUDE_PATTERNS = ++EXCLUDE_PATTERNS = + + + #--------------------------------------------------------------------------- + # configuration options related to the HTML output + #--------------------------------------------------------------------------- + +-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +-# generate HTML output. ++# If the GENERATE_HTML tag is set to YES (the default) Doxygen will ++# generate HTML output. + + GENERATE_HTML = YES + +-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +-# If a relative path is entered the value of OUTPUT_DIRECTORY will be +-# put in front of it. If left blank `html' will be used as the default path. ++# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. ++# If a relative path is entered the value of OUTPUT_DIRECTORY will be ++# put in front of it. If left blank `html' will be used as the default path. + + HTML_OUTPUT = html + +@@ -84,8 +84,8 @@ HTML_OUTPUT = html + # configuration options related to the LaTeX output + #--------------------------------------------------------------------------- + +-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +-# generate Latex output. ++# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will ++# generate Latex output. + + GENERATE_LATEX = NO + +@@ -94,8 +94,8 @@ GENERATE_LATEX = NO + # configuration options related to the RTF output + #--------------------------------------------------------------------------- + +-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +-# The RTF output is optimised for Word 97 and may not look very pretty with ++# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output ++# The RTF output is optimised for Word 97 and may not look very pretty with + # other RTF readers or editors. + + GENERATE_RTF = NO +@@ -105,8 +105,8 @@ GENERATE_RTF = NO + # configuration options related to the man page output + #--------------------------------------------------------------------------- + +-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +-# generate man pages ++# If the GENERATE_MAN tag is set to YES (the default) Doxygen will ++# generate man pages + + GENERATE_MAN = NO + +@@ -114,9 +114,9 @@ GENERATE_MAN = NO + # configuration options related to the XML output + #--------------------------------------------------------------------------- + +-# If the GENERATE_XML tag is set to YES Doxygen will +-# generate an XML file that captures the structure of +-# the code including all documentation. Warning: This feature ++# If the GENERATE_XML tag is set to YES Doxygen will ++# generate an XML file that captures the structure of ++# the code including all documentation. Warning: This feature + # is still experimental and very incomplete. + + GENERATE_XML = NO +diff --git a/docs/Doxyfile.ORIG b/docs/Doxyfile.ORIG +index aa3ba73..5a6e898 100644 +--- a/docs/Doxyfile.ORIG ++++ b/docs/Doxyfile.ORIG +@@ -13,319 +13,319 @@ + # General configuration options + #--------------------------------------------------------------------------- + +-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +-# by quotes) that should identify the project. ++# The PROJECT_NAME tag is a single word (or a sequence of words surrounded ++# by quotes) that should identify the project. + +-PROJECT_NAME = ++PROJECT_NAME = + +-# The PROJECT_NUMBER tag can be used to enter a project or revision number. +-# This could be handy for archiving the generated documentation or ++# The PROJECT_NUMBER tag can be used to enter a project or revision number. ++# This could be handy for archiving the generated documentation or + # if some version control system is used. + +-PROJECT_NUMBER = ++PROJECT_NUMBER = + +-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +-# base path where the generated documentation will be put. +-# If a relative path is entered, it will be relative to the location ++# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) ++# base path where the generated documentation will be put. ++# If a relative path is entered, it will be relative to the location + # where doxygen was started. If left blank the current directory will be used. + +-OUTPUT_DIRECTORY = ++OUTPUT_DIRECTORY = + +-# The OUTPUT_LANGUAGE tag is used to specify the language in which all +-# documentation generated by doxygen is written. Doxygen will use this +-# information to generate all constant output in the proper language. +-# The default language is English, other supported languages are: +-# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, +-# Korean, Hungarian, Norwegian, Spanish, Romanian, Russian, Croatian, ++# The OUTPUT_LANGUAGE tag is used to specify the language in which all ++# documentation generated by doxygen is written. Doxygen will use this ++# information to generate all constant output in the proper language. ++# The default language is English, other supported languages are: ++# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, ++# Korean, Hungarian, Norwegian, Spanish, Romanian, Russian, Croatian, + # Polish, Portuguese and Slovene. + + OUTPUT_LANGUAGE = English + +-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +-# documentation are documented, even if no documentation was available. +-# Private class members and static file members will be hidden unless +-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES ++# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in ++# documentation are documented, even if no documentation was available. ++# Private class members and static file members will be hidden unless ++# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + + EXTRACT_ALL = YES + +-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +-# will be included in the documentation. ++# If the EXTRACT_PRIVATE tag is set to YES all private members of a class ++# will be included in the documentation. + + EXTRACT_PRIVATE = NO + +-# If the EXTRACT_STATIC tag is set to YES all static members of a file +-# will be included in the documentation. ++# If the EXTRACT_STATIC tag is set to YES all static members of a file ++# will be included in the documentation. + + EXTRACT_STATIC = NO + +-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +-# undocumented members of documented classes, files or namespaces. +-# If set to NO (the default) these members will be included in the +-# various overviews, but no documentation section is generated. +-# This option has no effect if EXTRACT_ALL is enabled. ++# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all ++# undocumented members of documented classes, files or namespaces. ++# If set to NO (the default) these members will be included in the ++# various overviews, but no documentation section is generated. ++# This option has no effect if EXTRACT_ALL is enabled. + + HIDE_UNDOC_MEMBERS = NO + +-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +-# undocumented classes that are normally visible in the class hierarchy. +-# If set to NO (the default) these class will be included in the various +-# overviews. This option has no effect if EXTRACT_ALL is enabled. ++# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all ++# undocumented classes that are normally visible in the class hierarchy. ++# If set to NO (the default) these class will be included in the various ++# overviews. This option has no effect if EXTRACT_ALL is enabled. + + HIDE_UNDOC_CLASSES = NO + +-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +-# include brief member descriptions after the members that are listed in +-# the file and class documentation (similar to JavaDoc). +-# Set to NO to disable this. ++# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will ++# include brief member descriptions after the members that are listed in ++# the file and class documentation (similar to JavaDoc). ++# Set to NO to disable this. + + BRIEF_MEMBER_DESC = YES + +-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +-# the brief description of a member or function before the detailed description. +-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +-# brief descriptions will be completely suppressed. ++# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend ++# the brief description of a member or function before the detailed description. ++# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the ++# brief descriptions will be completely suppressed. + + REPEAT_BRIEF = YES + +-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +-# Doxygen will generate a detailed section even if there is only a brief +-# description. ++# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then ++# Doxygen will generate a detailed section even if there is only a brief ++# description. + + ALWAYS_DETAILED_SEC = NO + +-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +-# path before files name in the file list and in the header files. If set +-# to NO the shortest path that makes the file name unique will be used. ++# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full ++# path before files name in the file list and in the header files. If set ++# to NO the shortest path that makes the file name unique will be used. + + FULL_PATH_NAMES = NO + +-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +-# can be used to strip a user defined part of the path. Stripping is +-# only done if one of the specified strings matches the left-hand part of ++# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag ++# can be used to strip a user defined part of the path. Stripping is ++# only done if one of the specified strings matches the left-hand part of + # the path. It is allowed to use relative paths in the argument list. + +-STRIP_FROM_PATH = ++STRIP_FROM_PATH = + +-# The INTERNAL_DOCS tag determines if documentation +-# that is typed after a \internal command is included. If the tag is set +-# to NO (the default) then the documentation will be excluded. +-# Set it to YES to include the internal documentation. ++# The INTERNAL_DOCS tag determines if documentation ++# that is typed after a \internal command is included. If the tag is set ++# to NO (the default) then the documentation will be excluded. ++# Set it to YES to include the internal documentation. + + INTERNAL_DOCS = NO + +-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +-# generate a class diagram (in Html and LaTeX) for classes with base or +-# super classes. Setting the tag to NO turns the diagrams off. ++# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will ++# generate a class diagram (in Html and LaTeX) for classes with base or ++# super classes. Setting the tag to NO turns the diagrams off. + + CLASS_DIAGRAMS = YES + +-# If the SOURCE_BROWSER tag is set to YES then a list of source files will +-# be generated. Documented entities will be cross-referenced with these sources. ++# If the SOURCE_BROWSER tag is set to YES then a list of source files will ++# be generated. Documented entities will be cross-referenced with these sources. + + SOURCE_BROWSER = NO + +-# Setting the INLINE_SOURCES tag to YES will include the body +-# of functions and classes directly in the documentation. ++# Setting the INLINE_SOURCES tag to YES will include the body ++# of functions and classes directly in the documentation. + + INLINE_SOURCES = NO + +-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +-# doxygen to hide any special comment blocks from generated source code +-# fragments. Normal C and C++ comments will always remain visible. ++# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct ++# doxygen to hide any special comment blocks from generated source code ++# fragments. Normal C and C++ comments will always remain visible. + + STRIP_CODE_COMMENTS = YES + +-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +-# file names in lower case letters. If set to YES upper case letters are also +-# allowed. This is useful if you have classes or files whose names only differ +-# in case and if your file system supports case sensitive file names. Windows ++# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate ++# file names in lower case letters. If set to YES upper case letters are also ++# allowed. This is useful if you have classes or files whose names only differ ++# in case and if your file system supports case sensitive file names. Windows + # users are adviced to set this option to NO. + + CASE_SENSE_NAMES = YES + +-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +-# will show members with their full class and namespace scopes in the +-# documentation. If set to YES the scope will be hidden. ++# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen ++# will show members with their full class and namespace scopes in the ++# documentation. If set to YES the scope will be hidden. + + HIDE_SCOPE_NAMES = NO + +-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +-# will generate a verbatim copy of the header file for each class for +-# which an include is specified. Set to NO to disable this. ++# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen ++# will generate a verbatim copy of the header file for each class for ++# which an include is specified. Set to NO to disable this. + + VERBATIM_HEADERS = YES + +-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +-# will put list of the files that are included by a file in the documentation +-# of that file. ++# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen ++# will put list of the files that are included by a file in the documentation ++# of that file. + + SHOW_INCLUDE_FILES = YES + +-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +-# will interpret the first line (until the first dot) of a JavaDoc-style +-# comment as the brief description. If set to NO, the JavaDoc +-# comments will behave just like the Qt-style comments (thus requiring an +-# explict @brief command for a brief description. ++# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen ++# will interpret the first line (until the first dot) of a JavaDoc-style ++# comment as the brief description. If set to NO, the JavaDoc ++# comments will behave just like the Qt-style comments (thus requiring an ++# explict @brief command for a brief description. + + JAVADOC_AUTOBRIEF = NO + +-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +-# member inherits the documentation from any documented member that it +-# reimplements. ++# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented ++# member inherits the documentation from any documented member that it ++# reimplements. + + INHERIT_DOCS = YES + +-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +-# is inserted in the documentation for inline members. ++# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] ++# is inserted in the documentation for inline members. + + INLINE_INFO = YES + +-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +-# will sort the (detailed) documentation of file and class members +-# alphabetically by member name. If set to NO the members will appear in +-# declaration order. ++# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen ++# will sort the (detailed) documentation of file and class members ++# alphabetically by member name. If set to NO the members will appear in ++# declaration order. + + SORT_MEMBER_DOCS = YES + +-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +-# tag is set to YES, then doxygen will reuse the documentation of the first +-# member in the group (if any) for the other members of the group. By default ++# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC ++# tag is set to YES, then doxygen will reuse the documentation of the first ++# member in the group (if any) for the other members of the group. By default + # all members of a group must be documented explicitly. + + DISTRIBUTE_GROUP_DOC = NO + +-# The TAB_SIZE tag can be used to set the number of spaces in a tab. +-# Doxygen uses this value to replace tabs by spaces in code fragments. ++# The TAB_SIZE tag can be used to set the number of spaces in a tab. ++# Doxygen uses this value to replace tabs by spaces in code fragments. + + TAB_SIZE = 8 + +-# The ENABLE_SECTIONS tag can be used to enable conditional +-# documentation sections, marked by \if sectionname ... \endif. ++# The ENABLE_SECTIONS tag can be used to enable conditional ++# documentation sections, marked by \if sectionname ... \endif. + +-ENABLED_SECTIONS = ++ENABLED_SECTIONS = + +-# The GENERATE_TODOLIST tag can be used to enable (YES) or +-# disable (NO) the todo list. This list is created by putting \todo ++# The GENERATE_TODOLIST tag can be used to enable (YES) or ++# disable (NO) the todo list. This list is created by putting \todo + # commands in the documentation. + + GENERATE_TODOLIST = YES + +-# The GENERATE_TESTLIST tag can be used to enable (YES) or +-# disable (NO) the test list. This list is created by putting \test ++# The GENERATE_TESTLIST tag can be used to enable (YES) or ++# disable (NO) the test list. This list is created by putting \test + # commands in the documentation. + + GENERATE_TESTLIST = YES + +-# This tag can be used to specify a number of aliases that acts +-# as commands in the documentation. An alias has the form "name=value". +-# For example adding "sideeffect=\par Side Effects:\n" will allow you to +-# put the command \sideeffect (or @sideeffect) in the documentation, which +-# will result in a user defined paragraph with heading "Side Effects:". +-# You can put \n's in the value part of an alias to insert newlines. ++# This tag can be used to specify a number of aliases that acts ++# as commands in the documentation. An alias has the form "name=value". ++# For example adding "sideeffect=\par Side Effects:\n" will allow you to ++# put the command \sideeffect (or @sideeffect) in the documentation, which ++# will result in a user defined paragraph with heading "Side Effects:". ++# You can put \n's in the value part of an alias to insert newlines. + +-ALIASES = ++ALIASES = + + #--------------------------------------------------------------------------- + # configuration options related to warning and progress messages + #--------------------------------------------------------------------------- + +-# The QUIET tag can be used to turn on/off the messages that are generated +-# by doxygen. Possible values are YES and NO. If left blank NO is used. ++# The QUIET tag can be used to turn on/off the messages that are generated ++# by doxygen. Possible values are YES and NO. If left blank NO is used. + + QUIET = NO + +-# The WARNINGS tag can be used to turn on/off the warning messages that are +-# generated by doxygen. Possible values are YES and NO. If left blank +-# NO is used. ++# The WARNINGS tag can be used to turn on/off the warning messages that are ++# generated by doxygen. Possible values are YES and NO. If left blank ++# NO is used. + + WARNINGS = YES + +-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +-# automatically be disabled. ++# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings ++# for undocumented members. If EXTRACT_ALL is set to YES then this flag will ++# automatically be disabled. + + WARN_IF_UNDOCUMENTED = YES + +-# The WARN_FORMAT tag determines the format of the warning messages that +-# doxygen can produce. The string should contain the $file, $line, and $text +-# tags, which will be replaced by the file and line number from which the +-# warning originated and the warning text. ++# The WARN_FORMAT tag determines the format of the warning messages that ++# doxygen can produce. The string should contain the $file, $line, and $text ++# tags, which will be replaced by the file and line number from which the ++# warning originated and the warning text. + + WARN_FORMAT = "$file:$line: $text" + +-# The WARN_LOGFILE tag can be used to specify a file to which warning +-# and error messages should be written. If left blank the output is written +-# to stderr. ++# The WARN_LOGFILE tag can be used to specify a file to which warning ++# and error messages should be written. If left blank the output is written ++# to stderr. + +-WARN_LOGFILE = ++WARN_LOGFILE = + + #--------------------------------------------------------------------------- + # configuration options related to the input files + #--------------------------------------------------------------------------- + +-# The INPUT tag can be used to specify the files and/or directories that contain +-# documented source files. You may enter file names like "myfile.cpp" or +-# directories like "/usr/src/myproject". Separate the files or directories +-# with spaces. ++# The INPUT tag can be used to specify the files and/or directories that contain ++# documented source files. You may enter file names like "myfile.cpp" or ++# directories like "/usr/src/myproject". Separate the files or directories ++# with spaces. + +-INPUT = ++INPUT = + +-# If the value of the INPUT tag contains directories, you can use the +-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +-# and *.h) to filter out the source-files in the directories. If left +-# blank all files are included. ++# If the value of the INPUT tag contains directories, you can use the ++# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp ++# and *.h) to filter out the source-files in the directories. If left ++# blank all files are included. + +-FILE_PATTERNS = ++FILE_PATTERNS = + +-# The RECURSIVE tag can be used to turn specify whether or not subdirectories +-# should be searched for input files as well. Possible values are YES and NO. +-# If left blank NO is used. ++# The RECURSIVE tag can be used to turn specify whether or not subdirectories ++# should be searched for input files as well. Possible values are YES and NO. ++# If left blank NO is used. + + RECURSIVE = NO + +-# The EXCLUDE tag can be used to specify files and/or directories that should +-# excluded from the INPUT source files. This way you can easily exclude a +-# subdirectory from a directory tree whose root is specified with the INPUT tag. ++# The EXCLUDE tag can be used to specify files and/or directories that should ++# excluded from the INPUT source files. This way you can easily exclude a ++# subdirectory from a directory tree whose root is specified with the INPUT tag. + +-EXCLUDE = ++EXCLUDE = + +-# If the value of the INPUT tag contains directories, you can use the +-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +-# certain files from those directories. ++# If the value of the INPUT tag contains directories, you can use the ++# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude ++# certain files from those directories. + +-EXCLUDE_PATTERNS = ++EXCLUDE_PATTERNS = + +-# The EXAMPLE_PATH tag can be used to specify one or more files or +-# directories that contain example code fragments that are included (see +-# the \include command). ++# The EXAMPLE_PATH tag can be used to specify one or more files or ++# directories that contain example code fragments that are included (see ++# the \include command). + +-EXAMPLE_PATH = ++EXAMPLE_PATH = + +-# If the value of the EXAMPLE_PATH tag contains directories, you can use the +-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +-# and *.h) to filter out the source-files in the directories. If left +-# blank all files are included. ++# If the value of the EXAMPLE_PATH tag contains directories, you can use the ++# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp ++# and *.h) to filter out the source-files in the directories. If left ++# blank all files are included. + +-EXAMPLE_PATTERNS = ++EXAMPLE_PATTERNS = + +-# The IMAGE_PATH tag can be used to specify one or more files or +-# directories that contain image that are included in the documentation (see +-# the \image command). ++# The IMAGE_PATH tag can be used to specify one or more files or ++# directories that contain image that are included in the documentation (see ++# the \image command). + +-IMAGE_PATH = ++IMAGE_PATH = + +-# The INPUT_FILTER tag can be used to specify a program that doxygen should +-# invoke to filter for each input file. Doxygen will invoke the filter program +-# by executing (via popen()) the command , where +-# is the value of the INPUT_FILTER tag, and is the name of an +-# input file. Doxygen will then use the output that the filter program writes +-# to standard output. ++# The INPUT_FILTER tag can be used to specify a program that doxygen should ++# invoke to filter for each input file. Doxygen will invoke the filter program ++# by executing (via popen()) the command , where ++# is the value of the INPUT_FILTER tag, and is the name of an ++# input file. Doxygen will then use the output that the filter program writes ++# to standard output. + +-INPUT_FILTER = ++INPUT_FILTER = + +-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +-# INPUT_FILTER) will be used to filter the input files when producing source +-# files to browse. ++# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using ++# INPUT_FILTER) will be used to filter the input files when producing source ++# files to browse. + + FILTER_SOURCE_FILES = NO + +@@ -333,94 +333,94 @@ FILTER_SOURCE_FILES = NO + # configuration options related to the alphabetical class index + #--------------------------------------------------------------------------- + +-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +-# of all compounds will be generated. Enable this if the project +-# contains a lot of classes, structs, unions or interfaces. ++# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index ++# of all compounds will be generated. Enable this if the project ++# contains a lot of classes, structs, unions or interfaces. + + ALPHABETICAL_INDEX = NO + +-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +-# in which this list will be split (can be a number in the range [1..20]) ++# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then ++# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns ++# in which this list will be split (can be a number in the range [1..20]) + + COLS_IN_ALPHA_INDEX = 5 + +-# In case all classes in a project start with a common prefix, all +-# classes will be put under the same header in the alphabetical index. +-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +-# should be ignored while generating the index headers. ++# In case all classes in a project start with a common prefix, all ++# classes will be put under the same header in the alphabetical index. ++# The IGNORE_PREFIX tag can be used to specify one or more prefixes that ++# should be ignored while generating the index headers. + +-IGNORE_PREFIX = ++IGNORE_PREFIX = + + #--------------------------------------------------------------------------- + # configuration options related to the HTML output + #--------------------------------------------------------------------------- + +-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +-# generate HTML output. ++# If the GENERATE_HTML tag is set to YES (the default) Doxygen will ++# generate HTML output. + + GENERATE_HTML = YES + +-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +-# If a relative path is entered the value of OUTPUT_DIRECTORY will be +-# put in front of it. If left blank `html' will be used as the default path. ++# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. ++# If a relative path is entered the value of OUTPUT_DIRECTORY will be ++# put in front of it. If left blank `html' will be used as the default path. + + HTML_OUTPUT = html + +-# The HTML_HEADER tag can be used to specify a personal HTML header for +-# each generated HTML page. If it is left blank doxygen will generate a ++# The HTML_HEADER tag can be used to specify a personal HTML header for ++# each generated HTML page. If it is left blank doxygen will generate a + # standard header. + +-HTML_HEADER = ++HTML_HEADER = + +-# The HTML_FOOTER tag can be used to specify a personal HTML footer for +-# each generated HTML page. If it is left blank doxygen will generate a ++# The HTML_FOOTER tag can be used to specify a personal HTML footer for ++# each generated HTML page. If it is left blank doxygen will generate a + # standard footer. + +-HTML_FOOTER = ++HTML_FOOTER = + +-# The HTML_STYLESHEET tag can be used to specify a user defined cascading +-# style sheet that is used by each HTML page. It can be used to +-# fine-tune the look of the HTML output. If the tag is left blank doxygen +-# will generate a default style sheet ++# The HTML_STYLESHEET tag can be used to specify a user defined cascading ++# style sheet that is used by each HTML page. It can be used to ++# fine-tune the look of the HTML output. If the tag is left blank doxygen ++# will generate a default style sheet + +-HTML_STYLESHEET = ++HTML_STYLESHEET = + +-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +-# files or namespaces will be aligned in HTML using tables. If set to +-# NO a bullet list will be used. ++# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, ++# files or namespaces will be aligned in HTML using tables. If set to ++# NO a bullet list will be used. + + HTML_ALIGN_MEMBERS = YES + +-# If the GENERATE_HTMLHELP tag is set to YES, additional index files +-# will be generated that can be used as input for tools like the +-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +-# of the generated HTML documentation. ++# If the GENERATE_HTMLHELP tag is set to YES, additional index files ++# will be generated that can be used as input for tools like the ++# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) ++# of the generated HTML documentation. + + GENERATE_HTMLHELP = NO + +-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +-# top of each HTML page. The value NO (the default) enables the index and +-# the value YES disables it. ++# The DISABLE_INDEX tag can be used to turn on/off the condensed index at ++# top of each HTML page. The value NO (the default) enables the index and ++# the value YES disables it. + + DISABLE_INDEX = NO + +-# This tag can be used to set the number of enum values (range [1..20]) +-# that doxygen will group on one line in the generated HTML documentation. ++# This tag can be used to set the number of enum values (range [1..20]) ++# that doxygen will group on one line in the generated HTML documentation. + + ENUM_VALUES_PER_LINE = 4 + + # If the GENERATE_TREEVIEW tag is set to YES, a side pannel will be +-# generated containing a tree-like index structure (just like the one that +-# is generated for HTML Help). For this to work a browser that supports +-# JavaScript and frames is required (for instance Netscape 4.0+ +-# or Internet explorer 4.0+). ++# generated containing a tree-like index structure (just like the one that ++# is generated for HTML Help). For this to work a browser that supports ++# JavaScript and frames is required (for instance Netscape 4.0+ ++# or Internet explorer 4.0+). + + GENERATE_TREEVIEW = NO + +-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +-# used to set the initial width (in pixels) of the frame in which the tree +-# is shown. ++# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be ++# used to set the initial width (in pixels) of the frame in which the tree ++# is shown. + + TREEVIEW_WIDTH = 250 + +@@ -428,58 +428,58 @@ TREEVIEW_WIDTH = 250 + # configuration options related to the LaTeX output + #--------------------------------------------------------------------------- + +-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +-# generate Latex output. ++# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will ++# generate Latex output. + + GENERATE_LATEX = YES + +-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +-# If a relative path is entered the value of OUTPUT_DIRECTORY will be +-# put in front of it. If left blank `latex' will be used as the default path. ++# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. ++# If a relative path is entered the value of OUTPUT_DIRECTORY will be ++# put in front of it. If left blank `latex' will be used as the default path. + + LATEX_OUTPUT = latex + +-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +-# LaTeX documents. This may be useful for small projects and may help to +-# save some trees in general. ++# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact ++# LaTeX documents. This may be useful for small projects and may help to ++# save some trees in general. + + COMPACT_LATEX = NO + +-# The PAPER_TYPE tag can be used to set the paper type that is used +-# by the printer. Possible values are: a4, a4wide, letter, legal and +-# executive. If left blank a4wide will be used. ++# The PAPER_TYPE tag can be used to set the paper type that is used ++# by the printer. Possible values are: a4, a4wide, letter, legal and ++# executive. If left blank a4wide will be used. + + PAPER_TYPE = a4wide + +-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +-# packages that should be included in the LaTeX output. ++# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX ++# packages that should be included in the LaTeX output. + +-EXTRA_PACKAGES = ++EXTRA_PACKAGES = + +-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +-# the generated latex document. The header should contain everything until +-# the first chapter. If it is left blank doxygen will generate a +-# standard header. Notice: only use this tag if you know what you are doing! ++# The LATEX_HEADER tag can be used to specify a personal LaTeX header for ++# the generated latex document. The header should contain everything until ++# the first chapter. If it is left blank doxygen will generate a ++# standard header. Notice: only use this tag if you know what you are doing! + +-LATEX_HEADER = ++LATEX_HEADER = + +-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +-# is prepared for conversion to pdf (using ps2pdf). The pdf file will +-# contain links (just like the HTML output) instead of page references +-# This makes the output suitable for online browsing using a pdf viewer. ++# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated ++# is prepared for conversion to pdf (using ps2pdf). The pdf file will ++# contain links (just like the HTML output) instead of page references ++# This makes the output suitable for online browsing using a pdf viewer. + + PDF_HYPERLINKS = NO + +-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +-# plain latex in the generated Makefile. Set this option to YES to get a +-# higher quality PDF documentation. ++# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of ++# plain latex in the generated Makefile. Set this option to YES to get a ++# higher quality PDF documentation. + + USE_PDFLATEX = NO + +-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +-# command to the generated LaTeX files. This will instruct LaTeX to keep +-# running if errors occur, instead of asking the user for help. +-# This option is also used when generating formulas in HTML. ++# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. ++# command to the generated LaTeX files. This will instruct LaTeX to keep ++# running if errors occur, instead of asking the user for help. ++# This option is also used when generating formulas in HTML. + + LATEX_BATCHMODE = NO + +@@ -487,56 +487,56 @@ LATEX_BATCHMODE = NO + # configuration options related to the RTF output + #--------------------------------------------------------------------------- + +-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +-# The RTF output is optimised for Word 97 and may not look very pretty with ++# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output ++# The RTF output is optimised for Word 97 and may not look very pretty with + # other RTF readers or editors. + + GENERATE_RTF = YES + +-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +-# If a relative path is entered the value of OUTPUT_DIRECTORY will be +-# put in front of it. If left blank `rtf' will be used as the default path. ++# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. ++# If a relative path is entered the value of OUTPUT_DIRECTORY will be ++# put in front of it. If left blank `rtf' will be used as the default path. + + RTF_OUTPUT = rtf + +-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +-# RTF documents. This may be useful for small projects and may help to +-# save some trees in general. ++# If the COMPACT_RTF tag is set to YES Doxygen generates more compact ++# RTF documents. This may be useful for small projects and may help to ++# save some trees in general. + + COMPACT_RTF = NO + +-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +-# will contain hyperlink fields. The RTF file will +-# contain links (just like the HTML output) instead of page references. +-# This makes the output suitable for online browsing using a WORD or other. +-# programs which support those fields. +-# Note: wordpad (write) and others do not support links. ++# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated ++# will contain hyperlink fields. The RTF file will ++# contain links (just like the HTML output) instead of page references. ++# This makes the output suitable for online browsing using a WORD or other. ++# programs which support those fields. ++# Note: wordpad (write) and others do not support links. + + RTF_HYPERLINKS = NO + +-# Load stylesheet definitions from file. Syntax is similar to doxygen's +-# config file, i.e. a series of assigments. You only have to provide +-# replacements, missing definitions are set to their default value. ++# Load stylesheet definitions from file. Syntax is similar to doxygen's ++# config file, i.e. a series of assigments. You only have to provide ++# replacements, missing definitions are set to their default value. + +-RTF_STYLESHEET_FILE = ++RTF_STYLESHEET_FILE = + + #--------------------------------------------------------------------------- + # configuration options related to the man page output + #--------------------------------------------------------------------------- + +-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +-# generate man pages ++# If the GENERATE_MAN tag is set to YES (the default) Doxygen will ++# generate man pages + + GENERATE_MAN = YES + +-# The MAN_OUTPUT tag is used to specify where the man pages will be put. +-# If a relative path is entered the value of OUTPUT_DIRECTORY will be +-# put in front of it. If left blank `man' will be used as the default path. ++# The MAN_OUTPUT tag is used to specify where the man pages will be put. ++# If a relative path is entered the value of OUTPUT_DIRECTORY will be ++# put in front of it. If left blank `man' will be used as the default path. + + MAN_OUTPUT = man + +-# The MAN_EXTENSION tag determines the extension that is added to +-# the generated man pages (default is the subroutine's section .3) ++# The MAN_EXTENSION tag determines the extension that is added to ++# the generated man pages (default is the subroutine's section .3) + + MAN_EXTENSION = .3 + +@@ -544,203 +544,203 @@ MAN_EXTENSION = .3 + # configuration options related to the XML output + #--------------------------------------------------------------------------- + +-# If the GENERATE_XML tag is set to YES Doxygen will +-# generate an XML file that captures the structure of +-# the code including all documentation. Warning: This feature ++# If the GENERATE_XML tag is set to YES Doxygen will ++# generate an XML file that captures the structure of ++# the code including all documentation. Warning: This feature + # is still experimental and very incomplete. + + GENERATE_XML = NO + + #--------------------------------------------------------------------------- +-# Configuration options related to the preprocessor ++# Configuration options related to the preprocessor + #--------------------------------------------------------------------------- + +-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +-# evaluate all C-preprocessor directives found in the sources and include +-# files. ++# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will ++# evaluate all C-preprocessor directives found in the sources and include ++# files. + + ENABLE_PREPROCESSING = YES + +-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +-# names in the source code. If set to NO (the default) only conditional +-# compilation will be performed. Macro expansion can be done in a controlled +-# way by setting EXPAND_ONLY_PREDEF to YES. ++# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro ++# names in the source code. If set to NO (the default) only conditional ++# compilation will be performed. Macro expansion can be done in a controlled ++# way by setting EXPAND_ONLY_PREDEF to YES. + + MACRO_EXPANSION = NO + +-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +-# then the macro expansion is limited to the macros specified with the +-# PREDEFINED and EXPAND_AS_PREDEFINED tags. ++# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES ++# then the macro expansion is limited to the macros specified with the ++# PREDEFINED and EXPAND_AS_PREDEFINED tags. + + EXPAND_ONLY_PREDEF = NO + +-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +-# in the INCLUDE_PATH (see below) will be search if a #include is found. ++# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files ++# in the INCLUDE_PATH (see below) will be search if a #include is found. + + SEARCH_INCLUDES = YES + +-# The INCLUDE_PATH tag can be used to specify one or more directories that +-# contain include files that are not input files but should be processed by +-# the preprocessor. ++# The INCLUDE_PATH tag can be used to specify one or more directories that ++# contain include files that are not input files but should be processed by ++# the preprocessor. + +-INCLUDE_PATH = ++INCLUDE_PATH = + +-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +-# patterns (like *.h and *.hpp) to filter out the header-files in the +-# directories. If left blank, the patterns specified with FILE_PATTERNS will +-# be used. ++# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard ++# patterns (like *.h and *.hpp) to filter out the header-files in the ++# directories. If left blank, the patterns specified with FILE_PATTERNS will ++# be used. + +-INCLUDE_FILE_PATTERNS = ++INCLUDE_FILE_PATTERNS = + +-# The PREDEFINED tag can be used to specify one or more macro names that +-# are defined before the preprocessor is started (similar to the -D option of +-# gcc). The argument of the tag is a list of macros of the form: name +-# or name=definition (no spaces). If the definition and the = are +-# omitted =1 is assumed. ++# The PREDEFINED tag can be used to specify one or more macro names that ++# are defined before the preprocessor is started (similar to the -D option of ++# gcc). The argument of the tag is a list of macros of the form: name ++# or name=definition (no spaces). If the definition and the = are ++# omitted =1 is assumed. + +-PREDEFINED = ++PREDEFINED = + +-# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +-# this tag can be used to specify a list of macro names that should be expanded. +-# The macro definition that is found in the sources will be used. +-# Use the PREDEFINED tag if you want to use a different macro definition. ++# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then ++# this tag can be used to specify a list of macro names that should be expanded. ++# The macro definition that is found in the sources will be used. ++# Use the PREDEFINED tag if you want to use a different macro definition. + +-EXPAND_AS_DEFINED = ++EXPAND_AS_DEFINED = + + #--------------------------------------------------------------------------- +-# Configuration::addtions related to external references ++# Configuration::addtions related to external references + #--------------------------------------------------------------------------- + +-# The TAGFILES tag can be used to specify one or more tagfiles. ++# The TAGFILES tag can be used to specify one or more tagfiles. + +-TAGFILES = ++TAGFILES = + +-# When a file name is specified after GENERATE_TAGFILE, doxygen will create +-# a tag file that is based on the input files it reads. ++# When a file name is specified after GENERATE_TAGFILE, doxygen will create ++# a tag file that is based on the input files it reads. + +-GENERATE_TAGFILE = ++GENERATE_TAGFILE = + +-# If the ALLEXTERNALS tag is set to YES all external classes will be listed +-# in the class index. If set to NO only the inherited external classes +-# will be listed. ++# If the ALLEXTERNALS tag is set to YES all external classes will be listed ++# in the class index. If set to NO only the inherited external classes ++# will be listed. + + ALLEXTERNALS = NO + +-# The PERL_PATH should be the absolute path and name of the perl script +-# interpreter (i.e. the result of `which perl'). ++# The PERL_PATH should be the absolute path and name of the perl script ++# interpreter (i.e. the result of `which perl'). + + PERL_PATH = /usr/bin/perl + + #--------------------------------------------------------------------------- +-# Configuration options related to the dot tool ++# Configuration options related to the dot tool + #--------------------------------------------------------------------------- + +-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +-# available from the path. This tool is part of Graphviz, a graph visualization +-# toolkit from AT&T and Lucent Bell Labs. The other options in this section +-# have no effect if this option is set to NO (the default) ++# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is ++# available from the path. This tool is part of Graphviz, a graph visualization ++# toolkit from AT&T and Lucent Bell Labs. The other options in this section ++# have no effect if this option is set to NO (the default) + + HAVE_DOT = NO + +-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +-# will generate a graph for each documented class showing the direct and +-# indirect inheritance relations. Setting this tag to YES will force the ++# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen ++# will generate a graph for each documented class showing the direct and ++# indirect inheritance relations. Setting this tag to YES will force the + # the CLASS_DIAGRAMS tag to NO. + + CLASS_GRAPH = YES + +-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +-# will generate a graph for each documented class showing the direct and +-# indirect implementation dependencies (inheritance, containment, and +-# class references variables) of the class with other documented classes. ++# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen ++# will generate a graph for each documented class showing the direct and ++# indirect implementation dependencies (inheritance, containment, and ++# class references variables) of the class with other documented classes. + + COLLABORATION_GRAPH = YES + +-# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to +-# YES then doxygen will generate a graph for each documented file showing +-# the direct and indirect include dependencies of the file with other +-# documented files. ++# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to ++# YES then doxygen will generate a graph for each documented file showing ++# the direct and indirect include dependencies of the file with other ++# documented files. + + INCLUDE_GRAPH = YES + +-# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to +-# YES then doxygen will generate a graph for each documented header file showing +-# the documented files that directly or indirectly include this file ++# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to ++# YES then doxygen will generate a graph for each documented header file showing ++# the documented files that directly or indirectly include this file + + INCLUDED_BY_GRAPH = YES + +-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +-# will graphical hierarchy of all classes instead of a textual one. ++# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen ++# will graphical hierarchy of all classes instead of a textual one. + + GRAPHICAL_HIERARCHY = YES + +-# The tag DOT_PATH can be used to specify the path where the dot tool can be +-# found. If left blank, it is assumed the dot tool can be found on the path. ++# The tag DOT_PATH can be used to specify the path where the dot tool can be ++# found. If left blank, it is assumed the dot tool can be found on the path. + +-DOT_PATH = ++DOT_PATH = + +-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +-# (in pixels) of the graphs generated by dot. If a graph becomes larger than +-# this value, doxygen will try to truncate the graph, so that it fits within +-# the specified constraint. Beware that most browsers cannot cope with very +-# large images. ++# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width ++# (in pixels) of the graphs generated by dot. If a graph becomes larger than ++# this value, doxygen will try to truncate the graph, so that it fits within ++# the specified constraint. Beware that most browsers cannot cope with very ++# large images. + + MAX_DOT_GRAPH_WIDTH = 1024 + +-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +-# (in pixels) of the graphs generated by dot. If a graph becomes larger than +-# this value, doxygen will try to truncate the graph, so that it fits within +-# the specified constraint. Beware that most browsers cannot cope with very +-# large images. ++# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height ++# (in pixels) of the graphs generated by dot. If a graph becomes larger than ++# this value, doxygen will try to truncate the graph, so that it fits within ++# the specified constraint. Beware that most browsers cannot cope with very ++# large images. + + MAX_DOT_GRAPH_HEIGHT = 1024 + +-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +-# generate a legend page explaining the meaning of the various boxes and +-# arrows in the dot generated graphs. ++# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will ++# generate a legend page explaining the meaning of the various boxes and ++# arrows in the dot generated graphs. + + GENERATE_LEGEND = YES + + #--------------------------------------------------------------------------- +-# Configuration::addtions related to the search engine ++# Configuration::addtions related to the search engine + #--------------------------------------------------------------------------- + +-# The SEARCHENGINE tag specifies whether or not a search engine should be +-# used. If set to NO the values of all tags below this one will be ignored. ++# The SEARCHENGINE tag specifies whether or not a search engine should be ++# used. If set to NO the values of all tags below this one will be ignored. + + SEARCHENGINE = NO + +-# The CGI_NAME tag should be the name of the CGI script that +-# starts the search engine (doxysearch) with the correct parameters. +-# A script with this name will be generated by doxygen. ++# The CGI_NAME tag should be the name of the CGI script that ++# starts the search engine (doxysearch) with the correct parameters. ++# A script with this name will be generated by doxygen. + + CGI_NAME = search.cgi + +-# The CGI_URL tag should be the absolute URL to the directory where the +-# cgi binaries are located. See the documentation of your http daemon for +-# details. ++# The CGI_URL tag should be the absolute URL to the directory where the ++# cgi binaries are located. See the documentation of your http daemon for ++# details. + +-CGI_URL = ++CGI_URL = + +-# The DOC_URL tag should be the absolute URL to the directory where the +-# documentation is located. If left blank the absolute path to the +-# documentation, with file:// prepended to it, will be used. ++# The DOC_URL tag should be the absolute URL to the directory where the ++# documentation is located. If left blank the absolute path to the ++# documentation, with file:// prepended to it, will be used. + +-DOC_URL = ++DOC_URL = + +-# The DOC_ABSPATH tag should be the absolute path to the directory where the +-# documentation is located. If left blank the directory on the local machine +-# will be used. ++# The DOC_ABSPATH tag should be the absolute path to the directory where the ++# documentation is located. If left blank the directory on the local machine ++# will be used. + +-DOC_ABSPATH = ++DOC_ABSPATH = + +-# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +-# is installed. ++# The BIN_ABSPATH tag must point to the directory where the doxysearch binary ++# is installed. + + BIN_ABSPATH = /usr/local/bin/ + +-# The EXT_DOC_PATHS tag can be used to specify one or more paths to +-# documentation generated for other projects. This allows doxysearch to search +-# the documentation for these projects as well. ++# The EXT_DOC_PATHS tag can be used to specify one or more paths to ++# documentation generated for other projects. This allows doxysearch to search ++# the documentation for these projects as well. + +-EXT_DOC_PATHS = ++EXT_DOC_PATHS = +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt +index 5b78469..c1390fa 100644 +--- a/examples/CMakeLists.txt ++++ b/examples/CMakeLists.txt +@@ -1,15 +1,14 @@ + #File Generated by Hans J. Johnson + #Please contact hans-johnson@uiowa.edu for making enhancments/corrections +-PROJECT(FSLEXAMPLES) + +-INCLUDE_DIRECTORIES(${NIFTILIB_SOURCE_DIR} ${ZNZLIB_SOURCE_DIR} ${FSLIOLIB_SOURCE_DIR} ) ++include_directories(${NIFTI_SOURCE_DIR}/niftilib ${NIFTI_SOURCE_DIR}/znzlib ${NIFTI_SOURCE_DIR}/nifticdf) + +-ADD_EXECUTABLE( ${PACKAGE_PREFIX}fsl_api_driver fsl_api_driver.c ) +-TARGET_LINK_LIBRARIES( fsl_api_driver ${PACKAGE_PREFIX}fslio) ++add_executable( ${PACKAGE_PREFIX}fsl_api_driver fsl_api_driver.c ) ++target_link_libraries( fsl_api_driver ${PACKAGE_PREFIX}fslio) + +-IF(NOT NIFTI_INSTALL_NO_LIBRARIES) +- INSTALL(TARGETS ${PACKAGE_PREFIX}fsl_api_driver ++if(NOT NIFTI_INSTALL_NO_LIBRARIES) ++ install(TARGETS ${PACKAGE_PREFIX}fsl_api_driver + RUNTIME DESTINATION ${NIFTI_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_LIBRARIES) ++endif(NOT NIFTI_INSTALL_NO_LIBRARIES) +diff --git a/examples/fsl_api_driver.c b/examples/fsl_api_driver.c +index 88a0e6a..e412115 100644 +--- a/examples/fsl_api_driver.c ++++ b/examples/fsl_api_driver.c +@@ -2,11 +2,11 @@ + * + * fsl_api_driver.c + * +- * Test fslio API ++ * Test fslio API + * + * Usage: fsl_api_driver [params] + * +- * ++ * + * print + * print dataset header fields + * peek X Y Z T +diff --git a/fsliolib/CMakeLists.txt b/fsliolib/CMakeLists.txt +index fa24262..58dec42 100644 +--- a/fsliolib/CMakeLists.txt ++++ b/fsliolib/CMakeLists.txt +@@ -1,32 +1,31 @@ + #File Generated by Hans J. Johnson + #Please contact hans-johnson@uiowa.edu for making enhancments/corrections +-PROJECT(FSLIOLIB) + +-INCLUDE_DIRECTORIES(${NIFTILIB_SOURCE_DIR} ${ZNZLIB_SOURCE_DIR}) +-SET(FSLIOLIB_SRC fslio.c) ++include_directories(${NIFTILIB_SOURCE_DIR} ${ZNZLIB_SOURCE_DIR}) ++set(FSLIOLIB_SRC fslio.c) + + # Michael Hanke 2004-04-25: + # Restructure the file to match those of niftilib and znzlib +-SET(NIFTI_FSLIOLIB_NAME ${PACKAGE_PREFIX}fslio) ++set(NIFTI_FSLIOLIB_NAME ${PACKAGE_PREFIX}fslio) + +-ADD_LIBRARY(${NIFTI_FSLIOLIB_NAME} ${FSLIOLIB_SRC} ) +-TARGET_LINK_LIBRARIES( ${NIFTI_FSLIOLIB_NAME} ${PACKAGE_PREFIX}niftiio) ++add_library(${NIFTI_FSLIOLIB_NAME} ${FSLIOLIB_SRC} ) ++target_link_libraries( ${NIFTI_FSLIOLIB_NAME} ${PACKAGE_PREFIX}niftiio) + + # Set lib version when buildung shared libs. +-IF (BUILD_SHARED_LIBS) +- SET_TARGET_PROPERTIES(${NIFTI_FSLIOLIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) +-ENDIF (BUILD_SHARED_LIBS) ++if(BUILD_SHARED_LIBS) ++ set_target_properties(${NIFTI_FSLIOLIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) ++endif(BUILD_SHARED_LIBS) + +-IF(NOT NIFTI_INSTALL_NO_LIBRARIES) +- INSTALL(TARGETS ${NIFTI_FSLIOLIB_NAME} ++if(NOT NIFTI_INSTALL_NO_LIBRARIES) ++ install(TARGETS ${NIFTI_FSLIOLIB_NAME} + RUNTIME DESTINATION ${NIFTI_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_LIBRARIES) ++endif(NOT NIFTI_INSTALL_NO_LIBRARIES) + +-IF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) +- FILE(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +- INSTALL(FILES ${__files} ++if(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++ file(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") ++ install(FILES ${__files} + DESTINATION ${NIFTI_INSTALL_INCLUDE_DIR} + COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++endif(NOT NIFTI_INSTALL_NO_DEVELOPMENT) +diff --git a/fsliolib/dbh.h b/fsliolib/dbh.h +index eff0a50..8a264c0 100644 +--- a/fsliolib/dbh.h ++++ b/fsliolib/dbh.h +@@ -2,7 +2,7 @@ + #define _DBH_H_ + + /* +- * ++ * + * (c) Copyright, 1986-1994 + * Biomedical Imaging Resource + * Mayo Foundation +@@ -34,7 +34,7 @@ struct image_dimension /* image_dimension */ + short int bitpix; /* 32 + 2 */ + short int dim_un0; /* 34 + 2 */ + float pixdim[8]; /* 36 + 32 */ +- /* ++ /* + pixdim[] specifies the voxel dimensions: + pixdim[1] - voxel width + pixdim[2] - voxel height +@@ -51,7 +51,7 @@ struct image_dimension /* image_dimension */ + int verified; /* 96 + 4 */ + int glmax, glmin; /* 100 + 8 */ + }; /* total=108 */ +- ++ + struct data_history /* data_history */ + { /* off + size*/ + char descrip[80]; /* 0 + 80 */ +@@ -78,7 +78,7 @@ struct dsr /* dsr */ + struct image_dimension dime; /* 40 + 108 */ + struct data_history hist; /* 148 + 200 */ + }; /* total=348 */ +- ++ + /* Acceptable values for hdr.dime.datatype */ + + #define DT_NONE 0 +@@ -93,7 +93,7 @@ struct dsr /* dsr */ + #define DT_RGB 128 + #define DT_ALL 255 + +-typedef struct ++typedef struct + { + float real; + float imag; +diff --git a/fsliolib/fslio.c b/fsliolib/fslio.c +index 820d5f1..bc9afad 100644 +--- a/fsliolib/fslio.c ++++ b/fsliolib/fslio.c +@@ -6,20 +6,20 @@ + */ + + +- ++ + /* + + The fslio.c file was originally part of FSL - FMRIB's Software Library + http://www.fmrib.ox.ac.uk/fsl + fslio.c has now been placed in the public domain. +- ++ + Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + Imaging of the Brain), Department of Clinical Neurology, Oxford + University, Oxford, UK +- ++ + */ + +-/** \file fslio.c ++/** \file fslio.c + \brief Main collection of FSL i/o routines, written by Mark Jenkinson, FMRIB + + - updates by Rick Reynolds, SSCC, NIMH +@@ -58,8 +58,8 @@ char* FslFileTypeString(int filetype) + + int FslIsValidFileType(int filetype) + { +- if ( (filetype!=FSL_TYPE_ANALYZE) && (filetype!=FSL_TYPE_ANALYZE_GZ) && +- (filetype!=FSL_TYPE_NIFTI) && (filetype!=FSL_TYPE_NIFTI_GZ) && ++ if ( (filetype!=FSL_TYPE_ANALYZE) && (filetype!=FSL_TYPE_ANALYZE_GZ) && ++ (filetype!=FSL_TYPE_NIFTI) && (filetype!=FSL_TYPE_NIFTI_GZ) && + (filetype!=FSL_TYPE_NIFTI_PAIR) && (filetype!=FSL_TYPE_NIFTI_PAIR_GZ) && + (filetype!=FSL_TYPE_MINC) && (filetype!=FSL_TYPE_MINC_GZ) ) { + fprintf(stderr,"Error: unrecognised file type: %d\n",filetype); +@@ -78,7 +78,7 @@ int FslBaseFileType(int filetype) + return FSL_TYPE_NIFTI; + if ( (filetype==FSL_TYPE_NIFTI_PAIR_GZ) || (filetype==FSL_TYPE_NIFTI_PAIR) ) + return FSL_TYPE_NIFTI_PAIR; +- if ( (filetype==FSL_TYPE_MINC_GZ) || (filetype==FSL_TYPE_MINC) ) ++ if ( (filetype==FSL_TYPE_MINC_GZ) || (filetype==FSL_TYPE_MINC) ) + return FSL_TYPE_MINC; + fprintf(stderr,"Error: unrecognised file type (%d)\n",filetype); + return -1; +@@ -109,7 +109,7 @@ int FslGetFileType2(const FSLIO *fslio, int quiet) + } + + int FslGetFileType(const FSLIO *fslio) +-{ ++{ + return FslGetFileType2(fslio,0); + } + +@@ -122,10 +122,10 @@ void FslSetFileType(FSLIO *fslio, int filetype) + fslio->file_mode = filetype; + return; + } +- if (! FslIsValidFileType(filetype)) { return; } ++ if (! FslIsValidFileType(filetype)) { return; } + fslio->file_mode = filetype; /* indicates general nifti - details in niftiptr */ +- if (fslio->niftiptr!=NULL) { +- fslio->niftiptr->nifti_type = FslBaseFileType(filetype); ++ if (fslio->niftiptr!=NULL) { ++ fslio->niftiptr->nifti_type = FslBaseFileType(filetype); + nifti_set_iname_offset(fslio->niftiptr); + } + } +@@ -134,7 +134,7 @@ void FslSetFileType(FSLIO *fslio, int filetype) + + int FslIsSingleFileType(int filetype) + { +- if ( (filetype==FSL_TYPE_NIFTI) || (filetype==FSL_TYPE_NIFTI_GZ) || ++ if ( (filetype==FSL_TYPE_NIFTI) || (filetype==FSL_TYPE_NIFTI_GZ) || + (filetype==FSL_TYPE_MINC) || (filetype==FSL_TYPE_MINC_GZ) ) + return 1; + return 0; +@@ -152,7 +152,7 @@ int FslGetWriteMode(const FSLIO *fslio) + { + if (fslio==NULL) FSLIOERR("FslGetWriteMode: Null pointer passed for FSLIO"); + return fslio->write_mode; +-} ++} + + + void FslSetWriteMode(FSLIO *fslio, int mode) +@@ -188,9 +188,9 @@ int FslGetEnvOutputType(void) + exit(EXIT_FAILURE); + return -1; + } +- + +-int FslFileType(const char* fname) ++ ++int FslFileType(const char* fname) + { + /* return type is FSL_TYPE_* or -1 to indicate undetermined */ + /* use name as first priority but if that is ambiguous then resolve using environment */ +@@ -212,7 +212,7 @@ int FslFileType(const char* fname) + if (strcmp(fname + flen - 7,".img.gz")==0) retval=FSL_TYPE_NIFTI_PAIR_GZ; + if ( (retval==FSL_TYPE_NIFTI_PAIR) || (retval==FSL_TYPE_NIFTI_PAIR_GZ) ) { + /* If it was hdr or img, check if Analyze was requested by environment */ +- if ( (FslGetEnvOutputType() == FSL_TYPE_ANALYZE) && (retval == FSL_TYPE_NIFTI_PAIR) ) ++ if ( (FslGetEnvOutputType() == FSL_TYPE_ANALYZE) && (retval == FSL_TYPE_NIFTI_PAIR) ) + retval=FSL_TYPE_ANALYZE; + if ( (FslGetEnvOutputType() == FSL_TYPE_ANALYZE_GZ) && (retval == FSL_TYPE_NIFTI_PAIR_GZ) ) + retval=FSL_TYPE_ANALYZE_GZ; +@@ -225,10 +225,10 @@ int FslFileType(const char* fname) + * FslGetReadFileType + ************************************************************/ + /*! \fn int FslGetReadFileType(const FSLIO *fslio) +- \brief return the best estimate of the true file type ++ \brief return the best estimate of the true file type + + This function is used to return the best estimate of the true file type once +- a simple open has occurred - for now it is used after a nifti open call is made ++ a simple open has occurred - for now it is used after a nifti open call is made + + \param fslio data structure + \return FSL_TYPE filetype code +@@ -239,7 +239,7 @@ int FslGetReadFileType(const FSLIO *fslio) + int filetype=FSL_TYPE_ANALYZE; /* unused default */ + if (fslio==NULL) FSLIOERR("FslReadGetFileType: Null pointer passed for FSLIO"); + /* Don't use fslio->file_mode as it hasn't been set yet */ +- if (fslio->niftiptr!=NULL) { ++ if (fslio->niftiptr!=NULL) { + /* use the nifti_type and hdr or img name to determine the actual type */ + if (fslio->niftiptr->nifti_type == FSL_TYPE_ANALYZE) { + if (FslIsCompressedFileType(FslFileType(fslio->niftiptr->iname))) { +@@ -262,9 +262,9 @@ int FslGetReadFileType(const FSLIO *fslio) + filetype = FSL_TYPE_NIFTI; + } + } +- ++ + } +- if (fslio->mincptr!=NULL) { ++ if (fslio->mincptr!=NULL) { + fprintf(stderr,"Warning:: Minc is not yet supported\n"); + filetype = FSL_TYPE_MINC; + } +@@ -273,7 +273,7 @@ int FslGetReadFileType(const FSLIO *fslio) + + + int FslFileExists(const char *filename) +-{ ++{ + /* return 1 if file(s) exists, otherwise return 0 */ + char *hdrname = nifti_findhdrname(filename); + char *imgname = NULL; +@@ -302,7 +302,7 @@ char *FslMakeBaseName(const char *fname) + } + + +-void FslGetHdrImgNames(const char* filename, const FSLIO* fslio, ++void FslGetHdrImgNames(const char* filename, const FSLIO* fslio, + char** hdrname, char** imgname) + { + char *basename; +@@ -352,7 +352,7 @@ void FslGetHdrImgNames(const char* filename, const FSLIO* fslio, + + fprintf(stderr,"Error: Unrecognised filetype (%d)\n",FslGetFileType(fslio)); + free(basename); +- ++ + /* Failure */ + *hdrname = NULL; + *imgname = NULL; +@@ -364,7 +364,7 @@ void FslGetHdrImgNames(const char* filename, const FSLIO* fslio, + * FslInit() + ***************************************************************/ + /*! \fn FSLIO *FslInit() +- \brief allocate space for the FSLIO struct and set some sensible defaults ++ \brief allocate space for the FSLIO struct and set some sensible defaults + \return A pointer to an initialized FSLIO data structure + */ + FSLIO *FslInit(void) +@@ -389,7 +389,7 @@ void FslSetInit(FSLIO* fslio) + + void FslInit4Write(FSLIO* fslio, const char* filename, int ft) + { +- /* ft determines filetype if ft>=0*/ ++ /* ft determines filetype if ft>=0*/ + int imgtype; + + FslSetWriteMode(fslio,1); +@@ -404,17 +404,17 @@ void FslInit4Write(FSLIO* fslio, const char* filename, int ft) + fprintf(stderr,"Error: Failed to determine file type for writing in FslOpen()\n"); + exit(EXIT_FAILURE); + } +- ++ + if ( (FslBaseFileType(imgtype)!=FSL_TYPE_MINC) ) { + FslInitHeader(fslio, NIFTI_TYPE_FLOAT32, + 1, 1, 1, 3, 0.0, 0.0, 0.0, 0.0, 4, "mm"); +- ++ + FslSetFileType(fslio,imgtype); /* this is after InitHeader as niftiptr set there */ +- ++ + /* determine the header and image filename */ + FslGetHdrImgNames(filename,fslio,&(fslio->niftiptr->fname),&(fslio->niftiptr->iname)); +- if ( (fslio->niftiptr->fname == NULL) || (fslio->niftiptr->iname == NULL) ) { +- fprintf(stderr,"Error: cannot find filenames for %s\n",filename); ++ if ( (fslio->niftiptr->fname == NULL) || (fslio->niftiptr->iname == NULL) ) { ++ fprintf(stderr,"Error: cannot find filenames for %s\n",filename); + } + + } else if (FslBaseFileType(imgtype)==FSL_TYPE_MINC) { +@@ -430,7 +430,7 @@ void FslInit4Write(FSLIO* fslio, const char* filename, int ft) + + + +-void FslInitHeader(FSLIO *fslio, short t, ++void FslInitHeader(FSLIO *fslio, short t, + size_t x, size_t y, size_t z, size_t v, + float vx, float vy, float vz, float tr, + size_t dim, +@@ -439,7 +439,7 @@ void FslInitHeader(FSLIO *fslio, short t, + /* NB: This function does not set the file type or write mode*/ + + if (fslio==NULL) FSLIOERR("FslInitHeader: Null pointer passed for FSLIO"); +- ++ + fslio->niftiptr = nifti_simple_init_nim(); + /* make nifti type consistent with fslio */ + fslio->niftiptr->nifti_type = FslBaseFileType(fslio->file_mode); +@@ -457,7 +457,7 @@ void FslInitHeader(FSLIO *fslio, short t, + void FslCloneHeader(FSLIO *dest, const FSLIO *src) + { + /* only clone the information that is stored in the disk version of the header */ +- /* - therefore _not_ the filenames, output type, write mode, etc */ ++ /* - therefore _not_ the filenames, output type, write mode, etc */ + + char *fname=NULL, *iname=NULL; + void *data=NULL; +@@ -482,15 +482,15 @@ void FslCloneHeader(FSLIO *dest, const FSLIO *src) + + /* restore old values */ + if (preserve_nifti_values) { +- dest->niftiptr->data = data; +- } else { ++ dest->niftiptr->data = data; ++ } else { + /* destroy the values that the nifti copy creates */ + free(dest->niftiptr->fname); + free(dest->niftiptr->iname); + nifti_free_extensions(dest->niftiptr); + + dest->niftiptr->fname = NULL; +- dest->niftiptr->iname = NULL; ++ dest->niftiptr->iname = NULL; + dest->niftiptr->data = NULL; /* should already be NULL */ + } + FslSetFileType(dest,filetype); +@@ -521,32 +521,32 @@ int FslCheckForMultipleFileNames(const char* filename) + tmpname = (char *)calloc(strlen(basename) + 10,sizeof(char)); + + strcpy(tmpname,basename); +- strcat(tmpname,".nii"); ++ strcat(tmpname,".nii"); + if (fsl_fileexists(tmpname)) { singlecount++; } + strcpy(tmpname,basename); +- strcat(tmpname,".nii.gz"); ++ strcat(tmpname,".nii.gz"); + if (fsl_fileexists(tmpname)) { singlecount++; } + strcpy(tmpname,basename); +- strcat(tmpname,".mnc"); ++ strcat(tmpname,".mnc"); + if (fsl_fileexists(tmpname)) { singlecount++; } + strcpy(tmpname,basename); +- strcat(tmpname,".mnc.gz"); ++ strcat(tmpname,".mnc.gz"); + if (fsl_fileexists(tmpname)) { singlecount++; } + + strcpy(tmpname,basename); +- strcat(tmpname,".img"); ++ strcat(tmpname,".img"); + if (fsl_fileexists(tmpname)) { imgcount++; } + strcpy(tmpname,basename); +- strcat(tmpname,".img.gz"); ++ strcat(tmpname,".img.gz"); + if (fsl_fileexists(tmpname)) { imgcount++; } + + strcpy(tmpname,basename); +- strcat(tmpname,".hdr"); ++ strcat(tmpname,".hdr"); + if (fsl_fileexists(tmpname)) { hdrcount++; } + strcpy(tmpname,basename); +- strcat(tmpname,".hdr.gz"); ++ strcat(tmpname,".hdr.gz"); + if (fsl_fileexists(tmpname)) { hdrcount++; } +- ++ + ambiguous = 1; + if ( (hdrcount==1) && (imgcount==1) && (singlecount==0) ) { ambiguous=0; } + if ( (hdrcount==0) && (imgcount==0) && (singlecount==1) ) { ambiguous=0; } +@@ -572,28 +572,28 @@ int check_for_multiple_filenames(const char* filename) + fprintf(stderr,"\n\n\nWARNING!!!! Multiple image files detected:\n"); + /* list the offending files */ + strcpy(tmpname,basename); +- strcat(tmpname,".nii"); ++ strcat(tmpname,".nii"); + if (fsl_fileexists(tmpname)) { fprintf(stderr,"%s ",tmpname); } + strcpy(tmpname,basename); +- strcat(tmpname,".nii.gz"); ++ strcat(tmpname,".nii.gz"); + if (fsl_fileexists(tmpname)) { fprintf(stderr,"%s ",tmpname); } + strcpy(tmpname,basename); +- strcat(tmpname,".mnc"); ++ strcat(tmpname,".mnc"); + if (fsl_fileexists(tmpname)) { fprintf(stderr,"%s ",tmpname); } + strcpy(tmpname,basename); +- strcat(tmpname,".mnc.gz"); ++ strcat(tmpname,".mnc.gz"); + if (fsl_fileexists(tmpname)) { fprintf(stderr,"%s ",tmpname); } + strcpy(tmpname,basename); +- strcat(tmpname,".img"); ++ strcat(tmpname,".img"); + if (fsl_fileexists(tmpname)) { fprintf(stderr,"%s ",tmpname); } + strcpy(tmpname,basename); +- strcat(tmpname,".img.gz"); ++ strcat(tmpname,".img.gz"); + if (fsl_fileexists(tmpname)) { fprintf(stderr,"%s ",tmpname); } + strcpy(tmpname,basename); +- strcat(tmpname,".hdr"); ++ strcat(tmpname,".hdr"); + if (fsl_fileexists(tmpname)) { fprintf(stderr,"%s ",tmpname); } + strcpy(tmpname,basename); +- strcat(tmpname,".hdr.gz"); ++ strcat(tmpname,".hdr.gz"); + if (fsl_fileexists(tmpname)) { fprintf(stderr,"%s ",tmpname); } + fprintf(stderr,"\n\n"); + +@@ -615,9 +615,9 @@ int check_for_multiple_filenames(const char* filename) + * FslOpen + ***************************************************************/ + /*! \fn FSLIO *FslOpen(const char *filename, const char *opts) +- \brief Opens a file for either reading or writing. ++ \brief Opens a file for either reading or writing. + +- The format of the output dataset is determined automatically by ++ The format of the output dataset is determined automatically by + passing filetype -1 to FslXOpen. + \sa FslXOpen + */ +@@ -634,16 +634,16 @@ FSLIO *FslOpen(const char *filename, const char *opts) + /*! \fn FSLIO *FslXOpen(const char *filename, const char *opts, int filetype) + \brief Opens a file for either reading or writing + +- Files to be read are automatically read whether +- compressed or not. Also, reading uses the file extension ++ Files to be read are automatically read whether ++ compressed or not. Also, reading uses the file extension + and will fail if that file does not exist. +- For a more robust read, pass the basename in as then all types ++ For a more robust read, pass the basename in as then all types + will be tried. + \param filename Name (or basename) of the file to open + \param opts Flags for fopen() of dataset, eg "r", "wb", etc. + \param filetype specifies the type of file to be written. Legal +- values are as defined by FSL_TYPE. If filetype is less than +- zero, then it is ignored and the type is determined by the ++ values are as defined by FSL_TYPE. If filetype is less than ++ zero, then it is ignored and the type is determined by the + filename extension or, failing that, the environment default. + \return pointer to FSLIO dataset datastructure + \sa FSLIO +@@ -667,20 +667,20 @@ FSLIO *FslXOpen(const char *filename, const char *opts, int filetype) + /* add in 'b' (at the end) for windows compatibility */ + bopts[bi++]='b'; + bopts[bi]='\0'; +- ++ + + if (FslGetWriteMode(fslio)==1) { +- ++ + /** ====================== Open file for writing ====================== **/ +- ++ + FslInit4Write(fslio,filename,filetype); + imgtype = FslGetFileType(fslio); + fslio->written_hdr = 0; + + /* open the image file - not the header */ + fslio->fileptr = znzopen(fslio->niftiptr->iname,bopts,FslIsCompressedFileType(imgtype)); +- if (znz_isnull(fslio->fileptr)) { +- fprintf(stderr,"Error: failed to open file %s\n",fslio->niftiptr->iname); ++ if (znz_isnull(fslio->fileptr)) { ++ fprintf(stderr,"Error: failed to open file %s\n",fslio->niftiptr->iname); + return NULL; + } + +@@ -707,8 +707,8 @@ FSLIO *FslXOpen(const char *filename, const char *opts, int filetype) + + /* otherwise open nifti file: read header and open img file (may be same file) */ + fslio->fileptr = nifti_image_open(filename,bopts,&(fslio->niftiptr)); +- if (znz_isnull(fslio->fileptr)) { +- fprintf(stderr,"Error: failed to open file %s\n",filename); ++ if (znz_isnull(fslio->fileptr)) { ++ fprintf(stderr,"Error: failed to open file %s\n",filename); + return NULL; + } + +@@ -743,7 +743,7 @@ FSLIO *FslXOpen(const char *filename, const char *opts, int filetype) + fslio->niftiptr->pixdim[3] = fabs(fslio->niftiptr->pixdim[3]); + } + /* set up pointer at end of iname_offset , ready for reading */ +- FslSeekVolume(fslio,0); ++ FslSeekVolume(fslio,0); + + return fslio; + +@@ -758,13 +758,13 @@ FSLIO *FslXOpen(const char *filename, const char *opts, int filetype) + \brief Read the header and all data into the FSLIO structure + + There is no need for FslOpen or FslClose calls when FslReadAllVolumes() +- is called. +-
This routine allocates the buffer to hold the entire dataset. ++ is called. ++
This routine allocates the buffer to hold the entire dataset. +
The data block returned will contain the data in whatever + datatype it is stored as on disk (therefore it is a void *). +
The data buffer will be byteswapped to native-endian. +-
The data buffer will not be scaled. +-
The best call to make before this is FslInit() or a calloc() for ++
The data buffer will not be scaled. ++
The best call to make before this is FslInit() or a calloc() for + fslio. (??? why calloc if this allocates the buffer ???) + + \param fslio pointer to an open dataset +@@ -772,7 +772,7 @@ FSLIO *FslXOpen(const char *filename, const char *opts, int filetype) + \return A pointer to the data block buffer (allocated by this function). +
Return Null on error ??? is this true ??? +
    +-
  • Note this pointer is also in the FSLIO structure as ++
  • Note this pointer is also in the FSLIO structure as + fslio->niftiptr->data.
  • +
  • Note a void pointer is returned, as the datablock is of + variable datatype.
  • +@@ -795,8 +795,8 @@ void* FslReadAllVolumes(FSLIO* fslio, char* filename) + /** otherwise it is a nifti file - so read it! **/ + fslio->mincptr = NULL; + /* make sure an FslOpen hasn't locked the file */ +- if (!znz_isnull(fslio->fileptr)) FslClose(fslio); +- ++ if (!znz_isnull(fslio->fileptr)) FslClose(fslio); ++ + fslio->niftiptr = nifti_image_read(filename,1); + + /* check for failure, from David Akers */ +@@ -849,14 +849,14 @@ size_t FslReadVolumes(FSLIO *fslio, void *buffer, size_t nvols) + ***************************************************************/ + /*! \fn void FslWriteAllVolumes(FSLIO *fslio, const void *buffer) + \brief Writes all data from buffer (using size info from fslio) to file. +- ++ + Dimension and datatype of buffer are as is specified in nifti_image structure + fslio->niftiptr. +- Note: If file format is Analyze (not nifti) and in Neurological order then ++ Note: If file format is Analyze (not nifti) and in Neurological order then + SWAP DATA into Radiological order. + + \param fslio pointer to open dataset +- \param buffer pointer to data array. Size and datatype of this buffer ++ \param buffer pointer to data array. Size and datatype of this buffer + */ + void FslWriteAllVolumes(FSLIO *fslio, const void *buffer) + { +@@ -876,16 +876,16 @@ void FslWriteAllVolumes(FSLIO *fslio, const void *buffer) + * FslWriteVolumes + ***************************************************************/ + /*! \fn size_t FslWriteVolumes(FSLIO *fslio, const void *buffer, size_t nvols) +- \brief Write the first nvols volumes in buffer to disk. ++ \brief Write the first nvols volumes in buffer to disk. + + Dimension and datatype of buffer are as is specified in nifti_image structure + fslio->niftiptr. +- Note: If file format is Analyze (not nifti) and in Neurological order then ++ Note: If file format is Analyze (not nifti) and in Neurological order then + SWAP DATA into Radiological order. + +- ++ + \param fslio pointer to open dataset +- \param buffer pointer to data array. Size and datatype of this buffer ++ \param buffer pointer to data array. Size and datatype of this buffer + \param nvols number of volumes to write + \return ??? looks like return of retval is missing ??? 0 on error. + */ +@@ -897,7 +897,7 @@ size_t FslWriteVolumes(FSLIO *fslio, const void *buffer, size_t nvols) + if ( (!fslio->written_hdr) && (FslIsSingleFileType(FslGetFileType(fslio))) && + (FslIsCompressedFileType(FslGetFileType(fslio))) ) + { FSLIOERR("FslWriteVolumes: header must be written before data for single compressed file types"); } +- ++ + if (fslio->niftiptr!=NULL) { + long int nbytes, bpv; + bpv = fslio->niftiptr->nbyper; /* bytes per voxel */ +@@ -939,7 +939,7 @@ size_t FslWriteVolumes(FSLIO *fslio, const void *buffer, size_t nvols) + ***************************************************************/ + /*! \fn void FslWriteHeader(FSLIO *fslio) + \brief Writes nifti/anz header and opens img file ready for writing +- ++ + \param fslio pointer to open dataset + */ + void FslWriteHeader(FSLIO *fslio) +@@ -979,11 +979,11 @@ void FslWriteHeader(FSLIO *fslio) + Dimension and datatype of buffer are as is specified in nifti_image structure + fslio->niftiptr. + Note: filepointer in file data array is restored to its initial position. +- ++ + \param fslio pointer to open dataset + \param buffer buffer large enough to hold 1 slice from each volume + \param slice slice number (0 based) to read [0 z-1] +- \param nvols number of volumes to read a slice from ++ \param nvols number of volumes to read a slice from + \return Number of volumes from which a slice was successfully read. 0 on error. + */ + size_t FslReadSliceSeries(FSLIO *fslio, void *buffer, short slice, size_t nvols) +@@ -994,17 +994,17 @@ size_t FslReadSliceSeries(FSLIO *fslio, void *buffer, short slice, size_t nvols) + + if (fslio==NULL) FSLIOERR("FslReadSliceSeries: Null pointer passed for FSLIO"); + if (fslio->niftiptr!=NULL) { +- ++ + FslGetDim(fslio,&x,&y,&z,&v); +- ++ + if ((slice<0) || (slice>=z)) FSLIOERR("FslReadSliceSeries: slice outside valid range"); +- ++ + slbytes = x * y * (FslGetDataType(fslio, &type) / 8); + volbytes = slbytes * z; +- ++ + orig_offset = znztell(fslio->fileptr); + znzseek(fslio->fileptr, slbytes*slice, SEEK_CUR); +- ++ + for (n=0; n0) znzseek(fslio->fileptr, volbytes - slbytes, SEEK_CUR); + if (znzread((char *)buffer+n*slbytes, 1, slbytes, fslio->fileptr) != slbytes) +@@ -1013,8 +1013,8 @@ size_t FslReadSliceSeries(FSLIO *fslio, void *buffer, short slice, size_t nvols) + nifti_swap_Nbytes(slbytes / fslio->niftiptr->swapsize, + fslio->niftiptr->swapsize, (char *)buffer+n*slbytes); + } +- +- ++ ++ + /* restore file pointer to original position */ + znzseek(fslio->fileptr,orig_offset,SEEK_SET); + return n; +@@ -1035,12 +1035,12 @@ size_t FslReadSliceSeries(FSLIO *fslio, void *buffer, short slice, size_t nvols) + Dimension and datatype of buffer are as is specified in nifti_image structure + fslio->niftiptr. + Note: filepointer in file data array is restored to its initial position. +- ++ + \param fslio pointer to open dataset + \param buffer buffer to hold one row from each volume. + \param row row number (0 based) to read [0 y-1] + \param slice slice number (0 based) to read +- \param nvols number of volumes to read a row from ++ \param nvols number of volumes to read a row from + \return Number of volumes from which a row was successfully read. 0 on error. + */ + size_t FslReadRowSeries(FSLIO *fslio, void *buffer, short row, short slice, size_t nvols) +@@ -1048,22 +1048,22 @@ size_t FslReadRowSeries(FSLIO *fslio, void *buffer, short row, short slice, size + size_t rowbytes,slbytes,volbytes; + size_t n, orig_offset; + short x,y,z,v,type; +- ++ + if (fslio==NULL) FSLIOERR("FslReadRowSeries: Null pointer passed for FSLIO"); + if (fslio->niftiptr!=NULL) { +- ++ + FslGetDim(fslio,&x,&y,&z,&v); +- ++ + if ((slice<0) || (slice>=z)) FSLIOERR("FslReadRowSeries: slice outside valid range"); + if ((row<0) || (row>=y)) FSLIOERR("FslReadRowSeries: row outside valid range"); +- ++ + rowbytes = x * (FslGetDataType(fslio, &type)) / 8; + slbytes = rowbytes * y; + volbytes = slbytes * z; +- ++ + orig_offset = znztell(fslio->fileptr); + znzseek(fslio->fileptr, rowbytes*row + slbytes*slice, SEEK_CUR); +- ++ + for (n=0; n0) znzseek(fslio->fileptr, volbytes - rowbytes, SEEK_CUR); + if (znzread((char *)buffer+n*rowbytes, 1, rowbytes, fslio->fileptr) != rowbytes) +@@ -1072,7 +1072,7 @@ size_t FslReadRowSeries(FSLIO *fslio, void *buffer, short row, short slice, size + nifti_swap_Nbytes(rowbytes / fslio->niftiptr->swapsize, + fslio->niftiptr->swapsize, (char *)buffer+n*rowbytes); + } +- ++ + /* restore file pointer to original position */ + znzseek(fslio->fileptr,orig_offset,SEEK_SET); + return n; +@@ -1093,7 +1093,7 @@ size_t FslReadRowSeries(FSLIO *fslio, void *buffer, short row, short slice, size + Dimension and datatype of buffer are as is specified in nifti_image structure + fslio->niftiptr. + Note: filepointer in file data array is restored to its initial position. +- ++ + \param fslio pointer to open dataset + \param buffer buffer to hold one timeseries vector + \param xVox x voxel [0 x-1] +@@ -1102,7 +1102,7 @@ size_t FslReadRowSeries(FSLIO *fslio, void *buffer, short row, short slice, size + \param nvols number of volumes to read a voxel from + \return Number of volumes from which a voxel was successfully read. 0 on error. + */ +-size_t FslReadTimeSeries(FSLIO *fslio, void *buffer, short xVox, short yVox, short zVox, ++size_t FslReadTimeSeries(FSLIO *fslio, void *buffer, short xVox, short yVox, short zVox, + size_t nvols) + { + size_t volbytes, offset, orig_offset; +@@ -1113,27 +1113,27 @@ size_t FslReadTimeSeries(FSLIO *fslio, void *buffer, short xVox, short yVox, sho + if (fslio->niftiptr!=NULL) { + + FslGetDim(fslio,&xdim,&ydim,&zdim,&v); +- ++ + if ((xVox<0) || (xVox >=xdim)) FSLIOERR("FslReadTimeSeries: voxel outside valid range"); + if ((yVox<0) || (yVox >=ydim)) FSLIOERR("FslReadTimeSeries: voxel outside valid range"); + if ((zVox<0) || (zVox >=zdim)) FSLIOERR("FslReadTimeSeries: voxel outside valid range"); +- ++ + wordsize = fslio->niftiptr->nbyper; + volbytes = xdim * ydim * zdim * wordsize; +- ++ + orig_offset = znztell(fslio->fileptr); + offset = ((ydim * zVox + yVox) * xdim + xVox) * wordsize; + znzseek(fslio->fileptr,offset,SEEK_CUR); +- ++ + for (n=0; n0) znzseek(fslio->fileptr, volbytes - wordsize, SEEK_CUR); + if (znzread((char *)buffer+(n*wordsize), 1, wordsize,fslio->fileptr) != wordsize) +- FSLIOERR("FslReadTimeSeries: failed to read values"); ++ FSLIOERR("FslReadTimeSeries: failed to read values"); + if (fslio->niftiptr->byteorder != nifti_short_order()) + nifti_swap_Nbytes(1,fslio->niftiptr->swapsize, + (char *)buffer+(n*wordsize)); + } +- ++ + /* restore file pointer to original position */ + znzseek(fslio->fileptr,orig_offset,SEEK_SET); + return n; +@@ -1165,7 +1165,7 @@ int FslSeekVolume(FSLIO *fslio, size_t vols) + int offset; + if (fslio==NULL) FSLIOERR("FslSeekVolume: Null pointer passed for FSLIO"); + if (fslio->niftiptr!=NULL) { +- offset = fslio->niftiptr->iname_offset + ++ offset = fslio->niftiptr->iname_offset + + vols * FslGetVolSize(fslio) * fslio->niftiptr->nbyper; + if (znz_isnull(fslio->fileptr)) FSLIOERR("FslSeekVolume: Null file pointer"); + return znzseek(fslio->fileptr,offset,SEEK_SET); +@@ -1301,13 +1301,13 @@ void FslGetVoxDim(FSLIO *fslio, float *x, float *y, float *z, float *tr) + *z = fabs(fslio->niftiptr->dz); + *tr = fabs(fslio->niftiptr->dt); + /* now check the units and convert to mm and sec */ +- if (fslio->niftiptr->xyz_units == NIFTI_UNITS_METER) ++ if (fslio->niftiptr->xyz_units == NIFTI_UNITS_METER) + { *x *= 1000.0; *y *= 1000.0; *z *= 1000.0; } +- if (fslio->niftiptr->xyz_units == NIFTI_UNITS_MICRON) ++ if (fslio->niftiptr->xyz_units == NIFTI_UNITS_MICRON) + { *x /= 1000.0; *y /= 1000.0; *z /= 1000.0; } +- if (fslio->niftiptr->xyz_units == NIFTI_UNITS_MSEC) ++ if (fslio->niftiptr->xyz_units == NIFTI_UNITS_MSEC) + { *tr /= 1000.0; } +- if (fslio->niftiptr->xyz_units == NIFTI_UNITS_USEC) ++ if (fslio->niftiptr->xyz_units == NIFTI_UNITS_USEC) + { *tr /= 1000000.0; } + /* if it is Hz or other frequency then leave it */ + } +@@ -1469,29 +1469,29 @@ size_t FslGetDataType(FSLIO *fslio, short *t) + } + + +-void FslGetMMCoord(mat44 stdmat, float voxx, float voxy, float voxz, +- float *mmx, float *mmy, float *mmz) ++void FslGetMMCoord(mat44 stdmat, float voxx, float voxy, float voxz, ++ float *mmx, float *mmy, float *mmz) + { +- *mmx = stdmat.m[0][0] * voxx + stdmat.m[0][1] * voxy + stdmat.m[0][2] * voxz ++ *mmx = stdmat.m[0][0] * voxx + stdmat.m[0][1] * voxy + stdmat.m[0][2] * voxz + + stdmat.m[0][3]; +- *mmy = stdmat.m[1][0] * voxx + stdmat.m[1][1] * voxy + stdmat.m[1][2] * voxz ++ *mmy = stdmat.m[1][0] * voxx + stdmat.m[1][1] * voxy + stdmat.m[1][2] * voxz + + stdmat.m[1][3]; +- *mmz = stdmat.m[2][0] * voxx + stdmat.m[2][1] * voxy + stdmat.m[2][2] * voxz ++ *mmz = stdmat.m[2][0] * voxx + stdmat.m[2][1] * voxy + stdmat.m[2][2] * voxz + + stdmat.m[2][3]; + } + + +-void FslGetVoxCoord(mat44 stdmat, float mmx, float mmy, float mmz, +- float *voxx, float *voxy, float *voxz) ++void FslGetVoxCoord(mat44 stdmat, float mmx, float mmy, float mmz, ++ float *voxx, float *voxy, float *voxz) + { + mat44 mm2vox; + + mm2vox = nifti_mat44_inverse(stdmat); +- *voxx = mm2vox.m[0][0] * mmx + mm2vox.m[0][1] * mmy + mm2vox.m[0][2] * mmz ++ *voxx = mm2vox.m[0][0] * mmx + mm2vox.m[0][1] * mmy + mm2vox.m[0][2] * mmz + + mm2vox.m[0][3]; +- *voxy = mm2vox.m[1][0] * mmx + mm2vox.m[1][1] * mmy + mm2vox.m[1][2] * mmz ++ *voxy = mm2vox.m[1][0] * mmx + mm2vox.m[1][1] * mmy + mm2vox.m[1][2] * mmz + + mm2vox.m[1][3]; +- *voxz = mm2vox.m[2][0] * mmx + mm2vox.m[2][1] * mmy + mm2vox.m[2][2] * mmz ++ *voxz = mm2vox.m[2][0] * mmx + mm2vox.m[2][1] * mmy + mm2vox.m[2][2] * mmz + + mm2vox.m[2][3]; + } + +@@ -1548,7 +1548,7 @@ short FslGetStdXform(FSLIO *fslio, mat44 *stdmat) + stdmat->m[3][1] = 0.0; + stdmat->m[3][2] = 0.0; + stdmat->m[3][3] = 1.0; +- ++ + /* the code below gives a default but it really should never be used */ + if (fslio->niftiptr->sform_code == NIFTI_XFORM_UNKNOWN) { + FslGetVoxDim(fslio,&dx,&dy,&dz,&tr); +@@ -1637,7 +1637,7 @@ short FslGetRigidXform(FSLIO *fslio, mat44 *rigidmat) + rigidmat->m[3][1] = 0.0; + rigidmat->m[3][2] = 0.0; + rigidmat->m[3][3] = 1.0; +- ++ + /* the code gives a default but it should never really be used */ + if (fslio->niftiptr->sform_code == NIFTI_XFORM_UNKNOWN) { + FslGetVoxDim(fslio,&dx,&dy,&dz,&tr); +@@ -1737,7 +1737,7 @@ int FslGetIntensityScaling(FSLIO *fslio, float *slope, float *intercept) + fprintf(stderr,"Warning:: Minc is not yet supported\n"); + } + return 0; +- ++ + } + + +@@ -1765,12 +1765,12 @@ int FslGetLeftRightOrder(FSLIO *fslio) + if (fslio->niftiptr!=NULL) { + sform_code = FslGetStdXform(fslio,&sform44); + qform_code = FslGetRigidXform(fslio,&qform44); +- if (sform_code!=NIFTI_XFORM_UNKNOWN) { ++ if (sform_code!=NIFTI_XFORM_UNKNOWN) { + sform33 = mat44_to_mat33(sform44); + det = nifti_mat33_determ(sform33); +- } else if (qform_code!=NIFTI_XFORM_UNKNOWN) { ++ } else if (qform_code!=NIFTI_XFORM_UNKNOWN) { + qform33 = mat44_to_mat33(qform44); +- det = nifti_mat33_determ(qform33); ++ det = nifti_mat33_determ(qform33); + } + + if (det<0.0) order=FSL_RADIOLOGICAL; +@@ -1812,9 +1812,9 @@ void FslSetAnalyzeSform(FSLIO *fslio, const short *orig, + /* change neurological convention to radiological if necessary */ + dx = -dx; + } +- if ( (FslBaseFileType(FslGetFileType(fslio))==FSL_TYPE_ANALYZE) ++ if ( (FslBaseFileType(FslGetFileType(fslio))==FSL_TYPE_ANALYZE) + || (fslio->niftiptr->sform_code == NIFTI_XFORM_UNKNOWN) ) { +- /* make a default transform with the requested origin at xyz=000 */ ++ /* make a default transform with the requested origin at xyz=000 */ + fslio->niftiptr->sform_code = NIFTI_XFORM_ALIGNED_ANAT; + fslio->niftiptr->sto_xyz.m[0][0] = dx; + fslio->niftiptr->sto_xyz.m[0][1] = 0; +@@ -1856,9 +1856,9 @@ void FslSetAnalyzeSform(FSLIO *fslio, const short *orig, + fslio->niftiptr->sto_ijk = + nifti_mat44_inverse(fslio->niftiptr->sto_xyz); + } +- ++ + } +- ++ + } + if (fslio->mincptr!=NULL) { + fprintf(stderr,"Warning:: Minc is not yet supported\n"); +@@ -1872,23 +1872,23 @@ void FslGetAnalyzeOrigin(FSLIO *fslio, short orig[5]) + if (fslio==NULL) FSLIOERR("FslGetAnalyzeOrigin: Null pointer passed for FSLIO"); + if (fslio->niftiptr!=NULL) { + /* Use sform or qform to determine the origin - default is zero */ +- orig[0]=0; +- orig[1]=0; +- orig[2]=0; +- orig[3]=0; ++ orig[0]=0; ++ orig[1]=0; ++ orig[2]=0; ++ orig[3]=0; + orig[4]=0; + + if (fslio->niftiptr->qform_code != NIFTI_XFORM_UNKNOWN) { + orig[0]=(short) fslio->niftiptr->qto_ijk.m[0][3] + 1; + orig[1]=(short) fslio->niftiptr->qto_ijk.m[1][3] + 1; + orig[2]=(short) fslio->niftiptr->qto_ijk.m[2][3] + 1; +- } ++ } + + if (fslio->niftiptr->sform_code != NIFTI_XFORM_UNKNOWN) { + orig[0]=(short) fslio->niftiptr->sto_ijk.m[0][3] + 1; + orig[1]=(short) fslio->niftiptr->sto_ijk.m[1][3] + 1; + orig[2]=(short) fslio->niftiptr->sto_ijk.m[2][3] + 1; +- } ++ } + } + if (fslio->mincptr!=NULL) { + fprintf(stderr,"Warning:: Minc is not yet supported\n"); +@@ -1904,7 +1904,7 @@ void FslGetAnalyzeOrigin(FSLIO *fslio, short orig[5]) + \brief Write header and image data if this dataset was open for + writing. Close the dataset header and data files. + +- ++ + \param fslio pointer to FSLIO data structure + \return -1 on error, 0 OK ???. + */ +@@ -1921,7 +1921,7 @@ int FslClose(FSLIO *fslio) + + /** ----- if writing the image, need to worry about the header bit ----- **/ + +- if ( (fslio->niftiptr!=NULL) && (FslGetWriteMode(fslio)==1) ++ if ( (fslio->niftiptr!=NULL) && (FslGetWriteMode(fslio)==1) + && (fslio->written_hdr==0) ) { + + /* ensure that the type is set correctly */ +@@ -1945,28 +1945,28 @@ int FslClose(FSLIO *fslio) + } + } + } +- ++ + /* --- nasty hack to write the origin in Analyze files --- */ + +- if ( (FslGetWriteMode(fslio)==1) && (fslio->niftiptr!=NULL) && ++ if ( (FslGetWriteMode(fslio)==1) && (fslio->niftiptr!=NULL) && + (FslBaseFileType(FslGetFileType(fslio))==FSL_TYPE_ANALYZE) ) { +- ++ + /* read in the old header, change the origin and write it out again */ + hdr = (struct dsr *) calloc(1,sizeof(struct dsr)); + FslReadRawHeader(hdr,fslio->niftiptr->fname); + if (fslio->niftiptr->byteorder != nifti_short_order()) {AvwSwapHeader(hdr);} +- ++ + /* calculate origin from sform (if set) */ + { + short blah[5]; + FslGetAnalyzeOrigin(fslio,blah); + memcpy(hdr->hist.originator,blah,5*sizeof(short)); +- ++ + /* Write out in radiological order if origin is non-zero */ + /* set negative pixdim if needed to keep LR orientation consistent */ + if ( (blah[0]!=0) || (blah[1]!=0) || (blah[2]!=0) ) { + if (hdr->dime.pixdim[1] * hdr->dime.pixdim[2] * hdr->dime.pixdim[3] > 0) { +- hdr->dime.pixdim[1] = - hdr->dime.pixdim[1]; ++ hdr->dime.pixdim[1] = - hdr->dime.pixdim[1]; + } + } + } +@@ -1974,12 +1974,12 @@ int FslClose(FSLIO *fslio) + /* swap back byte order and write out */ + if (fslio->niftiptr->byteorder != nifti_short_order()) {AvwSwapHeader(hdr);} + hptr = znzopen(fslio->niftiptr->fname,"wb",FslIsCompressedFileType(FslGetFileType(fslio))); +- if (znz_isnull(hptr)) { ++ if (znz_isnull(hptr)) { + fprintf(stderr,"Error:: Could not write origin data to header file %s.\n", + fslio->niftiptr->fname); + return -1; + }; +- ++ + znzwrite(hdr,1,sizeof(struct dsr),hptr); + znzclose(hptr); + free(hdr); +@@ -1992,7 +1992,7 @@ int FslClose(FSLIO *fslio) + + return retval; + } +- ++ + + void AvwSwapHeader(struct dsr *avw) + { +@@ -2004,7 +2004,7 @@ void AvwSwapHeader(struct dsr *avw) + nifti_swap_4bytes(1,ptr); /* extents */ + ptr += 4; + nifti_swap_2bytes(1,ptr); /* session_error */ +- ++ + ptr = (char *) &(avw->dime); + nifti_swap_2bytes(8,ptr); /* dims */ + ptr += 28; +@@ -2070,11 +2070,11 @@ int FslGetIgnoreMFQ(void) + ***************************************************************/ + /*! \fn FSLIO * FslReadHeader(char *fname) + \brief Reads nifti/anz header, no data is read +- ++ + \param fname filename specification (could be .img,.hdr,.nii, or no ext +- \return FSLIO data structure with the nifti_image structure fields filled ++ \return FSLIO data structure with the nifti_image structure fields filled + as per fname header. +- NULL on error ++ NULL on error + */ + FSLIO * FslReadHeader(char *fname) + { +@@ -2083,7 +2083,7 @@ FSLIO * FslReadHeader(char *fname) + + + fslio = FslInit(); +- ++ + /** get header file name */ + FslGetHdrImgNames(fname, fslio, &hdrname, &imgname); + +@@ -2105,9 +2105,9 @@ FSLIO * FslReadHeader(char *fname) + * FslGetVolumeAsScaledDouble + ***************************************************************/ + /*! \fn double *** FslGetVolumeAsScaledDouble(FSLIO *fslio, int vol) +- \brief Return volume #vol (0-based) as a 3D array of scaled doubles. ++ \brief Return volume #vol (0-based) as a 3D array of scaled doubles. + +- Volume Array is indexed as [0..zdim-1][0..ydim-1][0..xdim-1]. ++ Volume Array is indexed as [0..zdim-1][0..ydim-1][0..xdim-1]. +
    The array will be byteswapped to native-endian. +
    Array values are scaled as per fslio header slope and intercept fields. + +@@ -2144,7 +2144,7 @@ double ***FslGetVolumeAsScaledDouble(FSLIO *fslio, int vol) + slope = fslio->niftiptr->scl_slope; + inter = fslio->niftiptr->scl_inter; + } +- ++ + + /** allocate new 3D buffer */ + newbuf = d3matrix(zz-1,yy-1,xx-1); +@@ -2192,10 +2192,10 @@ double ***FslGetVolumeAsScaledDouble(FSLIO *fslio, int vol) + * FslGetBufferAsScaledDouble + ***************************************************************/ + /*! \fn double **** FslGetBufferAsScaledDouble(FSLIO *fslio) +- \brief Return the fslio data buffer of a 1-4D dataset as a 4D array of +- scaled doubles. ++ \brief Return the fslio data buffer of a 1-4D dataset as a 4D array of ++ scaled doubles. + +- Array is indexed as buf[0..tdim-1][0..zdim-1][0..ydim-1][0..xdim-1]. ++ Array is indexed as buf[0..tdim-1][0..zdim-1][0..ydim-1][0..xdim-1]. +
    The array will be byteswapped to native-endian. +
    Array values are scaled as per fslio header slope and intercept fields. + +@@ -2229,7 +2229,7 @@ double ****FslGetBufferAsScaledDouble(FSLIO *fslio) + slope = fslio->niftiptr->scl_slope; + inter = fslio->niftiptr->scl_inter; + } +- ++ + + /** allocate new 4D buffer */ + newbuf = d4matrix(tt-1,zz-1,yy-1,xx-1); +@@ -2256,9 +2256,9 @@ double ****FslGetBufferAsScaledDouble(FSLIO *fslio) + * convertBufferToScaledDouble + ***************************************************************/ + /*! \fn int convertBufferToScaledDouble(double *outbuf, void *inbuf, long len, float slope, float inter, int nifti_datatype ) +- \brief allocate a 4D buffer, use 1 contiguous buffer for the data ++ \brief allocate a 4D buffer, use 1 contiguous buffer for the data + +- Array is indexed as buf[0..th-1][0..zh-1][0..yh-1][0..xh-1]. ++ Array is indexed as buf[0..th-1][0..zh-1][0..yh-1][0..xh-1]. +
    To access all elements as a vector, use buf[0][0][0][i] where + i can range from 0 to th*zh*yh*xh - 1. + +@@ -2270,7 +2270,7 @@ double ****FslGetBufferAsScaledDouble(FSLIO *fslio) + \param nifti_datatype NIFTI datatype code for the datatype of the elements in inbuf + \return error code: 0=OK -1=error + */ +-int convertBufferToScaledDouble(double *outbuf, void *inbuf, long len, float slope, float inter, int nifti_datatype ) ++int convertBufferToScaledDouble(double *outbuf, void *inbuf, long len, float slope, float inter, int nifti_datatype ) + { + + long i; +@@ -2326,12 +2326,12 @@ return(0); + * d3matrix + ***************************************************************/ + /*! \fn double ****d3matrix(int zh, int yh, int xh) +- \brief allocate a 3D buffer, use 1 contiguous buffer for the data ++ \brief allocate a 3D buffer, use 1 contiguous buffer for the data + +- Array is indexed as buf[0..zh][0..yh][0..xh]. ++ Array is indexed as buf[0..zh][0..yh][0..xh]. +
    To access all elements as a vector, use buf[0][0][i] where + i can range from 0 to zh*yh*xh - 1. +- Adaptation of Numerical Recipes in C nrutil.c allocation routines. ++ Adaptation of Numerical Recipes in C nrutil.c allocation routines. + + \param zh slowest changing dimension + \param yh 2nd fastest changing dimension +@@ -2374,12 +2374,12 @@ double ***d3matrix(int zh, int yh, int xh) + * d4matrix + ***************************************************************/ + /*! \fn double ****d4matrix(int th, int zh, int yh, int xh) +- \brief allocate a 4D buffer, use 1 contiguous buffer for the data ++ \brief allocate a 4D buffer, use 1 contiguous buffer for the data + +- Array is indexed as buf[0..th][0..zh][0..yh][0..xh]. ++ Array is indexed as buf[0..th][0..zh][0..yh][0..xh]. +
    To access all elements as a vector, use buf[0][0][0][i] where + i can range from 0 to th*zh*yh*xh - 1. +- Adaptation of Numerical Recipes in C nrutil.c allocation routines. ++ Adaptation of Numerical Recipes in C nrutil.c allocation routines. + + \param th slowest changing dimension + \param zh 2nd slowest changing dimension +diff --git a/fsliolib/fslio.h b/fsliolib/fslio.h +index dbbb77a..cf8f0d7 100644 +--- a/fsliolib/fslio.h ++++ b/fsliolib/fslio.h +@@ -10,12 +10,12 @@ + + */ + +- ++ + /* + The fslio.h file was originally part of FSL - FMRIB's Software Library + http://www.fmrib.ox.ac.uk/fsl + fslio.h has now been placed in the public domain. +- ++ + Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + Imaging of the Brain), Department of Clinical Neurology, Oxford + University, Oxford, UK +@@ -58,22 +58,22 @@ extern "C" { + Writing + ------- + This is more complicated due to the nature of gzipped writing, which must be +- done in the correct order, and for single files (*.nii.gz) this means that ++ done in the correct order, and for single files (*.nii.gz) this means that + the header information must be written before any image data. + + (1) +- The best method to use is almost backwards compatible, but requires ++ The best method to use is almost backwards compatible, but requires + an FslWriteHeader() call: + + FSLIO* fslio; + fslio = FslOpen("/some/path/name_of_file","wb"); + ... set the appropriate header information using FslSet calls ... + FslWriteHeader(fslio); +- +- ... now can write one or more volumes at a time using ++ ++ ... now can write one or more volumes at a time using + FslWriteVolumes(fslio,buffer,nvols) ... + +- FslClose(fslio); ++ FslClose(fslio); + + This version is useful if your image data needs to be written from different blocks + of memory. +@@ -82,9 +82,9 @@ extern "C" { + Another method is available, but which is discouraged, is: + FSLIO* fslio; + fslio = FslOpen("/some/path/name_of_file","wb"); +- ++ + ... set some appropriate header information using FslSet calls ... +- ... now can write one or more volumes at a time using ++ ... now can write one or more volumes at a time using + FslWriteVolumes(fslio,buffer,nvols) ... + ... set more appropriate header information using FslSet calls ... + +@@ -93,7 +93,7 @@ extern "C" { + WARNING: this cannot write .nii.gz files as the header information cannot be + written by FslClose() after the image data is written, which is how the previous + versions have worked. +- ++ + + */ + +@@ -120,7 +120,7 @@ extern "C" { + \sa nifti_image + \sa minc_image + */ +-typedef struct ++typedef struct + { + znzFile fileptr; + nifti_image *niftiptr; +@@ -182,7 +182,7 @@ int FslReadRawHeader(void *buffer, const char* filename); + /* simple creation and clone/copy operations */ + + FSLIO *FslInit(void); +-void FslInitHeader(FSLIO *fslio, short t, ++void FslInitHeader(FSLIO *fslio, short t, + size_t x, size_t y, size_t z, size_t v, + float vx, float vy, float vz, float tr, + size_t dim, +@@ -217,18 +217,18 @@ short FslGetIntent(FSLIO *fslio, short *intent_code, float *p1, float *p2, + + short FslGetStdXform(FSLIO *fslio, mat44 *stdmat); + void FslSetStdXform(FSLIO *fslio, short sform_code, mat44 stdmat); +-void FslGetMMCoord(mat44 stdmat, float voxx, float voxy, float voxz, ++void FslGetMMCoord(mat44 stdmat, float voxx, float voxy, float voxz, + float *mmx, float *mmy, float *mmz); + +-void FslGetVoxCoord(mat44 stdmat, float mmx, float mmy, float mmz, +- float *voxx, float *voxy, float *voxz); ++void FslGetVoxCoord(mat44 stdmat, float mmx, float mmy, float mmz, ++ float *voxx, float *voxy, float *voxz); + short FslGetRigidXform(FSLIO *fslio, mat44 *rigidmat); + void FslSetRigidXform(FSLIO *fslio, short qform_code, mat44 rigidmat); + int FslGetLeftRightOrder(FSLIO *fslio); + + /* these two functions are deprecated with the nifti/analyze support */ + /* please do all spatial coordinate origins via the Std and Rigid Xforms */ +-void FslSetAnalyzeSform(FSLIO *fslio, const short *orig, ++void FslSetAnalyzeSform(FSLIO *fslio, const short *orig, + float dx, float dy, float dz); + void FslGetAnalyzeOrigin(FSLIO *fslio, short orig[5]); + +@@ -245,7 +245,7 @@ mat33 mat44_to_mat33(mat44 x); + + + /* added by KF pending discussion w/ Mark */ +-typedef unsigned char THIS_UINT8; ++typedef unsigned char THIS_UINT8; + typedef char THIS_INT8; + typedef unsigned short THIS_UINT16; + typedef short THIS_INT16; +diff --git a/fsliolib/fslio.tcl b/fsliolib/fslio.tcl +index aae1133..3d4592d 100644 +--- a/fsliolib/fslio.tcl ++++ b/fsliolib/fslio.tcl +@@ -1,20 +1,20 @@ +-#{{{ copyright and setup ++#{{{ copyright and setup + + # FEAT TCL FSLIO wrappers + # + # Stephen Smith, FMRIB Image Analysis Group + # + # +-# ++# + # The fslio.tcl file was originally part of FSL - FMRIB's Software Library + # http://www.fmrib.ox.ac.uk/fsl + # fslio.tcl has now been placed in the public domain. +-# ++# + # Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + # Imaging of the Brain), Department of Clinical Neurology, Oxford + # University, Oxford, UK +-# +-# ++# ++# + + #}}} + +diff --git a/fsliolib/imcp b/fsliolib/imcp +index 661b571..248e14c 100644 +--- a/fsliolib/imcp ++++ b/fsliolib/imcp +@@ -8,13 +8,13 @@ + # The imcp file was originally part of FSL - FMRIB's Software Library + # http://www.fmrib.ox.ac.uk/fsl + # imcp has now been placed in the public domain. +-# +-# ++# ++# + # Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + # Imaging of the Brain), Department of Clinical Neurology, Oxford + # University, Oxford, UK +-# +-# ++# ++# + + if [ $# -lt 1 ] ; then + echo "Usage: $0 " +@@ -29,13 +29,13 @@ if [ $# -eq 2 -a ! -d $2 ] ; then + f2=`${FSLDIR}/bin/remove_ext $2`; + # do the copies + if [ -f ${f1}.hdr ] ; then /bin/cp ${f1}.hdr ${f2}.hdr ; fi +- if [ -f ${f1}.hdr.gz ] ; then /bin/cp ${f1}.hdr.gz ${f2}.hdr.gz ; fi +- if [ -f ${f1}.img ] ; then /bin/cp ${f1}.img ${f2}.img ; fi +- if [ -f ${f1}.img.gz ] ; then /bin/cp ${f1}.img.gz ${f2}.img.gz ; fi +- if [ -f ${f1}.nii ] ; then /bin/cp ${f1}.nii ${f2}.nii ; fi +- if [ -f ${f1}.nii.gz ] ; then /bin/cp ${f1}.nii.gz ${f2}.nii.gz ; fi +- if [ -f ${f1}.mnc ] ; then /bin/cp ${f1}.mnc ${f2}.mnc ; fi +- if [ -f ${f1}.mnc.gz ] ; then /bin/cp ${f1}.mnc.gz ${f2}.mnc.gz ; fi ++ if [ -f ${f1}.hdr.gz ] ; then /bin/cp ${f1}.hdr.gz ${f2}.hdr.gz ; fi ++ if [ -f ${f1}.img ] ; then /bin/cp ${f1}.img ${f2}.img ; fi ++ if [ -f ${f1}.img.gz ] ; then /bin/cp ${f1}.img.gz ${f2}.img.gz ; fi ++ if [ -f ${f1}.nii ] ; then /bin/cp ${f1}.nii ${f2}.nii ; fi ++ if [ -f ${f1}.nii.gz ] ; then /bin/cp ${f1}.nii.gz ${f2}.nii.gz ; fi ++ if [ -f ${f1}.mnc ] ; then /bin/cp ${f1}.mnc ${f2}.mnc ; fi ++ if [ -f ${f1}.mnc.gz ] ; then /bin/cp ${f1}.mnc.gz ${f2}.mnc.gz ; fi + fi + + if [ $# -gt 2 -o -d $2 ] ; then +@@ -52,13 +52,13 @@ if [ $# -gt 2 -o -d $2 ] ; then + f1=`${FSLDIR}/bin/remove_ext $fn`; + # do the copies + if [ -f ${f1}.hdr ] ; then /bin/cp ${f1}.hdr ${dir} ; fi +- if [ -f ${f1}.hdr.gz ] ; then /bin/cp ${f1}.hdr.gz ${dir} ; fi +- if [ -f ${f1}.img ] ; then /bin/cp ${f1}.img ${dir} ; fi +- if [ -f ${f1}.img.gz ] ; then /bin/cp ${f1}.img.gz ${dir} ; fi +- if [ -f ${f1}.nii ] ; then /bin/cp ${f1}.nii ${dir} ; fi +- if [ -f ${f1}.nii.gz ] ; then /bin/cp ${f1}.nii.gz ${dir} ; fi +- if [ -f ${f1}.mnc ] ; then /bin/cp ${f1}.mnc ${dir} ; fi +- if [ -f ${f1}.mnc.gz ] ; then /bin/cp ${f1}.mnc.gz ${dir} ; fi ++ if [ -f ${f1}.hdr.gz ] ; then /bin/cp ${f1}.hdr.gz ${dir} ; fi ++ if [ -f ${f1}.img ] ; then /bin/cp ${f1}.img ${dir} ; fi ++ if [ -f ${f1}.img.gz ] ; then /bin/cp ${f1}.img.gz ${dir} ; fi ++ if [ -f ${f1}.nii ] ; then /bin/cp ${f1}.nii ${dir} ; fi ++ if [ -f ${f1}.nii.gz ] ; then /bin/cp ${f1}.nii.gz ${dir} ; fi ++ if [ -f ${f1}.mnc ] ; then /bin/cp ${f1}.mnc ${dir} ; fi ++ if [ -f ${f1}.mnc.gz ] ; then /bin/cp ${f1}.mnc.gz ${dir} ; fi + done + fi + +diff --git a/fsliolib/imglob b/fsliolib/imglob +index a172d05..d45774e 100644 +--- a/fsliolib/imglob ++++ b/fsliolib/imglob +@@ -8,13 +8,13 @@ + # The imglob file was originally part of FSL - FMRIB's Software Library + # http://www.fmrib.ox.ac.uk/fsl + # imglob has now been placed in the public domain. +-# +-# ++# ++# + # Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + # Imaging of the Brain), Department of Clinical Neurology, Oxford + # University, Oxford, UK +-# +-# ++# ++# + + if [ $# -lt 1 ] ; then + echo "Usage: $0 [-oneperimage] " +diff --git a/fsliolib/imln b/fsliolib/imln +index 7750061..8f1e910 100644 +--- a/fsliolib/imln ++++ b/fsliolib/imln +@@ -8,13 +8,13 @@ + # The imln file was originally part of FSL - FMRIB's Software Library + # http://www.fmrib.ox.ac.uk/fsl + # imln has now been placed in the public domain. +-# +-# ++# ++# + # Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + # Imaging of the Brain), Department of Clinical Neurology, Oxford + # University, Oxford, UK +-# +-# ++# ++# + + if [ $# -lt 2 ] ; then + echo "Usage: $0 " +@@ -27,11 +27,11 @@ f1=`${FSLDIR}/bin/remove_ext $1`; + f2=`${FSLDIR}/bin/remove_ext $2`; + + if [ -f ${f1}.hdr ] ; then ln -fs ${f1}.hdr ${f2}.hdr ; fi +-if [ -f ${f1}.hdr.gz ] ; then ln -fs ${f1}.hdr.gz ${f2}.hdr.gz ; fi +-if [ -f ${f1}.img ] ; then ln -fs ${f1}.img ${f2}.img ; fi +-if [ -f ${f1}.img.gz ] ; then ln -fs ${f1}.img.gz ${f2}.img.gz ; fi +-if [ -f ${f1}.nii ] ; then ln -fs ${f1}.nii ${f2}.nii ; fi +-if [ -f ${f1}.nii.gz ] ; then ln -fs ${f1}.nii.gz ${f2}.nii.gz ; fi +-if [ -f ${f1}.mnc ] ; then ln -fs ${f1}.mnc ${f2}.mnc ; fi +-if [ -f ${f1}.mnc.gz ] ; then ln -fs ${f1}.mnc.gz ${f2}.mnc.gz ; fi ++if [ -f ${f1}.hdr.gz ] ; then ln -fs ${f1}.hdr.gz ${f2}.hdr.gz ; fi ++if [ -f ${f1}.img ] ; then ln -fs ${f1}.img ${f2}.img ; fi ++if [ -f ${f1}.img.gz ] ; then ln -fs ${f1}.img.gz ${f2}.img.gz ; fi ++if [ -f ${f1}.nii ] ; then ln -fs ${f1}.nii ${f2}.nii ; fi ++if [ -f ${f1}.nii.gz ] ; then ln -fs ${f1}.nii.gz ${f2}.nii.gz ; fi ++if [ -f ${f1}.mnc ] ; then ln -fs ${f1}.mnc ${f2}.mnc ; fi ++if [ -f ${f1}.mnc.gz ] ; then ln -fs ${f1}.mnc.gz ${f2}.mnc.gz ; fi + +diff --git a/fsliolib/immv b/fsliolib/immv +index 7c441f7..04aab05 100644 +--- a/fsliolib/immv ++++ b/fsliolib/immv +@@ -8,13 +8,13 @@ + # The immv file was originally part of FSL - FMRIB's Software Library + # http://www.fmrib.ox.ac.uk/fsl + # immv has now been placed in the public domain. +-# +-# ++# ++# + # Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + # Imaging of the Brain), Department of Clinical Neurology, Oxford + # University, Oxford, UK +-# +-# ++# ++# + + if [ $# -lt 1 ] ; then + echo "Usage: $0 " +@@ -28,13 +28,13 @@ if [ $# -eq 2 -a ! -d $2 ] ; then + f2=`${FSLDIR}/bin/remove_ext $2`; + # do the moves + if [ -f ${f1}.hdr ] ; then /bin/mv ${f1}.hdr ${f2}.hdr ; fi +- if [ -f ${f1}.hdr.gz ] ; then /bin/mv ${f1}.hdr.gz ${f2}.hdr.gz ; fi +- if [ -f ${f1}.img ] ; then /bin/mv ${f1}.img ${f2}.img ; fi +- if [ -f ${f1}.img.gz ] ; then /bin/mv ${f1}.img.gz ${f2}.img.gz ; fi +- if [ -f ${f1}.nii ] ; then /bin/mv ${f1}.nii ${f2}.nii ; fi +- if [ -f ${f1}.nii.gz ] ; then /bin/mv ${f1}.nii.gz ${f2}.nii.gz ; fi +- if [ -f ${f1}.mnc ] ; then /bin/mv ${f1}.mnc ${f2}.mnc ; fi +- if [ -f ${f1}.mnc.gz ] ; then /bin/mv ${f1}.mnc.gz ${f2}.mnc.gz ; fi ++ if [ -f ${f1}.hdr.gz ] ; then /bin/mv ${f1}.hdr.gz ${f2}.hdr.gz ; fi ++ if [ -f ${f1}.img ] ; then /bin/mv ${f1}.img ${f2}.img ; fi ++ if [ -f ${f1}.img.gz ] ; then /bin/mv ${f1}.img.gz ${f2}.img.gz ; fi ++ if [ -f ${f1}.nii ] ; then /bin/mv ${f1}.nii ${f2}.nii ; fi ++ if [ -f ${f1}.nii.gz ] ; then /bin/mv ${f1}.nii.gz ${f2}.nii.gz ; fi ++ if [ -f ${f1}.mnc ] ; then /bin/mv ${f1}.mnc ${f2}.mnc ; fi ++ if [ -f ${f1}.mnc.gz ] ; then /bin/mv ${f1}.mnc.gz ${f2}.mnc.gz ; fi + fi + + if [ $# -gt 2 -o -d $2 ] ; then +@@ -51,13 +51,13 @@ if [ $# -gt 2 -o -d $2 ] ; then + f1=`${FSLDIR}/bin/remove_ext $fn`; + # do the copies + if [ -f ${f1}.hdr ] ; then /bin/mv ${f1}.hdr ${dir} ; fi +- if [ -f ${f1}.hdr.gz ] ; then /bin/mv ${f1}.hdr.gz ${dir} ; fi +- if [ -f ${f1}.img ] ; then /bin/mv ${f1}.img ${dir} ; fi +- if [ -f ${f1}.img.gz ] ; then /bin/mv ${f1}.img.gz ${dir} ; fi +- if [ -f ${f1}.nii ] ; then /bin/mv ${f1}.nii ${dir} ; fi +- if [ -f ${f1}.nii.gz ] ; then /bin/mv ${f1}.nii.gz ${dir} ; fi +- if [ -f ${f1}.mnc ] ; then /bin/mv ${f1}.mnc ${dir} ; fi +- if [ -f ${f1}.mnc.gz ] ; then /bin/mv ${f1}.mnc.gz ${dir} ; fi ++ if [ -f ${f1}.hdr.gz ] ; then /bin/mv ${f1}.hdr.gz ${dir} ; fi ++ if [ -f ${f1}.img ] ; then /bin/mv ${f1}.img ${dir} ; fi ++ if [ -f ${f1}.img.gz ] ; then /bin/mv ${f1}.img.gz ${dir} ; fi ++ if [ -f ${f1}.nii ] ; then /bin/mv ${f1}.nii ${dir} ; fi ++ if [ -f ${f1}.nii.gz ] ; then /bin/mv ${f1}.nii.gz ${dir} ; fi ++ if [ -f ${f1}.mnc ] ; then /bin/mv ${f1}.mnc ${dir} ; fi ++ if [ -f ${f1}.mnc.gz ] ; then /bin/mv ${f1}.mnc.gz ${dir} ; fi + done + fi + +diff --git a/fsliolib/imrm b/fsliolib/imrm +index 0f6b5dd..0382e39 100644 +--- a/fsliolib/imrm ++++ b/fsliolib/imrm +@@ -8,12 +8,12 @@ + # The imrm file was originally part of FSL - FMRIB's Software Library + # http://www.fmrib.ox.ac.uk/fsl + # imrm has now been placed in the public domain. +-# ++# + # Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + # Imaging of the Brain), Department of Clinical Neurology, Oxford + # University, Oxford, UK +-# +-# ++# ++# + + if [ $# -lt 1 ] ; then + echo "Usage: $0 " +diff --git a/fsliolib/imtest b/fsliolib/imtest +index 18edd59..aa3fa68 100644 +--- a/fsliolib/imtest ++++ b/fsliolib/imtest +@@ -8,12 +8,12 @@ + # The fslio.c file was originally part of FSL - FMRIB's Software Library + # http://www.fmrib.ox.ac.uk/fsl + # imtest has now been placed in the public domain. +-# ++# + # Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + # Imaging of the Brain), Department of Clinical Neurology, Oxford + # University, Oxford, UK +-# +-# ++# ++# + + # return 0 if no image exists or 1 if the image exists + +diff --git a/fsliolib/remove_ext b/fsliolib/remove_ext +index 5db2b00..1c65a86 100644 +--- a/fsliolib/remove_ext ++++ b/fsliolib/remove_ext +@@ -8,12 +8,12 @@ + # The remove_ext file was originally part of FSL - FMRIB's Software Library + # http://www.fmrib.ox.ac.uk/fsl + # remove_ext has now been placed in the public domain. +-# ++# + # Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance + # Imaging of the Brain), Department of Clinical Neurology, Oxford + # University, Oxford, UK +-# +-# ++# ++# + + + if [ $# -lt 1 ] ; then +diff --git a/nifticdf/CMakeLists.txt b/nifticdf/CMakeLists.txt +index 35644e3..05604f9 100644 +--- a/nifticdf/CMakeLists.txt ++++ b/nifticdf/CMakeLists.txt +@@ -1,28 +1,27 @@ +-PROJECT(NIFTICDFLIB) + +-INCLUDE_DIRECTORIES(${NIFTILIB_SOURCE_DIR}) +-#INCLUDE_DIRECTORIES(/usr/include/nifti) +-SET(NIFTICDFLIB_SRC nifticdf.c) ++include_directories(${NIFTI_SOURCE_DIR}/niftilib) ++#include_directories(/usr/include/nifti) ++set(NIFTICDFLIB_SRC nifticdf.c) + +-SET(NIFTI_CDFLIB_NAME ${PACKAGE_PREFIX}nifticdf) ++set(NIFTI_CDFLIB_NAME ${PACKAGE_PREFIX}nifticdf) + +-ADD_LIBRARY(${NIFTI_CDFLIB_NAME} ${NIFTICDFLIB_SRC} ) ++add_library(${NIFTI_CDFLIB_NAME} ${NIFTICDFLIB_SRC} ) + +-IF (BUILD_SHARED_LIBS) +- SET_TARGET_PROPERTIES(${NIFTI_CDFLIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) +-ENDIF (BUILD_SHARED_LIBS) ++if(BUILD_SHARED_LIBS) ++ set_target_properties(${NIFTI_CDFLIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) ++endif(BUILD_SHARED_LIBS) + + +-IF(NOT NIFTI_INSTALL_NO_LIBRARIES) +- INSTALL(TARGETS ${NIFTI_CDFLIB_NAME} ++if(NOT NIFTI_INSTALL_NO_LIBRARIES) ++ install(TARGETS ${NIFTI_CDFLIB_NAME} + RUNTIME DESTINATION ${NIFTI_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_LIBRARIES) ++endif(NOT NIFTI_INSTALL_NO_LIBRARIES) + +-IF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) +- FILE(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +- INSTALL(FILES ${__files} ++if(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++ file(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") ++ install(FILES ${__files} + DESTINATION ${NIFTI_INSTALL_INCLUDE_DIR} + COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++endif(NOT NIFTI_INSTALL_NO_DEVELOPMENT) +diff --git a/niftilib/CMakeLists.txt b/niftilib/CMakeLists.txt +index 3ba3615..73b2ec9 100644 +--- a/niftilib/CMakeLists.txt ++++ b/niftilib/CMakeLists.txt +@@ -1,33 +1,32 @@ + #File Generated by Hans J. Johnson + #Please contact hans-johnson@uiowa.edu for making enhancments/corrections +-PROJECT(NIFTILIB) + +-INCLUDE_DIRECTORIES(${ZNZLIB_SOURCE_DIR}) +-SET(NIFTILIB_SRC nifti1_io.c) ++include_directories(${NIFTI_SOURCE_DIR}/znzlib) ++set(NIFTILIB_SRC nifti1_io.c) + +-SET(NIFTI_NIFTILIB_NAME ${PACKAGE_PREFIX}niftiio) +-ADD_LIBRARY(${NIFTI_NIFTILIB_NAME} ${NIFTILIB_SRC} ) +-TARGET_LINK_LIBRARIES( ${NIFTI_NIFTILIB_NAME} ${PACKAGE_PREFIX}znz) ++set(NIFTI_NIFTILIB_NAME ${PACKAGE_PREFIX}niftiio) ++add_library(${NIFTI_NIFTILIB_NAME} ${NIFTILIB_SRC} ) ++target_link_libraries( ${NIFTI_NIFTILIB_NAME} ${PACKAGE_PREFIX}znz) + + # Set library version when building shared libs. +-IF (BUILD_SHARED_LIBS) +- SET_TARGET_PROPERTIES(${NIFTI_NIFTILIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) +-ENDIF (BUILD_SHARED_LIBS) ++if(BUILD_SHARED_LIBS) ++ set_target_properties(${NIFTI_NIFTILIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) ++endif(BUILD_SHARED_LIBS) + +-IF(UNIX) +- TARGET_LINK_LIBRARIES(${NIFTI_NIFTILIB_NAME} -lm) +-ENDIF(UNIX) ++if(UNIX) ++ target_link_libraries(${NIFTI_NIFTILIB_NAME} -lm) ++endif(UNIX) + +-IF(NOT NIFTI_INSTALL_NO_LIBRARIES) +- INSTALL(TARGETS ${NIFTI_NIFTILIB_NAME} ++if(NOT NIFTI_INSTALL_NO_LIBRARIES) ++ install(TARGETS ${NIFTI_NIFTILIB_NAME} + RUNTIME DESTINATION ${NIFTI_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_LIBRARIES) ++endif(NOT NIFTI_INSTALL_NO_LIBRARIES) + +-IF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) +- FILE(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +- INSTALL(FILES ${__files} ++if(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++ file(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") ++ install(FILES ${__files} + DESTINATION ${NIFTI_INSTALL_INCLUDE_DIR} + COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++endif(NOT NIFTI_INSTALL_NO_DEVELOPMENT) +diff --git a/niftilib/Makefile b/niftilib/Makefile +index c463b88..b3c6abf 100644 +--- a/niftilib/Makefile ++++ b/niftilib/Makefile +@@ -10,7 +10,7 @@ SRCS=nifti1_io.c + OBJS=nifti1_io.o + MOBJS=mjtest.o + +-SCRIPTS = ++SCRIPTS = + + depend: + $(RM) -f depend.mk +diff --git a/niftilib/nifti1.h b/niftilib/nifti1.h +index 06d3665..80066fb 100644 +--- a/niftilib/nifti1.h ++++ b/niftilib/nifti1.h +@@ -276,7 +276,7 @@ typedef struct nifti_1_header nifti_1_header ; + program can simply ignore all extended header sections simply by jumping + straight to the image data using vox_offset. + -----------------------------------------------------------------------------*/ +- ++ + /*! \struct nifti1_extender + \brief This structure represents a 4-byte string that should follow the + binary nifti_1_header data in a NIFTI-1 header file. If the char +@@ -910,7 +910,7 @@ typedef struct { unsigned char r,g,b; } rgb_byte ; + + #define NIFTI_INTENT_QUATERNION 1010 + +- /*! Dimensionless value - no params - although, as in _ESTIMATE ++ /*! Dimensionless value - no params - although, as in _ESTIMATE + the name of the parameter may be stored in intent_name. */ + + #define NIFTI_INTENT_DIMLESS 1011 +diff --git a/niftilib/nifti1_io.c b/niftilib/nifti1_io.c +index e6bf7ee..3d5b165 100644 +--- a/niftilib/nifti1_io.c ++++ b/niftilib/nifti1_io.c +@@ -28,7 +28,7 @@ + */ + + /*! global history and version strings, for printing */ +-static char * gni_history[] = ++static char const * const gni_history[] = + { + "----------------------------------------------------------------------\n" + "history (of nifti library changes):\n" +@@ -338,20 +338,20 @@ static char * gni_history[] = + "1.43 07 Jul 2010 [rickr]: fixed znzR/W to again return nmembers\n", + "----------------------------------------------------------------------\n" + }; +-static char gni_version[] = "nifti library version 1.43 (7 July, 2010)"; ++static const char gni_version[] = "nifti library version 1.39 (23 June, 2009)"; + + /*! global nifti options structure - init with defaults */ +-static nifti_global_options g_opts = { ++static nifti_global_options g_opts = { + 1, /* debug level */ + 0, /* skip_blank_ext - skip extender if no extensions */ + 1 /* allow_upper_fext - allow uppercase file extensions */ + }; + + /*! global nifti types structure list (per type, ordered oldest to newest) */ +-static nifti_type_ele nifti_type_list[] = { ++static const nifti_type_ele nifti_type_list[] = { + /* type nbyper swapsize name */ +- { 0, 0, 0, "DT_UNKNOWN" }, +- { 0, 0, 0, "DT_NONE" }, ++ { 0, 0, 0, "DT_UNKNOWN" }, ++ { 0, 0, 0, "DT_NONE" }, + { 1, 0, 0, "DT_BINARY" }, /* not usable */ + { 2, 1, 0, "DT_UNSIGNED_CHAR" }, + { 2, 1, 0, "DT_UINT8" }, +@@ -428,7 +428,7 @@ static int make_pivot_list(nifti_image * nim, const int dims[], int pivots[], + static int compare_strlist (const char * str, char ** strlist, int len); + static int fileext_compare (const char * test_ext, const char * known_ext); + static int fileext_n_compare (const char * test_ext, +- const char * known_ext, int maxlen); ++ const char * known_ext, size_t maxlen); + static int is_mixedcase (const char * str); + static int is_uppercase (const char * str); + static int make_lowercase (char * str); +@@ -469,7 +469,7 @@ void nifti_disp_lib_version( void ) + /*! nifti_image_read_bricks - read nifti data as array of bricks + * + * 13 Dec 2004 [rickr] +- * ++ * + * \param hname - filename of dataset to read (must be valid) + * \param nbricks - number of sub-bricks to read + * (if blist is valid, nbricks must be > 0) +@@ -708,7 +708,7 @@ int nifti_update_dims_from_array( nifti_image * nim ) + * \param NBL - pointer to struct where resulting data will be stored + * + * If blist is NULL, read all sub-bricks. +- * ++ * + * \return the number of loaded bricks (NBL->nbricks), + * 0 on failure, < 0 on error + * +@@ -938,7 +938,7 @@ static int nifti_alloc_NBL_mem(nifti_image * nim, int nbricks, + * 2. create an sindex list, and init with 0..nbricks-1 + * 3. do a slow insertion sort on the small slist, along with sindex list + * 4. check results, just to be positive +- * ++ * + * So slist is sorted, and sindex hold original positions. + * + * return 0 on success, -1 on failure +@@ -1164,7 +1164,7 @@ char *nifti_strdup(const char *str) + + /* check for failure */ + if( dup ) strcpy(dup, str); +- else fprintf(stderr,"** nifti_strdup: failed to alloc %u bytes\n", ++ else fprintf(stderr,"** nifti_strdup: failed to alloc %u bytes\n", + (unsigned int)strlen(str)+1); + + return dup; +@@ -1183,7 +1183,7 @@ char *nifti_strdup(const char *str) + + \sa NIFTI1_DATATYPES group in nifti1.h + *//*-------------------------------------------------------------------------*/ +-char *nifti_datatype_string( int dt ) ++char const * nifti_datatype_string( int dt ) + { + switch( dt ){ + case DT_UNKNOWN: return "UNKNOWN" ; +@@ -1252,7 +1252,7 @@ int nifti_is_inttype( int dt ) + + \sa NIFTI1_UNITS group in nifti1.h + *//*-------------------------------------------------------------------------*/ +-char *nifti_units_string( int uu ) ++char const *nifti_units_string( int uu ) + { + switch( uu ){ + case NIFTI_UNITS_METER: return "m" ; +@@ -1280,7 +1280,7 @@ char *nifti_units_string( int uu ) + + \sa NIFTI1_XFORM_CODES group in nifti1.h + *//*-------------------------------------------------------------------------*/ +-char *nifti_xform_string( int xx ) ++char const *nifti_xform_string( int xx ) + { + switch( xx ){ + case NIFTI_XFORM_SCANNER_ANAT: return "Scanner Anat" ; +@@ -1303,7 +1303,7 @@ char *nifti_xform_string( int xx ) + + \sa NIFTI1_INTENT_CODES group in nifti1.h + *//*-------------------------------------------------------------------------*/ +-char *nifti_intent_string( int ii ) ++char const *nifti_intent_string( int ii ) + { + switch( ii ){ + case NIFTI_INTENT_CORREL: return "Correlation statistic" ; +@@ -1359,7 +1359,7 @@ char *nifti_intent_string( int ii ) + + \sa NIFTI1_SLICE_ORDER group in nifti1.h + *//*-------------------------------------------------------------------------*/ +-char *nifti_slice_string( int ss ) ++char const *nifti_slice_string( int ss ) + { + switch( ss ){ + case NIFTI_SLICE_SEQ_INC: return "sequential_increasing" ; +@@ -1384,7 +1384,7 @@ char *nifti_slice_string( int ss ) + + \sa NIFTI_L2R in nifti1_io.h + *//*-------------------------------------------------------------------------*/ +-char *nifti_orientation_string( int ii ) ++char const *nifti_orientation_string( int ii ) + { + switch( ii ){ + case NIFTI_L2R: return "Left-to-Right" ; +@@ -1472,7 +1472,7 @@ mat44 nifti_quatern_to_mat44( float qb, float qc, float qd, + + /* last row is always [ 0 0 0 1 ] */ + +- R.m[3][0]=R.m[3][1]=R.m[3][2] = 0.0 ; R.m[3][3]= 1.0 ; ++ R.m[3][0]=R.m[3][1]=R.m[3][2] = 0.0f ; R.m[3][3]= 1.0f ; + + /* compute a parameter from b,c,d */ + +@@ -1493,15 +1493,15 @@ mat44 nifti_quatern_to_mat44( float qb, float qc, float qd, + + if( qfac < 0.0 ) zd = -zd ; /* left handedness? */ + +- R.m[0][0] = (a*a+b*b-c*c-d*d) * xd ; ++ R.m[0][0] = (float)( (a*a+b*b-c*c-d*d) * xd) ; + R.m[0][1] = 2.0l * (b*c-a*d ) * yd ; + R.m[0][2] = 2.0l * (b*d+a*c ) * zd ; + R.m[1][0] = 2.0l * (b*c+a*d ) * xd ; +- R.m[1][1] = (a*a+c*c-b*b-d*d) * yd ; ++ R.m[1][1] = (float)( (a*a+c*c-b*b-d*d) * yd) ; + R.m[1][2] = 2.0l * (c*d-a*b ) * zd ; + R.m[2][0] = 2.0l * (b*d-a*c ) * xd ; + R.m[2][1] = 2.0l * (c*d+a*b ) * yd ; +- R.m[2][2] = (a*a+d*d-c*c-b*b) * zd ; ++ R.m[2][2] = (float)( (a*a+d*d-c*c-b*b) * zd) ; + + /* load offsets */ + +@@ -1567,7 +1567,7 @@ void nifti_mat44_to_quatern( mat44 R , + + /* assign the output lengths */ + +- ASSIF(dx,xd) ; ASSIF(dy,yd) ; ASSIF(dz,zd) ; ++ ASSIF(dx,(float)xd) ; ASSIF(dy,(float)yd) ; ASSIF(dz,(float)zd) ; + + /* normalize the columns */ + +@@ -1587,9 +1587,9 @@ void nifti_mat44_to_quatern( mat44 R , + will result in the inverse orthogonal matrix at this point. + If we just orthogonalized the columns, this wouldn't necessarily hold. */ + +- Q.m[0][0] = r11 ; Q.m[0][1] = r12 ; Q.m[0][2] = r13 ; /* load Q */ +- Q.m[1][0] = r21 ; Q.m[1][1] = r22 ; Q.m[1][2] = r23 ; +- Q.m[2][0] = r31 ; Q.m[2][1] = r32 ; Q.m[2][2] = r33 ; ++ Q.m[0][0] = (float)r11 ; Q.m[0][1] = (float)r12 ; Q.m[0][2] = (float)r13 ; /* load Q */ ++ Q.m[1][0] = (float)r21 ; Q.m[1][1] = (float)r22 ; Q.m[1][2] = (float)r23 ; ++ Q.m[2][0] = (float)r31 ; Q.m[2][1] = (float)r32 ; Q.m[2][2] = (float)r33 ; + + P = nifti_mat33_polar(Q) ; /* P is orthog matrix closest to Q */ + +@@ -1607,9 +1607,9 @@ void nifti_mat44_to_quatern( mat44 R , + +r21*r32*r13+r31*r12*r23-r31*r22*r13 ; /* should be -1 or 1 */ + + if( zd > 0 ){ /* proper */ +- ASSIF(qfac,1.0) ; ++ ASSIF(qfac,1.0f) ; + } else { /* improper ==> flip 3rd column */ +- ASSIF(qfac,-1.0) ; ++ ASSIF(qfac,-1.0f) ; + r13 = -r13 ; r23 = -r23 ; r33 = -r33 ; + } + +@@ -1645,7 +1645,7 @@ void nifti_mat44_to_quatern( mat44 R , + if( a < 0.0l ){ b=-b ; c=-c ; d=-d; a=-a; } + } + +- ASSIF(qb,b) ; ASSIF(qc,c) ; ASSIF(qd,d) ; ++ ASSIF(qb,(float)b) ; ASSIF(qc,(float)c) ; ASSIF(qd,(float)d) ; + return ; + } + +@@ -1680,23 +1680,23 @@ mat44 nifti_mat44_inverse( mat44 R ) + + if( deti != 0.0l ) deti = 1.0l / deti ; + +- Q.m[0][0] = deti*( r22*r33-r32*r23) ; +- Q.m[0][1] = deti*(-r12*r33+r32*r13) ; +- Q.m[0][2] = deti*( r12*r23-r22*r13) ; +- Q.m[0][3] = deti*(-r12*r23*v3+r12*v2*r33+r22*r13*v3 +- -r22*v1*r33-r32*r13*v2+r32*v1*r23) ; ++ Q.m[0][0] = (float)( deti*( r22*r33-r32*r23) ) ; ++ Q.m[0][1] = (float)( deti*(-r12*r33+r32*r13) ) ; ++ Q.m[0][2] = (float)( deti*( r12*r23-r22*r13) ) ; ++ Q.m[0][3] = (float)( deti*(-r12*r23*v3+r12*v2*r33+r22*r13*v3 ++ -r22*v1*r33-r32*r13*v2+r32*v1*r23) ) ; + +- Q.m[1][0] = deti*(-r21*r33+r31*r23) ; +- Q.m[1][1] = deti*( r11*r33-r31*r13) ; +- Q.m[1][2] = deti*(-r11*r23+r21*r13) ; +- Q.m[1][3] = deti*( r11*r23*v3-r11*v2*r33-r21*r13*v3 +- +r21*v1*r33+r31*r13*v2-r31*v1*r23) ; ++ Q.m[1][0] = (float)( deti*(-r21*r33+r31*r23) ) ; ++ Q.m[1][1] = (float)( deti*( r11*r33-r31*r13) ) ; ++ Q.m[1][2] = (float)( deti*(-r11*r23+r21*r13) ) ; ++ Q.m[1][3] = (float)( deti*( r11*r23*v3-r11*v2*r33-r21*r13*v3 ++ +r21*v1*r33+r31*r13*v2-r31*v1*r23) ) ; + +- Q.m[2][0] = deti*( r21*r32-r31*r22) ; +- Q.m[2][1] = deti*(-r11*r32+r31*r12) ; +- Q.m[2][2] = deti*( r11*r22-r21*r12) ; +- Q.m[2][3] = deti*(-r11*r22*v3+r11*r32*v2+r21*r12*v3 +- -r21*r32*v1-r31*r12*v2+r31*r22*v1) ; ++ Q.m[2][0] = (float)( deti*( r21*r32-r31*r22) ) ; ++ Q.m[2][1] = (float)( deti*(-r11*r32+r31*r12) ) ; ++ Q.m[2][2] = (float)( deti*( r11*r22-r21*r12) ) ; ++ Q.m[2][3] = (float)( deti*(-r11*r22*v3+r11*r32*v2+r21*r12*v3 ++ -r21*r32*v1-r31*r12*v2+r31*r22*v1) ) ; + + Q.m[3][0] = Q.m[3][1] = Q.m[3][2] = 0.0l ; + Q.m[3][3] = (deti == 0.0l) ? 0.0l : 1.0l ; /* failure flag if deti == 0 */ +@@ -1753,7 +1753,7 @@ mat44 nifti_make_orthog_mat44( float r11, float r12, float r13 , + val = Q.m[0][0]*Q.m[0][0] + Q.m[0][1]*Q.m[0][1] + Q.m[0][2]*Q.m[0][2] ; + if( val > 0.0l ){ + val = 1.0l / sqrt(val) ; +- Q.m[0][0] *= val ; Q.m[0][1] *= val ; Q.m[0][2] *= val ; ++ Q.m[0][0] *= (float)val ; Q.m[0][1] *= (float)val ; Q.m[0][2] *= (float)val ; + } else { + Q.m[0][0] = 1.0l ; Q.m[0][1] = 0.0l ; Q.m[0][2] = 0.0l ; + } +@@ -1763,7 +1763,7 @@ mat44 nifti_make_orthog_mat44( float r11, float r12, float r13 , + val = Q.m[1][0]*Q.m[1][0] + Q.m[1][1]*Q.m[1][1] + Q.m[1][2]*Q.m[1][2] ; + if( val > 0.0l ){ + val = 1.0l / sqrt(val) ; +- Q.m[1][0] *= val ; Q.m[1][1] *= val ; Q.m[1][2] *= val ; ++ Q.m[1][0] *= (float)val ; Q.m[1][1] *= (float)val ; Q.m[1][2] *= (float)val ; + } else { + Q.m[1][0] = 0.0l ; Q.m[1][1] = 1.0l ; Q.m[1][2] = 0.0l ; + } +@@ -1773,7 +1773,7 @@ mat44 nifti_make_orthog_mat44( float r11, float r12, float r13 , + val = Q.m[2][0]*Q.m[2][0] + Q.m[2][1]*Q.m[2][1] + Q.m[2][2]*Q.m[2][2] ; + if( val > 0.0l ){ + val = 1.0l / sqrt(val) ; +- Q.m[2][0] *= val ; Q.m[2][1] *= val ; Q.m[2][2] *= val ; ++ Q.m[2][0] *= (float)val ; Q.m[2][1] *= (float)val ; Q.m[2][2] *= (float)val ; + } else { + Q.m[2][0] = Q.m[0][1]*Q.m[1][2] - Q.m[0][2]*Q.m[1][1] ; /* cross */ + Q.m[2][1] = Q.m[0][2]*Q.m[1][0] - Q.m[0][0]*Q.m[1][2] ; /* product */ +@@ -1786,7 +1786,7 @@ mat44 nifti_make_orthog_mat44( float r11, float r12, float r13 , + R.m[1][0] = P.m[1][0] ; R.m[1][1] = P.m[1][1] ; R.m[1][2] = P.m[1][2] ; + R.m[2][0] = P.m[2][0] ; R.m[2][1] = P.m[2][1] ; R.m[2][2] = P.m[2][2] ; + +- R.m[0][3] = R.m[1][3] = R.m[2][3] = 0.0 ; return R ; ++ R.m[0][3] = R.m[1][3] = R.m[2][3] = 0.0f ; return R ; + } + + /*----------------------------------------------------------------------*/ +@@ -1806,17 +1806,17 @@ mat33 nifti_mat33_inverse( mat33 R ) /* inverse of 3x3 matrix */ + + if( deti != 0.0l ) deti = 1.0l / deti ; + +- Q.m[0][0] = deti*( r22*r33-r32*r23) ; +- Q.m[0][1] = deti*(-r12*r33+r32*r13) ; +- Q.m[0][2] = deti*( r12*r23-r22*r13) ; ++ Q.m[0][0] = (float)( deti*( r22*r33-r32*r23) ) ; ++ Q.m[0][1] = (float)( deti*(-r12*r33+r32*r13) ) ; ++ Q.m[0][2] = (float)( deti*( r12*r23-r22*r13) ) ; + +- Q.m[1][0] = deti*(-r21*r33+r31*r23) ; +- Q.m[1][1] = deti*( r11*r33-r31*r13) ; +- Q.m[1][2] = deti*(-r11*r23+r21*r13) ; ++ Q.m[1][0] = (float)( deti*(-r21*r33+r31*r23) ) ; ++ Q.m[1][1] = (float)( deti*( r11*r33-r31*r13) ) ; ++ Q.m[1][2] = (float)( deti*(-r11*r23+r21*r13) ) ; + +- Q.m[2][0] = deti*( r21*r32-r31*r22) ; +- Q.m[2][1] = deti*(-r11*r32+r31*r12) ; +- Q.m[2][2] = deti*( r11*r22-r21*r12) ; ++ Q.m[2][0] = (float)( deti*( r21*r32-r31*r22) ) ; ++ Q.m[2][1] = (float)( deti*(-r11*r32+r31*r12) ) ; ++ Q.m[2][2] = (float)( deti*( r11*r22-r21*r12) ) ; + + return Q ; + } +@@ -1832,8 +1832,8 @@ float nifti_mat33_determ( mat33 R ) /* determinant of 3x3 matrix */ + r21 = R.m[1][0]; r22 = R.m[1][1]; r23 = R.m[1][2]; /* [ r21 r22 r23 ] */ + r31 = R.m[2][0]; r32 = R.m[2][1]; r33 = R.m[2][2]; /* [ r31 r32 r33 ] */ + +- return r11*r22*r33-r11*r32*r23-r21*r12*r33 +- +r21*r32*r13+r31*r12*r23-r31*r22*r13 ; ++ return (float)(r11*r22*r33-r11*r32*r23-r21*r12*r33 ++ +r21*r32*r13+r31*r12*r23-r31*r22*r13) ; + } + + /*----------------------------------------------------------------------*/ +@@ -1843,9 +1843,9 @@ float nifti_mat33_rownorm( mat33 A ) /* max row norm of 3x3 matrix */ + { + float r1,r2,r3 ; + +- r1 = fabs(A.m[0][0])+fabs(A.m[0][1])+fabs(A.m[0][2]) ; +- r2 = fabs(A.m[1][0])+fabs(A.m[1][1])+fabs(A.m[1][2]) ; +- r3 = fabs(A.m[2][0])+fabs(A.m[2][1])+fabs(A.m[2][2]) ; ++ r1 = (float)( fabs(A.m[0][0])+fabs(A.m[0][1])+fabs(A.m[0][2]) ) ; ++ r2 = (float)( fabs(A.m[1][0])+fabs(A.m[1][1])+fabs(A.m[1][2]) ) ; ++ r3 = (float)( fabs(A.m[2][0])+fabs(A.m[2][1])+fabs(A.m[2][2]) ) ; + if( r1 < r2 ) r1 = r2 ; + if( r1 < r3 ) r1 = r3 ; + return r1 ; +@@ -1858,9 +1858,9 @@ float nifti_mat33_colnorm( mat33 A ) /* max column norm of 3x3 matrix */ + { + float r1,r2,r3 ; + +- r1 = fabs(A.m[0][0])+fabs(A.m[1][0])+fabs(A.m[2][0]) ; +- r2 = fabs(A.m[0][1])+fabs(A.m[1][1])+fabs(A.m[2][1]) ; +- r3 = fabs(A.m[0][2])+fabs(A.m[1][2])+fabs(A.m[2][2]) ; ++ r1 = (float)( fabs(A.m[0][0])+fabs(A.m[1][0])+fabs(A.m[2][0]) ) ; ++ r2 = (float)( fabs(A.m[0][1])+fabs(A.m[1][1])+fabs(A.m[2][1]) ) ; ++ r3 = (float)( fabs(A.m[0][2])+fabs(A.m[1][2])+fabs(A.m[2][2]) ) ; + if( r1 < r2 ) r1 = r2 ; + if( r1 < r3 ) r1 = r3 ; + return r1 ; +@@ -1891,7 +1891,7 @@ mat33 nifti_mat33_mul( mat33 A , mat33 B ) /* multiply 2 3x3 matrices */ + mat33 nifti_mat33_polar( mat33 A ) + { + mat33 X , Y , Z ; +- float alp,bet,gam,gmi , dif=1.0 ; ++ float alp,bet,gam,gmi , dif=1.0f ; + int k=0 ; + + X = A ; +@@ -1900,7 +1900,7 @@ mat33 nifti_mat33_polar( mat33 A ) + + gam = nifti_mat33_determ(X) ; + while( gam == 0.0 ){ /* perturb matrix */ +- gam = 0.00001 * ( 0.001 + nifti_mat33_rownorm(X) ) ; ++ gam = (float)( 0.00001 * ( 0.001 + nifti_mat33_rownorm(X) ) ) ; + X.m[0][0] += gam ; X.m[1][1] += gam ; X.m[2][2] += gam ; + gam = nifti_mat33_determ(X) ; + } +@@ -1908,28 +1908,28 @@ mat33 nifti_mat33_polar( mat33 A ) + while(1){ + Y = nifti_mat33_inverse(X) ; + if( dif > 0.3 ){ /* far from convergence */ +- alp = sqrt( nifti_mat33_rownorm(X) * nifti_mat33_colnorm(X) ) ; +- bet = sqrt( nifti_mat33_rownorm(Y) * nifti_mat33_colnorm(Y) ) ; +- gam = sqrt( bet / alp ) ; +- gmi = 1.0 / gam ; ++ alp = (float)( sqrt( nifti_mat33_rownorm(X) * nifti_mat33_colnorm(X) ) ) ; ++ bet = (float)( sqrt( nifti_mat33_rownorm(Y) * nifti_mat33_colnorm(Y) ) ) ; ++ gam = (float)( sqrt( bet / alp ) ) ; ++ gmi = (float)( 1.0 / gam ) ; + } else { +- gam = gmi = 1.0 ; /* close to convergence */ ++ gam = gmi = 1.0f ; /* close to convergence */ + } +- Z.m[0][0] = 0.5 * ( gam*X.m[0][0] + gmi*Y.m[0][0] ) ; +- Z.m[0][1] = 0.5 * ( gam*X.m[0][1] + gmi*Y.m[1][0] ) ; +- Z.m[0][2] = 0.5 * ( gam*X.m[0][2] + gmi*Y.m[2][0] ) ; +- Z.m[1][0] = 0.5 * ( gam*X.m[1][0] + gmi*Y.m[0][1] ) ; +- Z.m[1][1] = 0.5 * ( gam*X.m[1][1] + gmi*Y.m[1][1] ) ; +- Z.m[1][2] = 0.5 * ( gam*X.m[1][2] + gmi*Y.m[2][1] ) ; +- Z.m[2][0] = 0.5 * ( gam*X.m[2][0] + gmi*Y.m[0][2] ) ; +- Z.m[2][1] = 0.5 * ( gam*X.m[2][1] + gmi*Y.m[1][2] ) ; +- Z.m[2][2] = 0.5 * ( gam*X.m[2][2] + gmi*Y.m[2][2] ) ; +- +- dif = fabs(Z.m[0][0]-X.m[0][0])+fabs(Z.m[0][1]-X.m[0][1]) ++ Z.m[0][0] = (float)( 0.5 * ( gam*X.m[0][0] + gmi*Y.m[0][0] ) ) ; ++ Z.m[0][1] = (float)( 0.5 * ( gam*X.m[0][1] + gmi*Y.m[1][0] ) ) ; ++ Z.m[0][2] = (float)( 0.5 * ( gam*X.m[0][2] + gmi*Y.m[2][0] ) ) ; ++ Z.m[1][0] = (float)( 0.5 * ( gam*X.m[1][0] + gmi*Y.m[0][1] ) ) ; ++ Z.m[1][1] = (float)( 0.5 * ( gam*X.m[1][1] + gmi*Y.m[1][1] ) ) ; ++ Z.m[1][2] = (float)( 0.5 * ( gam*X.m[1][2] + gmi*Y.m[2][1] ) ) ; ++ Z.m[2][0] = (float)( 0.5 * ( gam*X.m[2][0] + gmi*Y.m[0][2] ) ) ; ++ Z.m[2][1] = (float)( 0.5 * ( gam*X.m[2][1] + gmi*Y.m[1][2] ) ) ; ++ Z.m[2][2] = (float)( 0.5 * ( gam*X.m[2][2] + gmi*Y.m[2][2] ) ) ; ++ ++ dif = (float)( fabs(Z.m[0][0]-X.m[0][0])+fabs(Z.m[0][1]-X.m[0][1]) + +fabs(Z.m[0][2]-X.m[0][2])+fabs(Z.m[1][0]-X.m[1][0]) + +fabs(Z.m[1][1]-X.m[1][1])+fabs(Z.m[1][2]-X.m[1][2]) + +fabs(Z.m[2][0]-X.m[2][0])+fabs(Z.m[2][1]-X.m[2][1]) +- +fabs(Z.m[2][2]-X.m[2][2]) ; ++ +fabs(Z.m[2][2]-X.m[2][2]) ); + + k = k+1 ; + if( k > 100 || dif < 3.e-6 ) break ; /* convergence or exhaustion */ +@@ -1986,13 +1986,13 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) + + /* normalize i axis */ + +- val = sqrt( xi*xi + yi*yi + zi*zi ) ; ++ val = (float)sqrt( xi*xi + yi*yi + zi*zi ) ; + if( val == 0.0 ) return ; /* stupid input */ + xi /= val ; yi /= val ; zi /= val ; + + /* normalize j axis */ + +- val = sqrt( xj*xj + yj*yj + zj*zj ) ; ++ val = (float)sqrt( xj*xj + yj*yj + zj*zj ) ; + if( val == 0.0 ) return ; /* stupid input */ + xj /= val ; yj /= val ; zj /= val ; + +@@ -2001,14 +2001,14 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) + val = xi*xj + yi*yj + zi*zj ; /* dot product between i and j */ + if( fabs(val) > 1.e-4 ){ + xj -= val*xi ; yj -= val*yi ; zj -= val*zi ; +- val = sqrt( xj*xj + yj*yj + zj*zj ) ; /* must renormalize */ ++ val = (float)sqrt( xj*xj + yj*yj + zj*zj ) ; /* must renormalize */ + if( val == 0.0 ) return ; /* j was parallel to i? */ + xj /= val ; yj /= val ; zj /= val ; + } + + /* normalize k axis; if it is zero, make it the cross product i x j */ + +- val = sqrt( xk*xk + yk*yk + zk*zk ) ; ++ val = (float)sqrt( xk*xk + yk*yk + zk*zk ) ; + if( val == 0.0 ){ xk = yi*zj-zi*yj; yk = zi*xj-zj*xi ; zk=xi*yj-yi*xj ; } + else { xk /= val ; yk /= val ; zk /= val ; } + +@@ -2017,7 +2017,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) + val = xi*xk + yi*yk + zi*zk ; /* dot product between i and k */ + if( fabs(val) > 1.e-4 ){ + xk -= val*xi ; yk -= val*yi ; zk -= val*zi ; +- val = sqrt( xk*xk + yk*yk + zk*zk ) ; ++ val = (float)sqrt( xk*xk + yk*yk + zk*zk ) ; + if( val == 0.0 ) return ; /* bad */ + xk /= val ; yk /= val ; zk /= val ; + } +@@ -2027,7 +2027,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) + val = xj*xk + yj*yk + zj*zk ; /* dot product between j and k */ + if( fabs(val) > 1.e-4 ){ + xk -= val*xj ; yk -= val*yj ; zk -= val*zj ; +- val = sqrt( xk*xk + yk*yk + zk*zk ) ; ++ val = (float)sqrt( xk*xk + yk*yk + zk*zk ) ; + if( val == 0.0 ) return ; /* bad */ + xk /= val ; yk /= val ; zk /= val ; + } +@@ -2048,7 +2048,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) + /* Despite the formidable looking 6 nested loops, there are + only 3*3*3*2*2*2 = 216 passes, which will run very quickly. */ + +- vbest = -666.0 ; ibest=pbest=qbest=rbest=1 ; jbest=2 ; kbest=3 ; ++ vbest = -666.0f ; ibest=pbest=qbest=rbest=1 ; jbest=2 ; kbest=3 ; + for( i=1 ; i <= 3 ; i++ ){ /* i = column number to use for row #1 */ + for( j=1 ; j <= 3 ; j++ ){ /* j = column number to use for row #2 */ + if( i == j ) continue ; +@@ -2056,7 +2056,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) + if( i == k || j == k ) continue ; + P.m[0][0] = P.m[0][1] = P.m[0][2] = + P.m[1][0] = P.m[1][1] = P.m[1][2] = +- P.m[2][0] = P.m[2][1] = P.m[2][2] = 0.0 ; ++ P.m[2][0] = P.m[2][1] = P.m[2][2] = 0.0f ; + for( p=-1 ; p <= 1 ; p+=2 ){ /* p,q,r are -1 or +1 */ + for( q=-1 ; q <= 1 ; q+=2 ){ /* and go into rows #1,2,3 */ + for( r=-1 ; r <= 1 ; r+=2 ){ +@@ -2130,7 +2130,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) + + /*----------------------------------------------------------------------*/ + /*! swap each byte pair from the given list of n pairs +- * ++ * + * Due to alignment of structures at some architectures (e.g. on ARM), + * stick to char varaibles. + * Fixes http://bugs.debian.org/446893 Yaroslav +@@ -2375,7 +2375,7 @@ int nifti_swap_as_analyze( nifti_analyze75 * h ) + + /*-------------------------------------------------------------------------*/ + /*! OLD VERSION of swap_nifti_header (left for undo/compare operations) +- ++ + Byte swap NIFTI-1 file header in various places and ways. + + If is_nifti is nonzero, will also swap the NIFTI-specific +@@ -2463,7 +2463,7 @@ int nifti_get_filesize( const char *pathname ) + *//*--------------------------------------------------------------------*/ + size_t nifti_get_volsize(const nifti_image *nim) + { +- return nim->nbyper * nim->nvox ; /* total bytes */ ++ return (size_t)(nim->nbyper) * (size_t)(nim->nvox) ; /* total bytes */ + } + + +@@ -2488,7 +2488,7 @@ int nifti_fileexists(const char* fname) + + /*----------------------------------------------------------------------*/ + /*! return whether the filename is valid +- ++ + Note: uppercase extensions are now valid. 27 Apr 2009 [rickr] + + The name is considered valid if the file basename has length greater than +@@ -2505,7 +2505,7 @@ int nifti_fileexists(const char* fname) + *//*--------------------------------------------------------------------*/ + int nifti_is_complete_filename(const char* fname) + { +- char * ext; ++ const char * ext; + + /* check input file(s) for sanity */ + if( fname == NULL || *fname == '\0' ){ +@@ -2531,7 +2531,7 @@ int nifti_is_complete_filename(const char* fname) + + /*----------------------------------------------------------------------*/ + /*! return whether the filename is valid +- ++ + Allow uppercase extensions as valid. 27 Apr 2009 [rickr] + Any .gz extension case must match the base extension case. + +@@ -2549,7 +2549,7 @@ int nifti_is_complete_filename(const char* fname) + *//*--------------------------------------------------------------------*/ + int nifti_validfilename(const char* fname) + { +- char * ext; ++ const char * ext; + + /* check input file(s) for sanity */ + if( fname == NULL || *fname == '\0' ){ +@@ -2578,11 +2578,18 @@ int nifti_validfilename(const char* fname) + + Uppercase extensions are also valid, but not mixed case. + +- \return a pointer to the extension (within the filename), or NULL ++ \return a pointer to the extension substring within the original ++ function input parameter name, or NULL if not found. ++ \caution Note that if the input parameter is is immutabale ++ (i.e. a const char *) then this function performs an ++ implicit casting away of the mutability constraint and ++ the return parameter will appear as a mutable ++ even though it is part of the immuttable string. + *//*--------------------------------------------------------------------*/ + char * nifti_find_file_extension( const char * name ) + { +- char * ext, extcopy[8]; ++ const char * ext; ++ char extcopy[8]; + int len; + char extnii[8] = ".nii"; /* modifiable, for possible uppercase */ + char exthdr[8] = ".hdr"; /* (leave space for .gz) */ +@@ -2599,7 +2606,7 @@ char * nifti_find_file_extension( const char * name ) + len = (int)strlen(name); + if ( len < 4 ) return NULL; + +- ext = (char *)name + len - 4; ++ ext = name + len - 4; + + /* make manipulation copy, and possibly convert to lowercase */ + strcpy(extcopy, ext); +@@ -2611,13 +2618,13 @@ char * nifti_find_file_extension( const char * name ) + fprintf(stderr,"** mixed case extension '%s' is not valid\n", ext); + return NULL; + } +- else return ext; ++ else return (char *)ext; /* Cast away the constness of the input parameter */ + } + + #ifdef HAVE_ZLIB + if ( len < 7 ) return NULL; + +- ext = (char *)name + len - 7; ++ ext = name + len - 7; + + /* make manipulation copy, and possibly convert to lowercase */ + strcpy(extcopy, ext); +@@ -2631,7 +2638,7 @@ char * nifti_find_file_extension( const char * name ) + fprintf(stderr,"** mixed case extension '%s' is not valid\n", ext); + return NULL; + } +- else return ext; ++ else return (char *)ext; /* Cast away the constness of the input parameter */ + } + + #endif +@@ -2679,13 +2686,17 @@ int nifti_compiled_with_zlib(void) + *//*--------------------------------------------------------------------*/ + char * nifti_makebasename(const char* fname) + { +- char *basename, *ext; ++ char *basename; ++ const char *ext; + + basename=nifti_strdup(fname); + + ext = nifti_find_file_extension(basename); +- if ( ext ) *ext = '\0'; /* clear out extension */ +- ++ if ( ext ) ++ { ++ basename[strlen(basename)-strlen(ext)] = '\0'; /* clear out extension */ ++ } ++ + return basename; /* in either case */ + } + +@@ -2725,7 +2736,7 @@ void nifti_set_allow_upper_fext( int allow ) + /*! check current directory for existing header file + + \return filename of header on success and NULL if no appropriate file +- could be found ++ could be found + + If fname has an uppercase extension, check for uppercase files. + +@@ -2734,7 +2745,8 @@ void nifti_set_allow_upper_fext( int allow ) + *//*-------------------------------------------------------------------*/ + char * nifti_findhdrname(const char* fname) + { +- char *basename, *hdrname, *ext; ++ char *basename, *hdrname; ++ const char *ext; + char elist[2][5] = { ".hdr", ".nii" }; + char extzip[4] = ".gz"; + int efirst = 1; /* init to .nii extension */ +@@ -2751,14 +2763,14 @@ char * nifti_findhdrname(const char* fname) + ext = nifti_find_file_extension(fname); + + if( ext ) eisupper = is_uppercase(ext); /* do we look for uppercase? */ +- ++ + /* if the file exists and is a valid header name (not .img), return it */ +- if ( ext && nifti_fileexists(fname) ) { ++ if ( ext && nifti_fileexists(fname) ) { + /* allow for uppercase extension */ + if ( fileext_n_compare(ext,".img",4) != 0 ){ +- hdrname = nifti_strdup(fname); ++ hdrname = nifti_strdup(fname); + free(basename); +- return hdrname; ++ return hdrname; + } else + efirst = 0; /* note for below */ + } +@@ -2791,7 +2803,7 @@ char * nifti_findhdrname(const char* fname) + strcat(hdrname,elist[efirst]); + if (nifti_fileexists(hdrname)) { free(basename); return hdrname; } + #ifdef HAVE_ZLIB +- strcat(hdrname,extzip); ++ strcat(hdrname,extzip); + if (nifti_fileexists(hdrname)) { free(basename); return hdrname; } + #endif + +@@ -2803,13 +2815,13 @@ char * nifti_findhdrname(const char* fname) + strcat(hdrname,elist[efirst]); + if (nifti_fileexists(hdrname)) { free(basename); return hdrname; } + #ifdef HAVE_ZLIB +- strcat(hdrname,extzip); ++ strcat(hdrname,extzip); + if (nifti_fileexists(hdrname)) { free(basename); return hdrname; } + #endif + + /**- if nothing has been found, return NULL */ +- free(basename); +- free(hdrname); ++ free(basename); ++ free(hdrname); + return NULL; + } + +@@ -2836,7 +2848,7 @@ char * nifti_findimgname(const char* fname , int nifti_type) + char *basename, *imgname, elist[2][5] = { ".nii", ".img" }; + char extzip[4] = ".gz"; + char extnia[5] = ".nia"; +- char *ext; ++ const char *ext; + int first; /* first extension to use */ + + /* check input file(s) for sanity */ +@@ -2910,7 +2922,7 @@ char * nifti_findimgname(const char* fname , int nifti_type) + \param comp - add .gz for compressed name + + Note that if prefix provides a file suffix, nifti_type is not used. +- ++ + NB: this allocates memory which should be freed + + \sa nifti_set_filenames +@@ -2918,7 +2930,8 @@ char * nifti_findimgname(const char* fname , int nifti_type) + char * nifti_makehdrname(const char * prefix, int nifti_type, int check, + int comp) + { +- char * iname, * ext; ++ char * iname; ++ const char * ext; + char extnii[5] = ".nii"; /* modifiable, for possible uppercase */ + char exthdr[5] = ".hdr"; + char extimg[5] = ".img"; +@@ -2944,7 +2957,9 @@ char * nifti_makehdrname(const char * prefix, int nifti_type, int check, + } + + if( strncmp(ext,extimg,4) == 0 ) +- memcpy(ext,exthdr,4); /* then convert img name to hdr */ ++ { ++ memcpy(&(iname[strlen(iname)-strlen(ext)]),exthdr,4); /* then convert img name to hdr */ ++ } + } + /* otherwise, make one up */ + else if( nifti_type == NIFTI_FTYPE_NIFTI1_1 ) strcat(iname, extnii); +@@ -2966,7 +2981,7 @@ char * nifti_makehdrname(const char * prefix, int nifti_type, int check, + + return iname; + } +- ++ + + /*----------------------------------------------------------------------*/ + /*! creates a filename for storing the image, based on nifti_type +@@ -2975,9 +2990,9 @@ char * nifti_makehdrname(const char * prefix, int nifti_type, int check, + \param nifti_type - determines the extension, unless provided by prefix + \param check - check for existence (fail condition) + \param comp - add .gz for compressed name +- ++ + Note that if prefix provides a file suffix, nifti_type is not used. +- ++ + NB: it allocates memory which should be freed + + \sa nifti_set_filenames +@@ -2985,7 +3000,8 @@ char * nifti_makehdrname(const char * prefix, int nifti_type, int check, + char * nifti_makeimgname(const char * prefix, int nifti_type, int check, + int comp) + { +- char * iname, * ext; ++ char * iname; ++ const char * ext; + char extnii[5] = ".nii"; /* modifiable, for possible uppercase */ + char exthdr[5] = ".hdr"; + char extimg[5] = ".img"; +@@ -3011,7 +3027,9 @@ char * nifti_makeimgname(const char * prefix, int nifti_type, int check, + } + + if( strncmp(ext,exthdr,4) == 0 ) +- memcpy(ext,extimg,4); /* then convert hdr name to img */ ++ { ++ memcpy(&(iname[strlen(iname)-strlen(ext)]),extimg,4); /* then convert hdr name to img */ ++ } + } + /* otherwise, make one up */ + else if( nifti_type == NIFTI_FTYPE_NIFTI1_1 ) strcat(iname, extnii); +@@ -3046,7 +3064,7 @@ char * nifti_makeimgname(const char * prefix, int nifti_type, int check, + (this is probably a logical place to do so) + + \return 0 on successful update +- ++ + \warning this will free() any existing names and create new ones + + \sa nifti_makeimgname, nifti_makehdrname, nifti_type_and_names_match +@@ -3106,7 +3124,8 @@ int nifti_set_filenames( nifti_image * nim, const char * prefix, int check, + int nifti_type_and_names_match( nifti_image * nim, int show_warn ) + { + char func[] = "nifti_type_and_names_match"; +- char * ext_h, * ext_i; /* header and image filename extensions */ ++ const char * ext_h; /* header filename extension */ ++ const char * ext_i; /* image filename extension */ + int errs = 0; /* error counter */ + + /* sanity checks */ +@@ -3200,10 +3219,9 @@ int nifti_type_and_names_match( nifti_image * nim, int show_warn ) + static int fileext_compare(const char * test_ext, const char * known_ext) + { + char caps[8] = ""; +- int c, cmp, len; +- ++ size_t c,len; + /* if equal, don't need to check case (store to avoid multiple calls) */ +- cmp = strcmp(test_ext, known_ext); ++ const int cmp = strcmp(test_ext, known_ext); + if( cmp == 0 ) return cmp; + + /* if anything odd, use default */ +@@ -3214,7 +3232,7 @@ static int fileext_compare(const char * test_ext, const char * known_ext) + + /* if here, strings are different but need to check upper-case */ + +- for(c = 0; c < len; c++ ) caps[c] = toupper(known_ext[c]); ++ for(c = 0; c < len; c++ ) caps[c] = toupper((int) known_ext[c]); + caps[c] = '\0'; + + return strcmp(test_ext, caps); +@@ -3223,13 +3241,12 @@ static int fileext_compare(const char * test_ext, const char * known_ext) + /* like strncmp, but also check against capitalization of known_ext + * (test as local string, with max length 7) */ + static int fileext_n_compare(const char * test_ext, +- const char * known_ext, int maxlen) ++ const char * known_ext, size_t maxlen) + { + char caps[8] = ""; +- int c, cmp, len; +- ++ size_t c,len; + /* if equal, don't need to check case (store to avoid multiple calls) */ +- cmp = strncmp(test_ext, known_ext, maxlen); ++ const int cmp = strncmp(test_ext, known_ext, maxlen); + if( cmp == 0 ) return cmp; + + /* if anything odd, use default */ +@@ -3240,8 +3257,7 @@ static int fileext_n_compare(const char * test_ext, + if( len > 7 ) return cmp; + + /* if here, strings are different but need to check upper-case */ +- +- for(c = 0; c < len; c++ ) caps[c] = toupper(known_ext[c]); ++ for(c = 0; c < len; c++ ) caps[c] = toupper((int) known_ext[c]); + caps[c] = '\0'; + + return strncmp(test_ext, caps, maxlen); +@@ -3250,13 +3266,14 @@ static int fileext_n_compare(const char * test_ext, + /* return 1 if there are uppercase but no lowercase */ + static int is_uppercase(const char * str) + { +- int c, hasupper = 0; ++ size_t c; ++ int hasupper = 0; + + if( !str || !*str ) return 0; + + for(c = 0; c < strlen(str); c++ ) { +- if( islower(str[c]) ) return 0; +- if( !hasupper && isupper(str[c]) ) hasupper = 1; ++ if( islower((int) str[c]) ) return 0; ++ if( !hasupper && isupper((int) str[c]) ) hasupper = 1; + } + + return hasupper; +@@ -3265,13 +3282,14 @@ static int is_uppercase(const char * str) + /* return 1 if there are both uppercase and lowercase characters */ + static int is_mixedcase(const char * str) + { +- int c, hasupper = 0, haslower = 0; ++ size_t c; ++ int hasupper = 0, haslower = 0; + + if( !str || !*str ) return 0; + + for(c = 0; c < strlen(str); c++ ) { +- if( !haslower && islower(str[c]) ) haslower = 1; +- if( !hasupper && isupper(str[c]) ) hasupper = 1; ++ if( !haslower && islower((int) str[c]) ) haslower = 1; ++ if( !hasupper && isupper((int) str[c]) ) hasupper = 1; + + if( haslower && hasupper ) return 1; + } +@@ -3282,12 +3300,12 @@ static int is_mixedcase(const char * str) + /* convert any lowercase chars to uppercase */ + static int make_uppercase(char * str) + { +- int c; ++ size_t c; + + if( !str || !*str ) return 0; + + for(c = 0; c < strlen(str); c++ ) +- if( islower(str[c]) ) str[c] = toupper(str[c]); ++ if( islower((int) str[c]) ) str[c] = toupper((int) str[c]); + + return 0; + } +@@ -3295,12 +3313,11 @@ static int make_uppercase(char * str) + /* convert any uppercase chars to lowercase */ + static int make_lowercase(char * str) + { +- int c; +- ++ size_t c; + if( !str || !*str ) return 0; + + for(c = 0; c < strlen(str); c++ ) +- if( isupper(str[c]) ) str[c] = tolower(str[c]); ++ if( isupper((int) str[c]) ) str[c] = tolower((int) str[c]); + + return 0; + } +@@ -3593,7 +3610,7 @@ int disp_nifti_1_header( const char * info, const nifti_1_header * hp ) + + /*----------------------------------------------------------------------*/ + /*! convert a nifti_1_header into a nift1_image +- ++ + \return an allocated nifti_image, or NULL on failure + *//*--------------------------------------------------------------------*/ + nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, +@@ -3612,7 +3629,7 @@ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, + nim->data = NULL; + + /**- check if we must swap bytes */ +- ++ + doswap = need_nhdr_swap(nhdr.dim[0], nhdr.sizeof_hdr); /* swap data flag */ + + if( doswap < 0 ){ +@@ -3669,7 +3686,7 @@ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, + + for( ii=1 ; ii <= nhdr.dim[0] ; ii++ ){ + if( nhdr.pixdim[ii] == 0.0 || +- !IS_GOOD_FLOAT(nhdr.pixdim[ii]) ) nhdr.pixdim[ii] = 1.0 ; ++ !IS_GOOD_FLOAT(nhdr.pixdim[ii]) ) nhdr.pixdim[ii] = 1.0f ; + } + + is_onefile = is_nifti && NIFTI_ONEFILE(nhdr) ; +@@ -3677,14 +3694,14 @@ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, + if( is_nifti ) nim->nifti_type = (is_onefile) ? NIFTI_FTYPE_NIFTI1_1 + : NIFTI_FTYPE_NIFTI1_2 ; + else nim->nifti_type = NIFTI_FTYPE_ANALYZE ; +- ++ + ii = nifti_short_order() ; + if( doswap ) nim->byteorder = REVERSE_ORDER(ii) ; + else nim->byteorder = ii ; +- ++ + + /**- set dimensions of data array */ +- ++ + nim->ndim = nim->dim[0] = nhdr.dim[0]; + nim->nx = nim->dim[1] = nhdr.dim[1]; + nim->ny = nim->dim[2] = nhdr.dim[2]; +@@ -3696,16 +3713,16 @@ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, + + for( ii=1, nim->nvox=1; ii <= nhdr.dim[0]; ii++ ) + nim->nvox *= nhdr.dim[ii]; +- ++ + /**- set the type of data in voxels and how many bytes per voxel */ +- ++ + nim->datatype = nhdr.datatype ; +- ++ + nifti_datatype_sizes( nim->datatype , &(nim->nbyper) , &(nim->swapsize) ) ; + if( nim->nbyper == 0 ){ free(nim); ERREX("bad datatype"); } +- ++ + /**- set the grid spacings */ +- ++ + nim->dx = nim->pixdim[1] = nhdr.pixdim[1] ; + nim->dy = nim->pixdim[2] = nhdr.pixdim[2] ; + nim->dz = nim->pixdim[3] = nhdr.pixdim[3] ; +@@ -3713,43 +3730,43 @@ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, + nim->du = nim->pixdim[5] = nhdr.pixdim[5] ; + nim->dv = nim->pixdim[6] = nhdr.pixdim[6] ; + nim->dw = nim->pixdim[7] = nhdr.pixdim[7] ; +- ++ + /**- compute qto_xyz transformation from pixel indexes (i,j,k) to (x,y,z) */ +- ++ + if( !is_nifti || nhdr.qform_code <= 0 ){ + /**- if not nifti or qform_code <= 0, use grid spacing for qto_xyz */ +- ++ + nim->qto_xyz.m[0][0] = nim->dx ; /* grid spacings */ + nim->qto_xyz.m[1][1] = nim->dy ; /* along diagonal */ + nim->qto_xyz.m[2][2] = nim->dz ; +- ++ + /* off diagonal is zero */ +- +- nim->qto_xyz.m[0][1]=nim->qto_xyz.m[0][2]=nim->qto_xyz.m[0][3] = 0.0; +- nim->qto_xyz.m[1][0]=nim->qto_xyz.m[1][2]=nim->qto_xyz.m[1][3] = 0.0; +- nim->qto_xyz.m[2][0]=nim->qto_xyz.m[2][1]=nim->qto_xyz.m[2][3] = 0.0; +- ++ ++ nim->qto_xyz.m[0][1]=nim->qto_xyz.m[0][2]=nim->qto_xyz.m[0][3] = 0.0f; ++ nim->qto_xyz.m[1][0]=nim->qto_xyz.m[1][2]=nim->qto_xyz.m[1][3] = 0.0f; ++ nim->qto_xyz.m[2][0]=nim->qto_xyz.m[2][1]=nim->qto_xyz.m[2][3] = 0.0f; ++ + /* last row is always [ 0 0 0 1 ] */ +- +- nim->qto_xyz.m[3][0]=nim->qto_xyz.m[3][1]=nim->qto_xyz.m[3][2] = 0.0; +- nim->qto_xyz.m[3][3]= 1.0 ; +- ++ ++ nim->qto_xyz.m[3][0]=nim->qto_xyz.m[3][1]=nim->qto_xyz.m[3][2] = 0.0f; ++ nim->qto_xyz.m[3][3]= 1.0f ; ++ + nim->qform_code = NIFTI_XFORM_UNKNOWN ; +- ++ + if( g_opts.debug > 1 ) fprintf(stderr,"-d no qform provided\n"); + } else { + /**- else NIFTI: use the quaternion-specified transformation */ +- ++ + nim->quatern_b = FIXED_FLOAT( nhdr.quatern_b ) ; + nim->quatern_c = FIXED_FLOAT( nhdr.quatern_c ) ; + nim->quatern_d = FIXED_FLOAT( nhdr.quatern_d ) ; +- ++ + nim->qoffset_x = FIXED_FLOAT(nhdr.qoffset_x) ; + nim->qoffset_y = FIXED_FLOAT(nhdr.qoffset_y) ; + nim->qoffset_z = FIXED_FLOAT(nhdr.qoffset_z) ; +- +- nim->qfac = (nhdr.pixdim[0] < 0.0) ? -1.0 : 1.0 ; /* left-handedness? */ +- ++ ++ nim->qfac = (nhdr.pixdim[0] < 0.0) ? -1.0f : 1.0f ; /* left-handedness? */ ++ + nim->qto_xyz = nifti_quatern_to_mat44( + nim->quatern_b, nim->quatern_c, nim->quatern_d, + nim->qoffset_x, nim->qoffset_y, nim->qoffset_z, +@@ -3761,88 +3778,88 @@ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, + if( g_opts.debug > 1 ) + nifti_disp_matrix_orient("-d qform orientations:\n", nim->qto_xyz); + } +- ++ + /**- load inverse transformation (x,y,z) -> (i,j,k) */ +- ++ + nim->qto_ijk = nifti_mat44_inverse( nim->qto_xyz ) ; +- ++ + /**- load sto_xyz affine transformation, if present */ +- ++ + if( !is_nifti || nhdr.sform_code <= 0 ){ + /**- if not nifti or sform_code <= 0, then no sto transformation */ +- ++ + nim->sform_code = NIFTI_XFORM_UNKNOWN ; + + if( g_opts.debug > 1 ) fprintf(stderr,"-d no sform provided\n"); +- ++ + } else { + /**- else set the sto transformation from srow_*[] */ +- ++ + nim->sto_xyz.m[0][0] = nhdr.srow_x[0] ; + nim->sto_xyz.m[0][1] = nhdr.srow_x[1] ; + nim->sto_xyz.m[0][2] = nhdr.srow_x[2] ; + nim->sto_xyz.m[0][3] = nhdr.srow_x[3] ; +- ++ + nim->sto_xyz.m[1][0] = nhdr.srow_y[0] ; + nim->sto_xyz.m[1][1] = nhdr.srow_y[1] ; + nim->sto_xyz.m[1][2] = nhdr.srow_y[2] ; + nim->sto_xyz.m[1][3] = nhdr.srow_y[3] ; +- ++ + nim->sto_xyz.m[2][0] = nhdr.srow_z[0] ; + nim->sto_xyz.m[2][1] = nhdr.srow_z[1] ; + nim->sto_xyz.m[2][2] = nhdr.srow_z[2] ; + nim->sto_xyz.m[2][3] = nhdr.srow_z[3] ; +- ++ + /* last row is always [ 0 0 0 1 ] */ +- +- nim->sto_xyz.m[3][0]=nim->sto_xyz.m[3][1]=nim->sto_xyz.m[3][2] = 0.0; +- nim->sto_xyz.m[3][3]= 1.0 ; +- ++ ++ nim->sto_xyz.m[3][0]=nim->sto_xyz.m[3][1]=nim->sto_xyz.m[3][2] = 0.0f; ++ nim->sto_xyz.m[3][3]= 1.0f ; ++ + nim->sto_ijk = nifti_mat44_inverse( nim->sto_xyz ) ; +- ++ + nim->sform_code = nhdr.sform_code ; + + if( g_opts.debug > 1 ) + nifti_disp_matrix_orient("-d sform orientations:\n", nim->sto_xyz); + } +- ++ + /**- set miscellaneous NIFTI stuff */ +- ++ + if( is_nifti ){ + nim->scl_slope = FIXED_FLOAT( nhdr.scl_slope ) ; + nim->scl_inter = FIXED_FLOAT( nhdr.scl_inter ) ; +- ++ + nim->intent_code = nhdr.intent_code ; +- ++ + nim->intent_p1 = FIXED_FLOAT( nhdr.intent_p1 ) ; + nim->intent_p2 = FIXED_FLOAT( nhdr.intent_p2 ) ; + nim->intent_p3 = FIXED_FLOAT( nhdr.intent_p3 ) ; +- ++ + nim->toffset = FIXED_FLOAT( nhdr.toffset ) ; +- ++ + memcpy(nim->intent_name,nhdr.intent_name,15); nim->intent_name[15] = '\0'; +- ++ + nim->xyz_units = XYZT_TO_SPACE(nhdr.xyzt_units) ; + nim->time_units = XYZT_TO_TIME (nhdr.xyzt_units) ; +- ++ + nim->freq_dim = DIM_INFO_TO_FREQ_DIM ( nhdr.dim_info ) ; + nim->phase_dim = DIM_INFO_TO_PHASE_DIM( nhdr.dim_info ) ; + nim->slice_dim = DIM_INFO_TO_SLICE_DIM( nhdr.dim_info ) ; +- ++ + nim->slice_code = nhdr.slice_code ; + nim->slice_start = nhdr.slice_start ; + nim->slice_end = nhdr.slice_end ; + nim->slice_duration = FIXED_FLOAT(nhdr.slice_duration) ; + } +- ++ + /**- set Miscellaneous ANALYZE stuff */ +- ++ + nim->cal_min = FIXED_FLOAT(nhdr.cal_min) ; + nim->cal_max = FIXED_FLOAT(nhdr.cal_max) ; +- ++ + memcpy(nim->descrip ,nhdr.descrip ,79) ; nim->descrip [79] = '\0' ; + memcpy(nim->aux_file,nhdr.aux_file,23) ; nim->aux_file[23] = '\0' ; +- ++ + /**- set ioff from vox_offset (but at least sizeof(header)) */ + + is_onefile = is_nifti && NIFTI_ONEFILE(nhdr) ; +@@ -3860,9 +3877,9 @@ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, + if (fname!=NULL) { + nifti_set_filenames(nim,fname,0,0); + if (nim->iname==NULL) { ERREX("bad filename"); } +- } else { +- nim->fname = NULL; +- nim->iname = NULL; ++ } else { ++ nim->fname = NULL; ++ nim->iname = NULL; + } + + /* clear extension fields */ +@@ -3910,11 +3927,11 @@ znzFile nifti_image_open(const char * hname, char * opts, nifti_image ** nim) + if( ((*nim) == NULL) || ((*nim)->iname == NULL) || + ((*nim)->nbyper <= 0) || ((*nim)->nvox <= 0) ) + ERREX("bad header info") ; +- ++ + /* open image data file */ + fptr = znzopen( (*nim)->iname, opts, nifti_is_gzfile((*nim)->iname) ); + if( znz_isnull(fptr) ) ERREX("Can't open data file") ; +- ++ + return fptr; + } + +@@ -3941,7 +3958,7 @@ nifti_1_header * nifti_read_header(const char * hname, int * swapped, int check) + int bytes, lswap; + char * hfile; + char fname[] = { "nifti_read_header" }; +- ++ + /* determine file name to use for header */ + hfile = nifti_findhdrname(hname); + if( hfile == NULL ){ +@@ -3967,7 +3984,7 @@ nifti_1_header * nifti_read_header(const char * hname, int * swapped, int check) + return NULL; + } + +- /* read the binary header */ ++ /* read the binary header */ + bytes = (int)znzread( &nhdr, 1, sizeof(nhdr), fp ); + znzclose( fp ); /* we are done with the file now */ + +@@ -4080,7 +4097,7 @@ int nifti_hdr_looks_good(const nifti_1_header * hdr) + + /*---------------------------------------------------------------------- + * check whether byte swapping is needed +- * ++ * + * dim[0] should be in [0,7], and sizeof_hdr should be accurate + * + * \returns > 0 : needs swap +@@ -4105,7 +4122,7 @@ static int need_nhdr_swap( short dim0, int hdrsize ) + } + + return -1; /* bad, naughty d0 */ +- } ++ } + + /* dim[0] == 0 should not happen, but could, so try hdrsize */ + if( hsize == sizeof(nifti_1_header) ) return 0; +@@ -4286,7 +4303,7 @@ static int has_ascii_header( znzFile fp ) + /*! nifti_read_ascii_image - process as a type-3 .nia image file + + return NULL on failure +- ++ + NOTE: this is NOT part of the NIFTI-1 standard + *//*--------------------------------------------------------------------*/ + nifti_image * nifti_read_ascii_image(znzFile fp, char *fname, int flen, +@@ -4373,7 +4390,7 @@ static int nifti_read_extensions( nifti_image *nim, znzFile fp, int remain ) + } + + posn = znztell(fp); +- ++ + if( (posn != sizeof(nifti_1_header)) && + (nim->nifti_type != NIFTI_FTYPE_ASCII) ) + fprintf(stderr,"** WARNING: posn not header size (%d, %d)\n", +@@ -4494,7 +4511,7 @@ static int nifti_add_exten_to_list( nifti1_extension * new_ext, + nifti1_extension ** list, int new_length ) + { + nifti1_extension * tmplist; +- ++ + tmplist = *list; + *list = (nifti1_extension *)malloc(new_length * sizeof(nifti1_extension)); + +@@ -4925,7 +4942,7 @@ int nifti_image_load( nifti_image *nim ) + + This function does not allocate memory, so dataptr must be valid. + *//*--------------------------------------------------------------------*/ +-size_t nifti_read_buffer(znzFile fp, void* dataptr, size_t ntot, ++size_t nifti_read_buffer(znzFile fp, void* dataptr, size_t ntot, + nifti_image *nim) + { + size_t ii; +@@ -4939,7 +4956,7 @@ size_t nifti_read_buffer(znzFile fp, void* dataptr, size_t ntot, + ii = znzread( dataptr , 1 , ntot , fp ) ; /* data input */ + + /* if read was short, fail */ +- if( ii < ntot ){ ++ if( ii < ntot ){ + if( g_opts.debug > 0 ) + fprintf(stderr,"++ WARNING: nifti_read_buffer(%s):\n" + " data bytes needed = %u\n" +@@ -4953,23 +4970,23 @@ size_t nifti_read_buffer(znzFile fp, void* dataptr, size_t ntot, + + if( g_opts.debug > 2 ) + fprintf(stderr,"+d nifti_read_buffer: read %u bytes\n", (unsigned)ii); +- ++ + /* byte swap array if needed */ +- ++ + /* ntot/swapsize might not fit as int, use size_t 6 Jul 2010 [rickr] */ + if( nim->swapsize > 1 && nim->byteorder != nifti_short_order() ) { + if( g_opts.debug > 1 ) + fprintf(stderr,"+d nifti_read_buffer: swapping data bytes...\n"); +- nifti_swap_Nbytes( ntot / nim->swapsize, nim->swapsize , dataptr ) ; ++ nifti_swap_Nbytes( (int)(ntot / nim->swapsize), nim->swapsize , dataptr ) ; + } + + #ifdef isfinite + { + /* check input float arrays for goodness, and fix bad floats */ + int fix_count = 0 ; +- ++ + switch( nim->datatype ){ +- ++ + case NIFTI_TYPE_FLOAT32: + case NIFTI_TYPE_COMPLEX64:{ + register float *far = (float *)dataptr ; register size_t jj,nj ; +@@ -4981,7 +4998,7 @@ size_t nifti_read_buffer(znzFile fp, void* dataptr, size_t ntot, + } + } + break ; +- ++ + case NIFTI_TYPE_FLOAT64: + case NIFTI_TYPE_COMPLEX128:{ + register double *far = (double *)dataptr ; register size_t jj,nj ; +@@ -4993,14 +5010,14 @@ size_t nifti_read_buffer(znzFile fp, void* dataptr, size_t ntot, + } + } + break ; +- ++ + } + + if( g_opts.debug > 1 ) + fprintf(stderr,"+d in image, %d bad floats were set to 0\n", fix_count); + } + #endif +- ++ + return ii; + } + +@@ -5102,7 +5119,7 @@ size_t nifti_write_buffer(znzFile fp, const void *buffer, size_t numbytes) + fprintf(stderr,"** ERROR: nifti_write_buffer: null file pointer\n"); + return 0; + } +- ss = znzwrite( (void*)buffer , 1 , numbytes , fp ) ; ++ ss = znzwrite( (const void*)buffer , 1 , numbytes , fp ) ; + return ss; + } + +@@ -5116,7 +5133,7 @@ size_t nifti_write_buffer(znzFile fp, const void *buffer, size_t numbytes) + \param fp : File pointer + \param nim : nifti_image corresponding to the data + \param NBL : optional source of write data (if NULL use nim->data) +- ++ + \return 0 on success, -1 on failure + + Note: the nifti_image byte_order is set as that of the current CPU. +@@ -5243,9 +5260,9 @@ nifti_image* nifti_simple_init_nim(void) + nifti_image *nim; + struct nifti_1_header nhdr; + int nbyper, swapsize; +- ++ + memset(&nhdr,0,sizeof(nhdr)) ; /* zero out header, to be safe */ +- ++ + nhdr.sizeof_hdr = sizeof(nhdr) ; + nhdr.regular = 'r' ; /* for some stupid reason */ + +@@ -5253,9 +5270,9 @@ nifti_image* nifti_simple_init_nim(void) + nhdr.dim[1] = 1 ; nhdr.dim[2] = 1 ; nhdr.dim[3] = 1 ; + nhdr.dim[4] = 0 ; + +- nhdr.pixdim[0] = 0.0 ; +- nhdr.pixdim[1] = 1.0 ; nhdr.pixdim[2] = 1.0 ; +- nhdr.pixdim[3] = 1.0 ; ++ nhdr.pixdim[0] = 0.0f ; ++ nhdr.pixdim[1] = 1.0f ; nhdr.pixdim[2] = 1.0f ; ++ nhdr.pixdim[3] = 1.0f ; + + nhdr.datatype = DT_FLOAT32 ; + nifti_datatype_sizes( nhdr.datatype , &nbyper, &swapsize ); +@@ -5275,7 +5292,7 @@ nifti_image* nifti_simple_init_nim(void) + + Return an allocated nifti_1_header struct, based on the given + dimensions and datatype. +- ++ + \param arg_dims : optional dim[8] array (default {3,1,1,1,0,0,0,0}) + \param arg_dtype : optional datatype (default DT_FLOAT32) + +@@ -5288,7 +5305,7 @@ nifti_1_header * nifti_make_new_header(const int arg_dims[], int arg_dtype) + const int * dim; /* either passed or default dims */ + int dtype; /* either passed or default dtype */ + int c, nbyper, swapsize; +- ++ + /* if arg_dims is passed, apply it */ + if( arg_dims ) dim = arg_dims; + else dim = default_dims; +@@ -5326,16 +5343,16 @@ nifti_1_header * nifti_make_new_header(const int arg_dims[], int arg_dtype) + fprintf(stderr,"** nifti_make_new_header: failed to alloc hdr\n"); + return NULL; + } +- ++ + nhdr->sizeof_hdr = sizeof(nifti_1_header) ; + nhdr->regular = 'r' ; /* for some stupid reason */ + + /* init dim and pixdim */ + nhdr->dim[0] = dim[0] ; +- nhdr->pixdim[0] = 0.0; ++ nhdr->pixdim[0] = 0.0f; + for( c = 1; c <= dim[0]; c++ ) { + nhdr->dim[c] = dim[c]; +- nhdr->pixdim[c] = 1.0; ++ nhdr->pixdim[c] = 1.0f; + } + + nhdr->datatype = dtype ; +@@ -5353,7 +5370,7 @@ nifti_1_header * nifti_make_new_header(const int arg_dims[], int arg_dtype) + + Create a nifti_image from the given dimensions and data type. + Optinally, allocate zero-filled data. +- ++ + \param dims : optional dim[8] (default {3,1,1,1,0,0,0,0}) + \param datatype : optional datatype (default DT_FLOAT32) + \param data_fill : if flag is set, allocate zero-filled data for image +@@ -5421,7 +5438,7 @@ struct nifti_1_header nifti_convert_nim2nhdr(const nifti_image * nim) + nhdr.dim[4] = nim->nt ; nhdr.dim[5] = nim->nu ; nhdr.dim[6] = nim->nv ; + nhdr.dim[7] = nim->nw ; + +- nhdr.pixdim[0] = 0.0 ; ++ nhdr.pixdim[0] = 0.0f ; + nhdr.pixdim[1] = nim->dx ; nhdr.pixdim[2] = nim->dy ; + nhdr.pixdim[3] = nim->dz ; nhdr.pixdim[4] = nim->dt ; + nhdr.pixdim[5] = nim->du ; nhdr.pixdim[6] = nim->dv ; +@@ -5454,10 +5471,10 @@ struct nifti_1_header nifti_convert_nim2nhdr(const nifti_image * nim) + if( nim->nifti_type == NIFTI_FTYPE_NIFTI1_1 ) strcpy(nhdr.magic,"n+1") ; + else strcpy(nhdr.magic,"ni1") ; + +- nhdr.pixdim[1] = fabs(nhdr.pixdim[1]) ; nhdr.pixdim[2] = fabs(nhdr.pixdim[2]) ; +- nhdr.pixdim[3] = fabs(nhdr.pixdim[3]) ; nhdr.pixdim[4] = fabs(nhdr.pixdim[4]) ; +- nhdr.pixdim[5] = fabs(nhdr.pixdim[5]) ; nhdr.pixdim[6] = fabs(nhdr.pixdim[6]) ; +- nhdr.pixdim[7] = fabs(nhdr.pixdim[7]) ; ++ nhdr.pixdim[1] = (float)fabs(nhdr.pixdim[1]) ; nhdr.pixdim[2] = (float)fabs(nhdr.pixdim[2]) ; ++ nhdr.pixdim[3] = (float)fabs(nhdr.pixdim[3]) ; nhdr.pixdim[4] = (float)fabs(nhdr.pixdim[4]) ; ++ nhdr.pixdim[5] = (float)fabs(nhdr.pixdim[5]) ; nhdr.pixdim[6] = (float)fabs(nhdr.pixdim[6]) ; ++ nhdr.pixdim[7] = (float)fabs(nhdr.pixdim[7]) ; + + nhdr.intent_code = nim->intent_code ; + nhdr.intent_p1 = nim->intent_p1 ; +@@ -5480,7 +5497,7 @@ struct nifti_1_header nifti_convert_nim2nhdr(const nifti_image * nim) + nhdr.qoffset_x = nim->qoffset_x ; + nhdr.qoffset_y = nim->qoffset_y ; + nhdr.qoffset_z = nim->qoffset_z ; +- nhdr.pixdim[0] = (nim->qfac >= 0.0) ? 1.0 : -1.0 ; ++ nhdr.pixdim[0] = (nim->qfac >= 0.0) ? 1.0f : -1.0f ; + } + + if( nim->sform_code > 0 ){ +@@ -5654,7 +5671,7 @@ void nifti_set_iname_offset(nifti_image *nim) + \sa nifti_image_write, nifti_image_write_hdr_img2, nifti_image_free, + nifti_set_filenames + *//*--------------------------------------------------------------------*/ +-znzFile nifti_image_write_hdr_img( nifti_image *nim , int write_data , ++znzFile nifti_image_write_hdr_img( nifti_image *nim , int write_data , + const char* opts ) + { + return nifti_image_write_hdr_img2(nim,write_data,opts,NULL,NULL); +@@ -5673,7 +5690,7 @@ znzFile nifti_image_write_hdr_img( nifti_image *nim , int write_data , + * If the image data file is left open it returns a valid znzFile handle. + * It also uses imgfile as the open image file is not null, and modifies + * it inside. +- * ++ * + * \param nim nifti_image to write to disk + * \param write_opts flags whether to write data and/or close file (see below) + * \param opts file-open options, probably "wb" from nifti_image_write() +@@ -5681,18 +5698,18 @@ znzFile nifti_image_write_hdr_img( nifti_image *nim , int write_data , + (may be NULL) + * \param NBL optional nifti_brick_list, containing the image data + (may be NULL) +- * ++ * + * Values for write_opts mode are based on two binary flags + * ( 0/1 for no-write/write data, and 0/2 for close/leave-open files ) : + * - 0 = do not write data and close (do not open data file) + * - 1 = write data and close +- * - 2 = do not write data and leave data file open +- * - 3 = write data and leave data file open ++ * - 2 = do not write data and leave data file open ++ * - 3 = write data and leave data file open + * + * \sa nifti_image_write, nifti_image_write_hdr_img, nifti_image_free, + * nifti_set_filenames + *//*---------------------------------------------------------------------*/ +-znzFile nifti_image_write_hdr_img2(nifti_image *nim, int write_opts, ++znzFile nifti_image_write_hdr_img2(nifti_image *nim, int write_opts, + const char * opts, znzFile imgfile, const nifti_brick_list * NBL) + { + struct nifti_1_header nhdr ; +@@ -5732,7 +5749,7 @@ znzFile nifti_image_write_hdr_img2(nifti_image *nim, int write_opts, + } + if( nim->iname == NULL ){ /* then make a new one */ + nim->iname = nifti_makeimgname(nim->fname,nim->nifti_type,0,0); +- if( nim->iname == NULL ) return NULL; ++ if( nim->iname == NULL ) return NULL; + } + } + +@@ -5800,20 +5817,20 @@ znzFile nifti_write_ascii_image(nifti_image *nim, const nifti_brick_list * NBL, + { + znzFile fp; + char * hstr; +- ++ + hstr = nifti_image_to_ascii( nim ) ; /* get header in ASCII form */ + if( ! hstr ){ fprintf(stderr,"** failed image_to_ascii()\n"); return NULL; } +- ++ + fp = znzopen( nim->fname , opts , nifti_is_gzfile(nim->fname) ) ; + if( znz_isnull(fp) ){ + free(hstr); + fprintf(stderr,"** failed to open '%s' for ascii write\n",nim->fname); + return fp; + } +- ++ + znzputs(hstr,fp); /* header */ + nifti_write_extensions(fp,nim); /* extensions */ +- ++ + if ( write_data ) { nifti_write_all_data(fp,nim,NBL); } /* data */ + if ( ! leave_open ) { znzclose(fp); } + free(hstr); +@@ -5969,7 +5986,7 @@ static int unescape_string( char *str ) + + else if( ii+3 < ll && + str[ii+1] == '#' && +- isdigit(str[ii+2]) ){ /* &#dec; */ ++ isdigit((int) str[ii+2]) ){ /* &#dec; */ + + unsigned int val='?' ; int kk=ii+3 ; + while( kk < ll && kk != ';' ) kk++ ; +@@ -5980,7 +5997,7 @@ static int unescape_string( char *str ) + else if( ii+4 < ll && + str[ii+1] == '#' && + str[ii+2] == 'x' && +- isxdigit(str[ii+3]) ){ /* &#hex; */ ++ isxdigit((int) str[ii+3]) ){ /* &#hex; */ + + unsigned int val='?' ; int kk=ii+4 ; + while( kk < ll && kk != ';' ) kk++ ; +@@ -6337,11 +6354,11 @@ int nifti_short_order(void) /* determine this CPU's byte order */ + /* macro to check lhs string against "n1"; if it matches, + interpret rhs string as a number, and put it into nim->"n2" */ + +-#define QQNUM(n1,n2) if( strcmp(lhs,#n1)==0 ) nim->n2=strtod(rhs,NULL) ++#define QQNUM(n1,n2,tt) if( strcmp(lhs,#n1)==0 ) nim->n2=(tt)strtod(rhs,NULL) + + /* same, but where "n1" == "n2" */ + +-#define QNUM(nam) QQNUM(nam,nam) ++#define QNUM(nam,tt) QQNUM(nam,nam,tt) + + /* macro to check lhs string against "nam"; if it matches, + put rhs string into nim->"nam" string, with max length = "ml" */ +@@ -6384,7 +6401,7 @@ nifti_image *nifti_image_from_ascii( const char *str, int * bytes_read ) + = nim->nu = nim->nv = nim->nw = 1 ; + nim->dx = nim->dy = nim->dz = nim->dt + = nim->du = nim->dv = nim->dw = 0 ; +- nim->qfac = 1.0 ; ++ nim->qfac = 1.0f ; + + nim->byteorder = nifti_short_order() ; + +@@ -6456,54 +6473,54 @@ nifti_image *nifti_image_from_ascii( const char *str, int * bytes_read ) + if( strcmp(rhs,"MSB_FIRST") == 0 ) nim->byteorder = MSB_FIRST ; + if( strcmp(rhs,"LSB_FIRST") == 0 ) nim->byteorder = LSB_FIRST ; + } +- else QQNUM(image_offset,iname_offset) ; +- else QNUM(datatype) ; +- else QNUM(ndim) ; +- else QNUM(nx) ; +- else QNUM(ny) ; +- else QNUM(nz) ; +- else QNUM(nt) ; +- else QNUM(nu) ; +- else QNUM(nv) ; +- else QNUM(nw) ; +- else QNUM(dx) ; +- else QNUM(dy) ; +- else QNUM(dz) ; +- else QNUM(dt) ; +- else QNUM(du) ; +- else QNUM(dv) ; +- else QNUM(dw) ; +- else QNUM(cal_min) ; +- else QNUM(cal_max) ; +- else QNUM(scl_slope) ; +- else QNUM(scl_inter) ; +- else QNUM(intent_code) ; +- else QNUM(intent_p1) ; +- else QNUM(intent_p2) ; +- else QNUM(intent_p3) ; ++ else QQNUM(image_offset,iname_offset,int) ; ++ else QNUM(datatype,short int) ; ++ else QNUM(ndim,int) ; ++ else QNUM(nx,int) ; ++ else QNUM(ny,int) ; ++ else QNUM(nz,int) ; ++ else QNUM(nt,int) ; ++ else QNUM(nu,int) ; ++ else QNUM(nv,int) ; ++ else QNUM(nw,int) ; ++ else QNUM(dx,float) ; ++ else QNUM(dy,float) ; ++ else QNUM(dz,float) ; ++ else QNUM(dt,float) ; ++ else QNUM(du,float) ; ++ else QNUM(dv,float) ; ++ else QNUM(dw,float) ; ++ else QNUM(cal_min,float) ; ++ else QNUM(cal_max,float) ; ++ else QNUM(scl_slope,float) ; ++ else QNUM(scl_inter,float) ; ++ else QNUM(intent_code,short) ; ++ else QNUM(intent_p1,float) ; ++ else QNUM(intent_p2,float) ; ++ else QNUM(intent_p3,float) ; + else QSTR(intent_name,15) ; +- else QNUM(toffset) ; +- else QNUM(xyz_units) ; +- else QNUM(time_units) ; ++ else QNUM(toffset,float) ; ++ else QNUM(xyz_units,int) ; ++ else QNUM(time_units,int) ; + else QSTR(descrip,79) ; + else QSTR(aux_file,23) ; +- else QNUM(qform_code) ; +- else QNUM(quatern_b) ; +- else QNUM(quatern_c) ; +- else QNUM(quatern_d) ; +- else QNUM(qoffset_x) ; +- else QNUM(qoffset_y) ; +- else QNUM(qoffset_z) ; +- else QNUM(qfac) ; +- else QNUM(sform_code) ; +- else QNUM(freq_dim) ; +- else QNUM(phase_dim) ; +- else QNUM(slice_dim) ; +- else QNUM(slice_code) ; +- else QNUM(slice_start) ; +- else QNUM(slice_end) ; +- else QNUM(slice_duration) ; +- else QNUM(num_ext) ; ++ else QNUM(qform_code,int) ; ++ else QNUM(quatern_b,float) ; ++ else QNUM(quatern_c,float) ; ++ else QNUM(quatern_d,float) ; ++ else QNUM(qoffset_x,float) ; ++ else QNUM(qoffset_y,float) ; ++ else QNUM(qoffset_z,float) ; ++ else QNUM(qfac,float) ; ++ else QNUM(sform_code,int) ; ++ else QNUM(freq_dim,int) ; ++ else QNUM(phase_dim,int) ; ++ else QNUM(slice_dim,int) ; ++ else QNUM(slice_code,int) ; ++ else QNUM(slice_start,int) ; ++ else QNUM(slice_end,int) ; ++ else QNUM(slice_duration,float) ; ++ else QNUM(num_ext,int) ; + + } /* end of while loop */ + +@@ -6536,8 +6553,8 @@ nifti_image *nifti_image_from_ascii( const char *str, int * bytes_read ) + nim->qfac ) ; + else + nim->qto_xyz = nifti_quatern_to_mat44( +- 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , +- nim->dx , nim->dy , nim->dz , 0.0 ) ; ++ 0.0f , 0.0f , 0.0f , 0.0f , 0.0f , 0.0f , ++ nim->dx , nim->dy , nim->dz , 0.0f ) ; + + + nim->qto_ijk = nifti_mat44_inverse( nim->qto_xyz ) ; +@@ -6749,7 +6766,7 @@ int nifti_read_collapsed_image( nifti_image * nim, const int dims [8], + /** - check pointers for sanity */ + if( !nim || !dims || !data ){ + fprintf(stderr,"** nifti_RCI: bad params %p, %p, %p\n", +- (void *)nim, (void *)dims, (void *)data); ++ (void *)nim, (const void *)dims, (void *)data); + return -1; + } + +@@ -6897,7 +6914,7 @@ int nifti_read_subregion_image( nifti_image * nim, + } + } + +- /* if you get through all the dimensions without hitting ++ /* if you get through all the dimensions without hitting + ** a subrange of size > 1, a collapsed read is possible + */ + if(i > nim->ndim) +@@ -6926,7 +6943,7 @@ int nifti_read_subregion_image( nifti_image * nim, + /* the current offset is just past the nifti header, save + * location so that SEEK_SET can be used below + */ +- initial_offset = znztell(fp); ++ initial_offset = znztell(fp); + /* get strides*/ + compute_strides(strides,image_size,nim->nbyper); + +@@ -7101,15 +7118,15 @@ static int rci_read_data(nifti_image * nim, int * pivots, int * prods, + */ + static int rci_alloc_mem(void ** data, int prods[8], int nprods, int nbyper ) + { +- int size, index; ++ int size, memindex; + + if( nbyper < 0 || nprods < 1 || nprods > 8 ){ + fprintf(stderr,"** rci_am: bad params, %d, %d\n", nbyper, nprods); + return -1; + } + +- for( index = 0, size = 1; index < nprods; index++ ) +- size *= prods[index]; ++ for( memindex = 0, size = 1; memindex < nprods; memindex++ ) ++ size *= prods[memindex]; + + size *= nbyper; + +@@ -7140,19 +7157,19 @@ static int rci_alloc_mem(void ** data, int prods[8], int nprods, int nbyper ) + static int make_pivot_list(nifti_image * nim, const int dims[], int pivots[], + int prods[], int * nprods ) + { +- int len, index; ++ int len, dim_index; + + len = 0; +- index = nim->dim[0]; +- while( index > 0 ){ ++ dim_index = nim->dim[0]; ++ while( dim_index > 0 ){ + prods[len] = 1; +- while( index > 0 && (nim->dim[index] == 1 || dims[index] == -1) ){ +- prods[len] *= nim->dim[index]; +- index--; ++ while( dim_index > 0 && (nim->dim[dim_index] == 1 || dims[dim_index] == -1) ){ ++ prods[len] *= nim->dim[dim_index]; ++ dim_index--; + } +- pivots[len] = index; ++ pivots[len] = dim_index; + len++; +- index--; /* fine, let it drop out at -1 */ ++ dim_index--; /* fine, let it drop out at -1 */ + } + + /* make sure to include 0 as a pivot (instead of just 1, if it is) */ +@@ -7166,9 +7183,9 @@ static int make_pivot_list(nifti_image * nim, const int dims[], int pivots[], + + if( g_opts.debug > 2 ){ + fprintf(stderr,"+d pivot list created, pivots :"); +- for(index = 0; index < len; index++) fprintf(stderr," %d", pivots[index]); ++ for(dim_index = 0; dim_index < len; dim_index++) fprintf(stderr," %d", pivots[dim_index]); + fprintf(stderr,", prods :"); +- for(index = 0; index < len; index++) fprintf(stderr," %d", prods[index]); ++ for(dim_index = 0; dim_index < len; dim_index++) fprintf(stderr," %d", prods[dim_index]); + fputc('\n',stderr); + } + +@@ -7397,7 +7414,7 @@ int nifti_datatype_from_string( const char * name ) + * corresponding macro label as a string. The dtype code is the + * macro value defined in nifti1.h. + *//*-------------------------------------------------------------------*/ +-char * nifti_datatype_to_string( int dtype ) ++const char * nifti_datatype_to_string( int dtype ) + { + int tablen = sizeof(nifti_type_list)/sizeof(nifti_type_ele); + int c; +@@ -7482,7 +7499,7 @@ int nifti_test_datatype_sizes(int verb) + *//*-------------------------------------------------------------------*/ + int nifti_disp_type_list( int which ) + { +- char * style; ++ const char * style; + int tablen = sizeof(nifti_type_list)/sizeof(nifti_type_ele); + int lwhich, c; + +diff --git a/niftilib/nifti1_io.h b/niftilib/nifti1_io.h +index 982a65e..1b24520 100644 +--- a/niftilib/nifti1_io.h ++++ b/niftilib/nifti1_io.h +@@ -39,9 +39,9 @@ extern "C" { + /***** incidental or otherwise, caused by any use of this document. *****/ + /*****===================================================================*****/ + +-/* ++/* + Modified by: Mark Jenkinson (FMRIB Centre, University of Oxford, UK) +- Date: July/August 2004 ++ Date: July/August 2004 + + Mainly adding low-level IO and changing things to allow gzipped files + to be read and written +@@ -244,12 +244,12 @@ typedef struct { + /*****************************************************************************/ + /*--------------- Prototypes of functions defined in this file --------------*/ + +-char *nifti_datatype_string ( int dt ) ; +-char *nifti_units_string ( int uu ) ; +-char *nifti_intent_string ( int ii ) ; +-char *nifti_xform_string ( int xx ) ; +-char *nifti_slice_string ( int ss ) ; +-char *nifti_orientation_string( int ii ) ; ++char const * nifti_datatype_string ( int dt ) ; ++char const *nifti_units_string ( int uu ) ; ++char const *nifti_intent_string ( int ii ) ; ++char const *nifti_xform_string ( int xx ) ; ++char const *nifti_slice_string ( int ss ) ; ++char const *nifti_orientation_string( int ii ) ; + + int nifti_is_inttype( int dt ) ; + +@@ -270,7 +270,7 @@ void nifti_swap_Nbytes ( size_t n , int siz , void *ar ) ; + + int nifti_datatype_is_valid (int dtype, int for_nifti); + int nifti_datatype_from_string(const char * name); +-char * nifti_datatype_to_string (int dtype); ++const char * nifti_datatype_to_string (int dtype); + + int nifti_get_filesize( const char *pathname ) ; + void swap_nifti_header ( struct nifti_1_header *h , int is_nifti ) ; +@@ -294,12 +294,12 @@ void nifti_image_free ( nifti_image *nim ) ; + int nifti_read_collapsed_image( nifti_image * nim, const int dims [8], + void ** data ); + +-int nifti_read_subregion_image( nifti_image * nim, ++int nifti_read_subregion_image( nifti_image * nim, + int *start_index, int *region_size, + void ** data ); + + void nifti_image_write ( nifti_image * nim ) ; +-void nifti_image_write_bricks(nifti_image * nim, ++void nifti_image_write_bricks(nifti_image * nim, + const nifti_brick_list * NBL); + void nifti_image_infodump( const nifti_image * nim ) ; + +@@ -435,7 +435,7 @@ int valid_nifti_extensions(const nifti_image *nim); + + #define NIFTI_ECODE_COMMENT 6 /* plain ASCII text only */ + +-#define NIFTI_ECODE_XCEDE 8 /* David B Keator: dbkeator@uci.edu ++#define NIFTI_ECODE_XCEDE 8 /* David B Keator: dbkeator@uci.edu + http://www.nbirn.net/Resources + /Users/Applications/ + /xcede/index.htm */ +@@ -493,7 +493,7 @@ typedef struct { + int type; /* should match the NIFTI_TYPE_ #define */ + int nbyper; /* bytes per value, matches nifti_image */ + int swapsize; /* bytes per swap piece, matches nifti_image */ +- char * name; /* text string to match #define */ ++ char const * const name; /* text string to match #define */ + } nifti_type_ele; + + #undef LNI_FERR /* local nifti file error, to be compact and repetative */ +diff --git a/packaging/nifticlib.spec b/packaging/nifticlib.spec +index 81f7197..1e16c29 100644 +--- a/packaging/nifticlib.spec ++++ b/packaging/nifticlib.spec +@@ -41,7 +41,7 @@ rm -rf $RPM_BUILD_ROOT + make install DESTDIR=$RPM_BUILD_ROOT + + ## hack to get this to work for x86_64 +-%if "%{?_lib}" == "lib64" ++%if "%{?_lib}" == "lib64" + mv $RPM_BUILD_ROOT/usr/lib $RPM_BUILD_ROOT/%{_libdir} + %endif + +diff --git a/real_easy/nifti1_read_write.c b/real_easy/nifti1_read_write.c +index d9c8897..f8a9acf 100644 +--- a/real_easy/nifti1_read_write.c ++++ b/real_easy/nifti1_read_write.c +@@ -32,11 +32,11 @@ + * + * 2. scaling + * nifti1 datasets can contain a scaling factor. You need to check the +- * scl_slope field and if that isn't 0, scale your data by ++ * scl_slope field and if that isn't 0, scale your data by + * Y * scl_slope + scl_inter + * + * 3. extensions +- * nifti1 datasets can have some "extension data" stuffed after the ++ * nifti1 datasets can have some "extension data" stuffed after the + * regular header. You can just ignore it, but, be aware that a + * .hdr file may be longer than 348 bytes, and, in a .nii file + * you can't just jump to byte 352, you need to use the vox_offset +@@ -64,15 +64,15 @@ + * You need to put a copy of the nifti1.h header file in this directory. + * It can be obtained from the NIFTI homepage http://nifti.nimh.nih.gov/ + * or from the niftilib SourceForge site http://niftilib.sourceforge.net/ +- * ++ * + * cc -o nifti1_read_write nifti1_read_write.c +- * +- * ++ * ++ * + * To run: + * nifti1_read_write -w abc.nii abc.nii + * nifti1_read_write -r abc.nii abc.nii +- * +- * ++ * ++ * + * The read method is hardcoded to read float32 data. To change + * to your datatype, just change the line: + * typedef float MY_DATATYPE; +@@ -100,7 +100,7 @@ typedef float MY_DATATYPE; + #define NII_HEADER_SIZE 352 + + +-main(argc,argv) ++main(argc,argv) + int argc; + char *argv[]; + { +@@ -228,7 +228,7 @@ return(0); + /********************************************************************** + * + * write_nifti_file +- * ++ * + * write a sample nifti1 (.nii) data file + * datatype is float32 + * XYZT size is 64x64x16x10 +@@ -265,7 +265,7 @@ else { + fprintf(stderr, "\nError: file(s) to be written must end with .hdr/.img or .nii/.nii extension\n"); + exit(1); + } +- ++ + + /********** fill in the minimal default header fields */ + bzero((void *)&hdr, sizeof(hdr)); +diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt +index d4e5e78..5fbb82d 100644 +--- a/utils/CMakeLists.txt ++++ b/utils/CMakeLists.txt +@@ -1,73 +1,69 @@ + #File Generated by Hans J. Johnson + #Please contact hans-johnson@uiowa.edu for making enhancments/corrections +-PROJECT(NIFTIUTILS) + +-INCLUDE_DIRECTORIES(${NIFTILIB_SOURCE_DIR} ${ZNZLIB_SOURCE_DIR} ${NIFTICDFLIB_SOURCE_DIR}) ++include_directories(${NIFTI_SOURCE_DIR}/niftilib ${NIFTI_SOURCE_DIR}/znzlib ${NIFTI_SOURCE_DIR}/nifticdf) + +-ADD_EXECUTABLE(${PACKAGE_PREFIX}nifti_stats nifti_stats.c) +-ADD_EXECUTABLE(${PACKAGE_PREFIX}nifti_tool nifti_tool.c) +-ADD_EXECUTABLE(${PACKAGE_PREFIX}nifti1_test nifti1_test.c) +-TARGET_LINK_LIBRARIES( nifti_stats ${PACKAGE_PREFIX}niftiio ${PACKAGE_PREFIX}nifticdf) +-TARGET_LINK_LIBRARIES( nifti_tool ${PACKAGE_PREFIX}niftiio) +-TARGET_LINK_LIBRARIES( nifti1_test ${PACKAGE_PREFIX}niftiio) ++add_executable(${PACKAGE_PREFIX}nifti_stats nifti_stats.c) ++add_executable(${PACKAGE_PREFIX}nifti_tool nifti_tool.c) ++add_executable(${PACKAGE_PREFIX}nifti1_test nifti1_test.c) ++target_link_libraries( nifti_stats ${PACKAGE_PREFIX}niftiio ${PACKAGE_PREFIX}nifticdf) ++target_link_libraries( nifti_tool ${PACKAGE_PREFIX}niftiio) ++target_link_libraries( nifti1_test ${PACKAGE_PREFIX}niftiio) + +-IF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) +- INSTALL(TARGETS ${PACKAGE_PREFIX}nifti_stats ${PACKAGE_PREFIX}nifti_tool ${PACKAGE_PREFIX}nifti1_test ++if(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++ install(TARGETS ${PACKAGE_PREFIX}nifti_stats ${PACKAGE_PREFIX}nifti_tool ${PACKAGE_PREFIX}nifti1_test + RUNTIME DESTINATION ${NIFTI_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++endif(NOT NIFTI_INSTALL_NO_DEVELOPMENT) + +-IF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) +- FILE(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +- INSTALL(FILES ${__files} ++if(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++ file(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") ++ install(FILES ${__files} + DESTINATION ${NIFTI_INSTALL_INCLUDE_DIR} COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++endif(NOT NIFTI_INSTALL_NO_DEVELOPMENT) + +-ADD_TEST(${PACKAGE_PREFIX}nifti1_test_help ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti1_test) +-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 ) +-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 ) +-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 ) +-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 ) +-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 ) +-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 ) ++add_test(${PACKAGE_PREFIX}nifti1_test_help ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti1_test) ++add_test(${PACKAGE_PREFIX}nifti1_test_n1 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti1_test -n1 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTI_BINARY_DIR}/utils/n1 ) ++add_test(${PACKAGE_PREFIX}nifti1_test_n2 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti1_test -n2 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTI_BINARY_DIR}/utils/n2 ) ++add_test(${PACKAGE_PREFIX}nifti1_test_a2 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti1_test -a2 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTI_BINARY_DIR}/utils/a2 ) ++add_test(${PACKAGE_PREFIX}nifti1_test_zn1 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti1_test -zn1 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTI_BINARY_DIR}/utils/zn1 ) ++add_test(${PACKAGE_PREFIX}nifti1_test_zn2 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti1_test -zn2 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTI_BINARY_DIR}/utils/zn2 ) ++add_test(${PACKAGE_PREFIX}nifti1_test_za2 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti1_test -za2 ${NIFTI_SOURCE_DIR}/Testing/Data/ATestReferenceImageForReadingAndWriting.nii.gz ${NIFTI_BINARY_DIR}/utils/za2 ) + +-#The help screens always return 1; ADD_TEST(${PACKAGE_PREFIX}nifti_tool_help ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool) +-ADD_TEST(${PACKAGE_PREFIX}nifti_tool_n1 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/n1 ) +-ADD_TEST(${PACKAGE_PREFIX}nifti_tool_n2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/n2 ) +-ADD_TEST(${PACKAGE_PREFIX}nifti_tool_a2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/a2 ) +-ADD_TEST(${PACKAGE_PREFIX}nifti_tool_zn1 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/zn1 ) +-ADD_TEST(${PACKAGE_PREFIX}nifti_tool_zn2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/zn2 ) +-ADD_TEST(${PACKAGE_PREFIX}nifti_tool_za2 ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTIUTILS_BINARY_DIR}/za2 ) +-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 ) +-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 ) ++#The help screens always return 1; add_test(${PACKAGE_PREFIX}nifti_tool_help ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool) ++add_test(${PACKAGE_PREFIX}nifti_tool_n1 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTI_BINARY_DIR}/utils/n1 ) ++add_test(${PACKAGE_PREFIX}nifti_tool_n2 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTI_BINARY_DIR}/utils/n2 ) ++add_test(${PACKAGE_PREFIX}nifti_tool_a2 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTI_BINARY_DIR}/utils/a2 ) ++add_test(${PACKAGE_PREFIX}nifti_tool_zn1 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTI_BINARY_DIR}/utils/zn1 ) ++add_test(${PACKAGE_PREFIX}nifti_tool_zn2 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTI_BINARY_DIR}/utils/zn2 ) ++add_test(${PACKAGE_PREFIX}nifti_tool_za2 ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -disp_hdr -infile ${NIFTI_BINARY_DIR}/utils/za2 ) ++add_test(${PACKAGE_PREFIX}nifti_tool_diff_hdr ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -diff_hdr -infile ${NIFTI_BINARY_DIR}/utils/zn1 ${NIFTI_BINARY_DIR}/utils/zn1 ) ++add_test(${PACKAGE_PREFIX}nifti_tool_diff_nims ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -diff_nim -infile ${NIFTI_BINARY_DIR}/utils/zn1 ${NIFTI_BINARY_DIR}/utils/zn1 ) + +-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]) +-#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 ) +-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 ) +-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 ) +-ADD_TEST(${PACKAGE_PREFIX}nifti_tool_strip_extras ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -strip_extras -infile ${NIFTIUTILS_BINARY_DIR}/zn1.nii.gz ) ++add_test(${PACKAGE_PREFIX}nifti_tool_copy_brick_list ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -cbl -prefix cbl_zn1.nii -infile ${NIFTI_BINARY_DIR}/utils/zn1.nii.gz[0,1]) ++#add_test(${PACKAGE_PREFIX}nifti_tool_copy_collapsed_image /bin/sh ${NIFTI_SOURCE_DIR}/utils/rmthenrun cci_zn1.nii ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -cci 2 2 2 -1 -1 -1 -1 -prefix cci_zn1.nii -infile ${NIFTI_BINARY_DIR}/utils/zn1.nii.gz ) ++add_test(${PACKAGE_PREFIX}nifti_tool_disp_ci ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -disp_ci 2 2 2 -1 0 0 0 -infile ${NIFTI_BINARY_DIR}/utils/zn1.nii.gz ) ++add_test(${PACKAGE_PREFIX}nifti_tool_disp_ts ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -disp_ts 2 2 2 -infile ${NIFTI_BINARY_DIR}/utils/zn1.nii.gz ) ++add_test(${PACKAGE_PREFIX}nifti_tool_strip_extras ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -strip_extras -infile ${NIFTI_BINARY_DIR}/utils/zn1.nii.gz ) + + # This test needs a file that has extensions to remove +-#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 ) +- +-ADD_TEST(${PACKAGE_PREFIX}nifti_tool_check_hdr ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -check_hdr -infile ${NIFTIUTILS_BINARY_DIR}/za2 ) +-ADD_TEST(${PACKAGE_PREFIX}nifti_tool_check_nim ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_tool -check_nim -infile ${NIFTIUTILS_BINARY_DIR}/za2 ) +- +-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 ) +- ADD_TEST(${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats 0:4:1 ${DISTRIBUTION}) +- ADD_TEST(q${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -q 0:4:1 ${DISTRIBUTION}) +- ADD_TEST(q1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -q 0:4:1 ${DISTRIBUTION} 1 1 1) +- ADD_TEST(d${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -d 0:4:1 ${DISTRIBUTION}) +- ADD_TEST(d1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -d 0:4:1 ${DISTRIBUTION} 1 1 1) +- ADD_TEST(1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -1 0:4:1 ${DISTRIBUTION}) +- ADD_TEST(11${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -1 0:4:1 ${DISTRIBUTION} 1 1 1) +- ADD_TEST(z${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -z 0:4:1 ${DISTRIBUTION}) +- ADD_TEST(z1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -z 0:4:1 ${DISTRIBUTION} 1 1 1) +- ADD_TEST(h${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -h 0:4:1 ${DISTRIBUTION}) +- ADD_TEST(h1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTIUTILS_BINARY_DIR}/${PACKAGE_PREFIX}nifti_stats -h 0:4:1 ${DISTRIBUTION} 1 1 1) +-ENDFOREACH(DISTRIBUTION) +- ++#add_test(${PACKAGE_PREFIX}nifti_tool_rm_ext /bin/sh ${NIFTI_SOURCE_DIR}/utils/rmthenrun rm_ext.nii ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -rm_ext ALL -prefix rm_ext.nii -infile ${NIFTI_BINARY_DIR}/utils/zn1.nii.gz ) + ++add_test(${PACKAGE_PREFIX}nifti_tool_check_hdr ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -check_hdr -infile ${NIFTI_BINARY_DIR}/utils/za2 ) ++add_test(${PACKAGE_PREFIX}nifti_tool_check_nim ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_tool -check_nim -infile ${NIFTI_BINARY_DIR}/utils/za2 ) + ++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 ) ++ add_test(${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats 0:4:1 ${DISTRIBUTION}) ++ add_test(q${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -q 0:4:1 ${DISTRIBUTION}) ++ add_test(q1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -q 0:4:1 ${DISTRIBUTION} 1 1 1) ++ add_test(d${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -d 0:4:1 ${DISTRIBUTION}) ++ add_test(d1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -d 0:4:1 ${DISTRIBUTION} 1 1 1) ++ add_test(1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -1 0:4:1 ${DISTRIBUTION}) ++ add_test(11${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -1 0:4:1 ${DISTRIBUTION} 1 1 1) ++ add_test(z${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -z 0:4:1 ${DISTRIBUTION}) ++ add_test(z1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -z 0:4:1 ${DISTRIBUTION} 1 1 1) ++ add_test(h${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -h 0:4:1 ${DISTRIBUTION}) ++ add_test(h1${PACKAGE_PREFIX}nifti_stats_${DISTRIBUTION}_test ${NIFTI_BINARY_DIR}/utils/${PACKAGE_PREFIX}nifti_stats -h 0:4:1 ${DISTRIBUTION} 1 1 1) ++endforeach(DISTRIBUTION) + +diff --git a/utils/nifti1_test.c b/utils/nifti1_test.c +index 4e1c356..5b76354 100644 +--- a/utils/nifti1_test.c ++++ b/utils/nifti1_test.c +@@ -11,7 +11,7 @@ int main( int argc , char *argv[] ) + nifti_image *nim ; + int iarg=1 , outmode=1 , ll , argn=1, usegzip=0; + char *tmpstr; +- ++ + if( argc < 2 || strcmp(argv[1],"-help") == 0 ){ + printf("Usage: nifti1_test [-n2|-n1|-na|-a2] infile [prefix]\n" + "\n" +diff --git a/utils/nifti_tool.c b/utils/nifti_tool.c +index 6d35596..d8a1574 100644 +--- a/utils/nifti_tool.c ++++ b/utils/nifti_tool.c +@@ -7,7 +7,7 @@ + * usage: nifti_tool [options] -infiles files... + * + * Via this tool, one should be able to: +- * ++ * + * - copy a set of volumes (sub-bricks) from one dataset to another + * - copy a dataset, restricting some dimensions to given indices + * +@@ -25,7 +25,7 @@ + * + * - modify any field(s) of a nifti_image + * - modify any field(s) of a nifti1_struct +- * ++ * + * usage forms: + * + * nifti_tool -help +@@ -51,14 +51,14 @@ + * + * nifti_tool -diff_hdr [-field fieldname] [...] -infiles f1 f2 + * nifti_tool -diff_nim [-field fieldname] [...] -infiles f1 f2 +- * ++ * + * nifti_tool -add_afni_ext "extension in quotes" -infiles f1 ... + * nifti_tool -add_comment_ext "extension in quotes" -infiles f1 ... + * nifti_tool -rm_ext ext_index -infiles f1 ... +- * ++ * + * nifti_tool -mod_hdr [-mod_field fieldname new_val] [...] -infiles f1 ... + * nifti_tool -mod_nim [-mod_field fieldname new_val] [...] -infiles f1 ... +- * ++ * + * */ + /*-------------------------------------------------------------------------*/ + +@@ -107,7 +107,7 @@ static char * g_history[] = + " - added -disp_ts: 'disp time series' data display functionality\n" + " - moved raw data display to disp_raw_data()\n" + "\n", +- "1.7 14 April 2005 [rickr] - added data display functionality\n" ++ "1.7 14 April 2005 [rickr] - added data display functionality\n" + " - added -dci: 'display collapsed image' functionality\n" + " - modified -dts to use -dci\n" + " - modified and updated the help in use_full()\n" +@@ -368,8 +368,8 @@ int process_opts( int argc, char * argv[], nt_opts * opts ) + opts->disp_nim = 1; + else if( ! strncmp(argv[ac], "-disp_ana", 8) ) + opts->disp_ana = 1; +- else if( ! strncmp(argv[ac], "-dci_lines", 6) || /* before -dts */ +- ! strncmp(argv[ac], "-dts_lines", 6) ) ++ else if( ! strncmp(argv[ac], "-dci_lines", 6) || /* before -dts */ ++ ! strncmp(argv[ac], "-dts_lines", 6) ) + { + opts->dci_lines = 1; + } +@@ -2306,7 +2306,7 @@ int act_check_hdrs( nt_opts * opts ) + { + nim = nifti_convert_nhdr2nim(*nhdr, opts->infiles.list[filenum]); + if( !nim ) continue; /* errors are printed from library */ +- ++ + if( g_debug > 1 ) + fprintf(stdout,"\nchecking nifti_image for file '%s'\n", + opts->infiles.list[filenum]); +@@ -2489,7 +2489,7 @@ int act_disp_nims( nt_opts * opts ) + { + nim = nt_image_read(opts, opts->infiles.list[filenum], 0); + if( !nim ) return 1; /* errors are printed from library */ +- ++ + if( g_debug > 0 ) + fprintf(stdout,"\nheader file '%s', num_fields = %d, fields:\n\n", + nim->fname, nfields); +@@ -2529,7 +2529,7 @@ int act_mod_hdrs( nt_opts * opts ) + int filec, swap; + char * fname, * dupname; + char func[] = { "act_mod_hdrs" }; +- ++ + if( g_debug > 2 ) + fprintf(stderr,"-d modifying %d fields for %d nifti headers...\n", + opts->flist.len, opts->infiles.len); +@@ -2618,7 +2618,7 @@ int act_swap_hdrs( nt_opts * opts ) + int filec, swap; + char * fname, * dupname; + char func[] = { "act_mod_hdrs" }; +- ++ + /* count requested operations: "there can be only one", and not Sean */ + swap = opts->swap_hdr + opts->swap_ana + opts->swap_old; + if( swap > 1 ) { +@@ -2725,7 +2725,7 @@ int act_mod_nims( nt_opts * opts ) + nifti_image * nim; /* for reading/writing entire datasets */ + int filec; + char func[] = { "act_mod_nims" }; +- ++ + if( g_debug > 2 ) + fprintf(stderr,"-d modifying %d fields for %d nifti images...\n", + opts->flist.len, opts->infiles.len); +@@ -3293,7 +3293,7 @@ int fill_field( field_s * fp, int type, int offset, int num, char * name ) + fp->offset = offset; + fp->size = 1; /* init before check */ + fp->len = num; +- ++ + strncpy(fp->name, name, NT_FIELD_NAME_LEN-1); + + switch( type ){ +@@ -3406,7 +3406,7 @@ int disp_field(char *mesg, field_s *fieldp, void * str, int nfields, int header) + case DT_FLOAT32: case DT_FLOAT64: + disp_raw_data((char *)str+fp->offset, fp->type, fp->len, ' ', 1); + break; +- ++ + case NT_DT_POINTER: + fprintf(stdout,"(raw data of unknown type)\n"); + break; +@@ -3487,12 +3487,12 @@ int diff_field(field_s *fieldp, void * str0, void * str1, int nfields) + if( *cp0 != *cp1 ) break; + + if(c < size) return 1; /* found a diff */ +- ++ + break; + + case NT_DT_POINTER: /* let's pass on these - no diff */ + case NT_DT_CHAR_PTR: +- ++ + break; + + case NT_DT_EXT_PTR: +@@ -3735,7 +3735,7 @@ int act_disp_ci( nt_opts * opts ) + nim->fname); + err++; + } +- ++ + switch( nim->datatype ) + { + case DT_INT8: case DT_INT16: case DT_INT32: +@@ -3753,7 +3753,7 @@ int act_disp_ci( nt_opts * opts ) + } + + if( err ) { nifti_image_free(nim); continue; } +- ++ + len = nifti_read_collapsed_image(nim, opts->ci_dims, &data); + if( len < 0 || !data ) + { +@@ -3919,7 +3919,7 @@ int act_cbl( nt_opts * opts ) + + nim = nt_image_read(opts, fname, 0); /* get image */ + if( !nim ) return 1; +- ++ + /* since nt can be zero now (sigh), check for it 02 Mar 2006 [rickr] */ + blist = nifti_get_intlist(nim->nt > 0 ? num_volumes(nim) : 1, selstr); + nifti_image_free(nim); /* throw away, will re-load */ +@@ -3985,7 +3985,7 @@ int act_cci( nt_opts * opts ) + nim = nt_image_read(opts, opts->infiles.list[0], 0); + if( !nim ) return 1; + nim->data = NULL; /* just to be sure */ +- ++ + if( nifti_read_collapsed_image(nim, opts->ci_dims, &nim->data) < 0 ) + { + nifti_image_free(nim); +diff --git a/znzlib/CMakeLists.txt b/znzlib/CMakeLists.txt +index ae24f60..21ce984 100644 +--- a/znzlib/CMakeLists.txt ++++ b/znzlib/CMakeLists.txt +@@ -1,31 +1,30 @@ + #File Generated by Hans J. Johnson + #Please contact hans-johnson@uiowa.edu for making enhancments/corrections +-PROJECT(ZNZLIB) +-SET(ZNZLIB_SRC znzlib.c) +-INCLUDE_REGULAR_EXPRESSION("^.*$") ++set(ZNZLIB_SRC znzlib.c) ++include_regular_expression("^.*$") + +-SET(NIFTI_ZNZLIB_NAME ${PACKAGE_PREFIX}znz) ++set(NIFTI_ZNZLIB_NAME ${PACKAGE_PREFIX}znz) + +-ADD_LIBRARY(${NIFTI_ZNZLIB_NAME} ${ZNZLIB_SRC} ) +-TARGET_LINK_LIBRARIES( ${NIFTI_ZNZLIB_NAME} ${NIFTI_ZLIB_LIBRARIES} ) ++add_library(${NIFTI_ZNZLIB_NAME} ${ZNZLIB_SRC} ) ++target_link_libraries( ${NIFTI_ZNZLIB_NAME} ${NIFTI_ZLIB_LIBRARIES} ) + + # Set library version if building shared libs. +-IF (BUILD_SHARED_LIBS) +- SET_TARGET_PROPERTIES(${NIFTI_ZNZLIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) +-ENDIF (BUILD_SHARED_LIBS) ++if(BUILD_SHARED_LIBS) ++ set_target_properties(${NIFTI_ZNZLIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) ++endif(BUILD_SHARED_LIBS) + + +-IF(NOT NIFTI_INSTALL_NO_LIBRARIES) +- INSTALL(TARGETS ${NIFTI_ZNZLIB_NAME} ++if(NOT NIFTI_INSTALL_NO_LIBRARIES) ++ install(TARGETS ${NIFTI_ZNZLIB_NAME} + RUNTIME DESTINATION ${NIFTI_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${NIFTI_INSTALL_LIB_DIR} COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_LIBRARIES) ++endif(NOT NIFTI_INSTALL_NO_LIBRARIES) + +-IF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) +- FILE(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +- INSTALL(FILES ${__files} ++if(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++ file(GLOB __files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") ++ install(FILES ${__files} + DESTINATION ${NIFTI_INSTALL_INCLUDE_DIR} + COMPONENT Development) +-ENDIF(NOT NIFTI_INSTALL_NO_DEVELOPMENT) ++endif(NOT NIFTI_INSTALL_NO_DEVELOPMENT) + +diff --git a/znzlib/znzlib.c b/znzlib/znzlib.c +index 7364568..9743ba0 100644 +--- a/znzlib/znzlib.c ++++ b/znzlib/znzlib.c +@@ -16,7 +16,7 @@ are required: + that specifies whether to use compression (1) or not (0) + - use znz_isnull rather than any (pointer == NULL) comparisons in the code + for znzfile types (normally done after a return from znzopen) +- ++ + NB: seeks for writable files with compression are quite restricted + + */ +@@ -39,7 +39,7 @@ znzlib.c (zipped or non-zipped library) + */ + + +-/* Note extra argument (use_compression) where ++/* Note extra argument (use_compression) where + use_compression==0 is no compression + use_compression!=0 uses zlib (gzip) compression + */ +@@ -116,7 +116,7 @@ int Xznzclose(znzFile * file) + if ((*file)->zfptr!=NULL) { retval = gzclose((*file)->zfptr); } + #endif + if ((*file)->nzfptr!=NULL) { retval = fclose((*file)->nzfptr); } +- ++ + free(*file); + *file = NULL; + } +@@ -165,7 +165,7 @@ size_t znzread(void* buf, size_t size, size_t nmemb, znzFile file) + size_t znzwrite(const void* buf, size_t size, size_t nmemb, znzFile file) + { + size_t remain = size*nmemb; +- char * cbuf = (char *)buf; ++ const char * cbuf = (const char *)buf; + unsigned n2write; + int nwritten; + +@@ -174,7 +174,7 @@ size_t znzwrite(const void* buf, size_t size, size_t nmemb, znzFile file) + if (file->zfptr!=NULL) { + while( remain > 0 ) { + n2write = (remain < ZNZ_MAX_BLOCK_SIZE) ? remain : ZNZ_MAX_BLOCK_SIZE; +- nwritten = gzwrite(file->zfptr, (void *)cbuf, n2write); ++ nwritten = gzwrite(file->zfptr, (const void *)cbuf, n2write); + + /* gzread returns 0 on error, but in case that ever changes... */ + if( nwritten < 0 ) return nwritten; +@@ -309,7 +309,7 @@ int znzprintf(znzFile stream, const char *format, ...) + vsprintf(tmpstr,format,va); + retval=gzprintf(stream->zfptr,"%s",tmpstr); + free(tmpstr); +- } else ++ } else + #endif + { + retval=vfprintf(stream->nzfptr,format,va); +diff --git a/znzlib/znzlib.h b/znzlib/znzlib.h +index deeaaf1..fb10ed9 100644 +--- a/znzlib/znzlib.h ++++ b/znzlib/znzlib.h +@@ -20,7 +20,7 @@ znzlib.h (zipped or non-zipped library) + + This library provides an interface to both compressed (gzip/zlib) and + uncompressed (normal) file IO. The functions are written to have the +-same interface as the standard file IO functions. ++same interface as the standard file IO functions. + + To use this library instead of normal file IO, the following changes + are required: +@@ -30,7 +30,7 @@ are required: + - add a third parameter to all calls to znzopen (previously fopen) + that specifies whether to use compression (1) or not (0) + - use znz_isnull rather than any (pointer == NULL) comparisons in the code +- ++ + NB: seeks for writable files with compression are quite restricted + + */ +@@ -56,14 +56,13 @@ extern "C" { + + + #ifdef HAVE_ZLIB +-#if defined(ITKZLIB) ++#if defined(ITKZLIB) && !defined(ITK_USE_SYSTEM_ZLIB) + #include "itk_zlib.h" + #else + #include "zlib.h" + #endif + #endif + +- + struct znzptr { + int withz; + FILE* nzfptr; +@@ -81,7 +80,7 @@ typedef struct znzptr * znzFile; + #define znz_isnull(f) ((f) == NULL) + #define znzclose(f) Xznzclose(&(f)) + +-/* Note extra argument (use_compression) where ++/* Note extra argument (use_compression) where + use_compression==0 is no compression + use_compression!=0 uses zlib (gzip) compression + */ +-- +2.1.1 + diff -Nru nifticlib-2.0.0/debian/patches/0002-ITK-free-s-in-failure-cases.patch nifticlib-2.0.0/debian/patches/0002-ITK-free-s-in-failure-cases.patch --- nifticlib-2.0.0/debian/patches/0002-ITK-free-s-in-failure-cases.patch 1970-01-01 00:00:00.000000000 +0000 +++ nifticlib-2.0.0/debian/patches/0002-ITK-free-s-in-failure-cases.patch 2014-10-06 07:15:39.000000000 +0000 @@ -0,0 +1,100 @@ +From 8bab47d0a8b021eae16147f839b0fa9ebce5846e Mon Sep 17 00:00:00 2001 +From: rickr_314 +Date: Tue, 10 May 2011 13:36:36 +0000 +Subject: [PATCH 2/3] ITK: free's in failure cases + +--- + Updates.txt | 5 +++++ + fsliolib/fslio.c | 3 +++ + niftilib/nifti1_io.c | 14 +++++++++++--- + real_easy/nifti1_read_write.c | 2 +- + utils/nifti_tool.c | 1 + + 5 files changed, 21 insertions(+), 4 deletions(-) + +diff --git a/Updates.txt b/Updates.txt +index b61c91a..512026a 100644 +--- a/Updates.txt ++++ b/Updates.txt +@@ -106,3 +106,8 @@ Updated in version 2.0.0 July 20, 2010 + + ----------------------------------------------------------------- + Recent Updates ++ ++ - HJ Merged ITK and official nifti branch for code compatibility ++ across many compilers by removing compiler warnings ++ - HJ added a few free() calls in failure cases ++ +diff --git a/fsliolib/fslio.c b/fsliolib/fslio.c +index bc9afad..cc198f7 100644 +--- a/fsliolib/fslio.c ++++ b/fsliolib/fslio.c +@@ -2090,6 +2090,9 @@ FSLIO * FslReadHeader(char *fname) + /** read header information */ + fslio->niftiptr = nifti_image_read(hdrname, 0); + ++ if( imgname ) free(imgname); ++ if( hdrname ) free(hdrname); ++ + if (fslio->niftiptr == NULL) { + FSLIOERR("FslReadHeader: error reading header information"); + return(NULL); +diff --git a/niftilib/nifti1_io.c b/niftilib/nifti1_io.c +index 3d5b165..8a174bf 100644 +--- a/niftilib/nifti1_io.c ++++ b/niftilib/nifti1_io.c +@@ -3633,6 +3633,7 @@ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, + doswap = need_nhdr_swap(nhdr.dim[0], nhdr.sizeof_hdr); /* swap data flag */ + + if( doswap < 0 ){ ++ free(nim); + if( doswap == -1 ) ERREX("bad dim[0]") ; + ERREX("bad sizeof_hdr") ; /* else */ + } +@@ -3660,10 +3661,17 @@ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, + + if ( g_opts.debug > 2 ) disp_nifti_1_header("-d nhdr2nim : ", &nhdr); + +- if( nhdr.datatype == DT_BINARY || +- nhdr.datatype == DT_UNKNOWN ) ERREX("bad datatype") ; ++ if( nhdr.datatype == DT_BINARY || nhdr.datatype == DT_UNKNOWN ) ++ { ++ free(nim); ++ ERREX("bad datatype") ; ++ } + +- if( nhdr.dim[1] <= 0 ) ERREX("bad dim[1]") ; ++ if( nhdr.dim[1] <= 0 ) ++ { ++ free(nim); ++ ERREX("bad dim[1]") ; ++ } + + /* fix bad dim[] values in the defined dimension range */ + for( ii=2 ; ii <= nhdr.dim[0] ; ii++ ) +diff --git a/real_easy/nifti1_read_write.c b/real_easy/nifti1_read_write.c +index f8a9acf..af34778 100644 +--- a/real_easy/nifti1_read_write.c ++++ b/real_easy/nifti1_read_write.c +@@ -356,6 +356,6 @@ else { + } + + +- ++free(data); + return(0); + } +diff --git a/utils/nifti_tool.c b/utils/nifti_tool.c +index d8a1574..c68e02e 100644 +--- a/utils/nifti_tool.c ++++ b/utils/nifti_tool.c +@@ -2159,6 +2159,7 @@ int remove_ext_list( nifti_image * nim, char ** elist, int len ) + nim->ext_list = NULL; + } + ++ free(marks); + return 0; + } + +-- +2.1.1 + diff -Nru nifticlib-2.0.0/debian/patches/0003-originator-as-shorts.patch nifticlib-2.0.0/debian/patches/0003-originator-as-shorts.patch --- nifticlib-2.0.0/debian/patches/0003-originator-as-shorts.patch 1970-01-01 00:00:00.000000000 +0000 +++ nifticlib-2.0.0/debian/patches/0003-originator-as-shorts.patch 2014-10-06 07:15:39.000000000 +0000 @@ -0,0 +1,56 @@ +From 6ee0e3cbfc198452a4fa8fb848e269c634f210a9 Mon Sep 17 00:00:00 2001 +From: rickr_314 +Date: Mon, 22 Jul 2013 12:59:23 +0000 +Subject: [PATCH 3/3] originator as shorts + +--- + niftilib/nifti1_io.c | 3 ++- + utils/nifti_tool.c | 7 +++++-- + 2 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/niftilib/nifti1_io.c b/niftilib/nifti1_io.c +index 8a174bf..ac8305e 100644 +--- a/niftilib/nifti1_io.c ++++ b/niftilib/nifti1_io.c +@@ -336,9 +336,10 @@ static char const * const gni_history[] = + " - fixed znzread/write, noting example by M Adler\n" + " - changed nifti_swap_* routines/calls to take size_t (6)\n" + "1.43 07 Jul 2010 [rickr]: fixed znzR/W to again return nmembers\n", ++ "1.44 19 Jul 2013 [rickr]: ITK compatibility updates from H Johnson\n", + "----------------------------------------------------------------------\n" + }; +-static const char gni_version[] = "nifti library version 1.39 (23 June, 2009)"; ++static const char gni_version[] = "nifti library version 1.44 (19 July, 2013)"; + + /*! global nifti options structure - init with defaults */ + static nifti_global_options g_opts = { +diff --git a/utils/nifti_tool.c b/utils/nifti_tool.c +index c68e02e..9635e4a 100644 +--- a/utils/nifti_tool.c ++++ b/utils/nifti_tool.c +@@ -155,9 +155,11 @@ static char * g_history[] = + "1.22 08 Oct 2008 [rickr] - allow cbl with indices in 0..nt*nu*nv*nw-1\n" + "1.23 06 Jul 2010 [rickr]\n", + " - in nt_read_bricks, bsize computation should allow for large integers\n" ++ "1.24 26 Sep 2012 [rickr]\n", ++ " - changed ana originator from char to short\n" + "----------------------------------------------------------------------\n" + }; +-static char g_version[] = "version 1.23 (July 6, 2010)"; ++static char g_version[] = "version 1.24 (September 26, 2012)"; + static int g_debug = 1; + + #define _NIFTI_TOOL_C_ +@@ -3211,7 +3213,8 @@ int fill_ana_field_array( field_s * ah_fields ) + NT_SFILL(nhdr, ahf, NT_DT_STRING, aux_file, 24, rv); errs += rv; + + NT_SFILL(nhdr, ahf, DT_INT8, orient, 1, rv); errs += rv; +- NT_SFILL(nhdr, ahf, NT_DT_STRING, originator, 10, rv); errs += rv; ++ /* originator is 5 (3) shorts, not 10 chars 26 Sep 2012 [rickr] */ ++ NT_SFILL(nhdr, ahf, DT_INT16, originator, 5, rv); errs += rv; + NT_SFILL(nhdr, ahf, NT_DT_STRING, generated, 10, rv); errs += rv; + NT_SFILL(nhdr, ahf, NT_DT_STRING, scannum, 10, rv); errs += rv; + NT_SFILL(nhdr, ahf, NT_DT_STRING, patient_id, 10, rv); errs += rv; +-- +2.1.1 + diff -Nru nifticlib-2.0.0/debian/patches/build_setup nifticlib-2.0.0/debian/patches/build_setup --- nifticlib-2.0.0/debian/patches/build_setup 2010-07-20 19:07:49.000000000 +0000 +++ nifticlib-2.0.0/debian/patches/build_setup 2014-10-06 07:26:31.000000000 +0000 @@ -1,51 +1,35 @@ --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -3,5 +3,5 @@ - PROJECT(TESTING) - SUBDIRS(niftilib) --SUBDIRS(nifti_regress_test) -+#SUBDIRS(nifti_regress_test) + include_directories(${NIFTI_SOURCE_DIR}/niftilib ${NIFTI_SOURCE_DIR}/znzlib ${NIFTI_SOURCE_DIR}/nifticdf) + subdirs(niftilib) +-subdirs(nifti_regress_test) ++#subdirs(nifti_regress_test) --- a/nifticdf/CMakeLists.txt +++ b/nifticdf/CMakeLists.txt -@@ -6,8 +6,11 @@ +@@ -5,8 +5,11 @@ - SET(NIFTI_CDFLIB_NAME ${PACKAGE_PREFIX}nifticdf) + set(NIFTI_CDFLIB_NAME ${PACKAGE_PREFIX}nifticdf) --ADD_LIBRARY(${NIFTI_CDFLIB_NAME} ${NIFTICDFLIB_SRC} ) +-add_library(${NIFTI_CDFLIB_NAME} ${NIFTICDFLIB_SRC} ) +# Debian: enable 'unused' function as the AFNI package needs them -+ADD_DEFINITIONS( -D__COMPILE_UNUSED_FUNCTIONS__ ) ++add_definitions( -D__COMPILE_UNUSED_FUNCTIONS__ ) -+ADD_LIBRARY(${NIFTI_CDFLIB_NAME} ${NIFTICDFLIB_SRC} ) -+TARGET_LINK_LIBRARIES(${NIFTI_CDFLIB_NAME} m ) - IF (BUILD_SHARED_LIBS) - SET_TARGET_PROPERTIES(${NIFTI_CDFLIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) - ENDIF (BUILD_SHARED_LIBS) ++add_library(${NIFTI_CDFLIB_NAME} ${NIFTICDFLIB_SRC} ) ++target_link_libraries(${NIFTI_CDFLIB_NAME} m ) + if(BUILD_SHARED_LIBS) + set_target_properties(${NIFTI_CDFLIB_NAME} PROPERTIES ${NIFTI_LIBRARY_PROPERTIES}) + endif(BUILD_SHARED_LIBS) --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt -@@ -7,7 +7,7 @@ - ADD_EXECUTABLE(${PACKAGE_PREFIX}nifti_stats nifti_stats.c) - ADD_EXECUTABLE(${PACKAGE_PREFIX}nifti_tool nifti_tool.c) - ADD_EXECUTABLE(${PACKAGE_PREFIX}nifti1_test nifti1_test.c) --TARGET_LINK_LIBRARIES( nifti_stats ${PACKAGE_PREFIX}niftiio ${PACKAGE_PREFIX}nifticdf) -+TARGET_LINK_LIBRARIES( nifti_stats ${PACKAGE_PREFIX}nifticdf) - TARGET_LINK_LIBRARIES( nifti_tool ${PACKAGE_PREFIX}niftiio) - TARGET_LINK_LIBRARIES( nifti1_test ${PACKAGE_PREFIX}niftiio) - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,13 @@ - #File Generated by Hans J. Johnson - #Please contact hans-johnson@uiowa.edu for making enhancments/corrections - PROJECT(NIFTI) -+ -+# address warnings by cmake 2.6 -+cmake_minimum_required(VERSION 2.4) -+if(COMMAND cmake_policy) -+ cmake_policy(SET CMP0003 NEW) -+endif(COMMAND cmake_policy) -+ - # Configure Dart testing support. - INCLUDE(${CMAKE_ROOT}/Modules/Dart.cmake) +@@ -6,7 +6,7 @@ + add_executable(${PACKAGE_PREFIX}nifti_stats nifti_stats.c) + add_executable(${PACKAGE_PREFIX}nifti_tool nifti_tool.c) + add_executable(${PACKAGE_PREFIX}nifti1_test nifti1_test.c) +-target_link_libraries( nifti_stats ${PACKAGE_PREFIX}niftiio ${PACKAGE_PREFIX}nifticdf) ++target_link_libraries( nifti_stats ${PACKAGE_PREFIX}nifticdf) + target_link_libraries( nifti_tool ${PACKAGE_PREFIX}niftiio) + target_link_libraries( nifti1_test ${PACKAGE_PREFIX}niftiio) diff -Nru nifticlib-2.0.0/debian/patches/no_fslio nifticlib-2.0.0/debian/patches/no_fslio --- nifticlib-2.0.0/debian/patches/no_fslio 2010-07-20 19:07:49.000000000 +0000 +++ nifticlib-2.0.0/debian/patches/no_fslio 2014-10-06 07:17:29.000000000 +0000 @@ -1,11 +1,11 @@ --- a/docs/Doxy_nifti.txt +++ b/docs/Doxy_nifti.txt @@ -36,7 +36,7 @@ - # directories like "/usr/src/myproject". Separate the files or directories - # with spaces. + # directories like "/usr/src/myproject". Separate the files or directories + # with spaces. -INPUT = ../fsliolib ../niftilib ../znzlib +INPUT = ../niftilib ../znzlib - # If the value of the INPUT tag contains directories, you can use the - # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp + # If the value of the INPUT tag contains directories, you can use the + # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff -Nru nifticlib-2.0.0/debian/patches/series nifticlib-2.0.0/debian/patches/series --- nifticlib-2.0.0/debian/patches/series 2010-07-20 19:34:24.000000000 +0000 +++ nifticlib-2.0.0/debian/patches/series 2014-10-06 07:16:08.000000000 +0000 @@ -1,2 +1,5 @@ +0001-ENH-Merged-ITK-and-official-nifti-branch-to-improve-.patch +0002-ITK-free-s-in-failure-cases.patch +0003-originator-as-shorts.patch no_fslio build_setup diff -Nru nifticlib-2.0.0/debian/rules nifticlib-2.0.0/debian/rules --- nifticlib-2.0.0/debian/rules 2010-07-20 19:34:24.000000000 +0000 +++ nifticlib-2.0.0/debian/rules 2014-10-06 06:17:37.000000000 +0000 @@ -4,23 +4,18 @@ # This has to be exported to make some magic below work. export DH_OPTIONS +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/buildflags.mk + STATIC_BUILD_PATH=DEB_build_static SHARED_BUILD_PATH=DEB_build_shared -export CFLAGS = -Wall -g - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - export CFLAG += -O0 -else - export CFLAGS += -O2 -endif - CMAKE_FLAGS=-DCMAKE_INSTALL_PREFIX:PATH=/usr \ -DNIFTI_INSTALL_INCLUDE_DIR:PATH=include/nifti \ -DCMAKE_SKIP_RPATH:BOOL=ON \ -DCMAKE_C_FLAGS:STRING="$$CFLAGS" \ - -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed" \ - -DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed" \ + -DCMAKE_SHARED_LINKER_FLAGS="$$LDFLAGS -Wl,--as-needed" \ + -DCMAKE_EXE_LINKER_FLAGS="$$LDFLAGS -Wl,--as-needed" \ -DUSE_FSL_CODE:BOOL=OFF \ -DBUILD_TESTING:BOOL=TRUE @@ -50,6 +45,8 @@ cd $(SHARED_BUILD_PATH) && $(MAKE) VERBOSE=1 # build api reference cd docs && doxygen Doxy_nifti.txt + # remove jquery (use from package dependency) + rm -f docs/html/jquery.js override_dh_auto_test: ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))