Imported Upstream version 1.3.1

parent 766b60a3
language: cpp
compiler:
- gcc
- clang
before_install:
- sudo apt-get update
install:
- sudo apt-get install libboost-all-dev libhdf5-serial-dev h5utils doxygen
before_script:
- mkdir build
- cd build
- cmake ..
script: make && make check
...@@ -50,10 +50,10 @@ endif (WIN32) ...@@ -50,10 +50,10 @@ endif (WIN32)
#the flexible header. The micro number changes when there are small changes #the flexible header. The micro number changes when there are small changes
#in the utility libraries, that don't affect the data format itself. #in the utility libraries, that don't affect the data format itself.
set(ISMRMRD_VERSION_MAJOR 1) set(ISMRMRD_VERSION_MAJOR 1)
set(ISMRMRD_VERSION_MINOR 2) set(ISMRMRD_VERSION_MINOR 3)
set(ISMRMRD_VERSION_PATCH 3) set(ISMRMRD_VERSION_PATCH 1)
set(ISMRMRD_XML_SCHEMA_SHA1 "99a63f4e8cf08ffc268f5ee8b8c8b2a1edf69412") set(ISMRMRD_XML_SCHEMA_SHA1 "9b899c6ad806bc2388c70461d6e5affe5cc6d750")
#Remove line breaks and white space that does not change the meaning of the schema #Remove line breaks and white space that does not change the meaning of the schema
file(STRINGS ${CMAKE_SOURCE_DIR}/schema/ismrmrd.xsd SCHEMA_STRINGS) #Read all strings from file file(STRINGS ${CMAKE_SOURCE_DIR}/schema/ismrmrd.xsd SCHEMA_STRINGS) #Read all strings from file
...@@ -91,6 +91,19 @@ endif() ...@@ -91,6 +91,19 @@ endif()
set(ISMRMRD_VERSION_STRING ${ISMRMRD_VERSION_MAJOR}.${ISMRMRD_VERSION_MINOR}.${ISMRMRD_VERSION_PATCH}) set(ISMRMRD_VERSION_STRING ${ISMRMRD_VERSION_MAJOR}.${ISMRMRD_VERSION_MINOR}.${ISMRMRD_VERSION_PATCH})
set(ISMRMRD_SOVERSION ${ISMRMRD_VERSION_MAJOR}.${ISMRMRD_VERSION_MINOR}) set(ISMRMRD_SOVERSION ${ISMRMRD_VERSION_MAJOR}.${ISMRMRD_VERSION_MINOR})
# Find HDF5 for dataset support
find_package(HDF5 1.8 COMPONENTS C)
if (HDF5_FOUND)
set (ISMRMRD_DATASET_SUPPORT true)
set (ISMRMRD_DATASET_SOURCES libsrc/dataset.c libsrc/dataset.cpp)
set (ISMRMRD_DATASET_INCLUDE_DIR ${HDF5_C_INCLUDE_DIR})
set (ISMRMRD_DATASET_LIBRARIES ${HDF5_LIBRARIES})
else (HDF5_FOUND)
set (ISMRMRD_DATASET_SUPPORT false)
message (WARNING "HDF5 not found. Dataset and file support unavailable!")
endif (HDF5_FOUND)
# Generate the version.h header file # Generate the version.h header file
find_package(Git) find_package(Git)
if (GIT_FOUND) if (GIT_FOUND)
...@@ -111,43 +124,35 @@ install(FILES ${CMAKE_BINARY_DIR}/include/ismrmrd/version.h DESTINATION include/ ...@@ -111,43 +124,35 @@ install(FILES ${CMAKE_BINARY_DIR}/include/ismrmrd/version.h DESTINATION include/
# remember to add ${CMAKE_BINARY_DIR}/include to the include path # remember to add ${CMAKE_BINARY_DIR}/include to the include path
# --- VERSIONING (end) ---- # --- VERSIONING (end) ----
# --- Main Library (begin) ----
# required packages for main library
find_package(HDF5 1.8 COMPONENTS C REQUIRED)
# --- Main Library (begin) ----
# in windows, install the HDF5 dependencies # in windows, install the HDF5 dependencies
if (WIN32) if (HDF5_FOUND AND WIN32 AND ISMRMRD_INSTALL_DEPENDENCIES)
if (ISMRMRD_INSTALL_DEPENDENCIES) if(DEFINED ENV{HDF5_ROOT})
if ( HDF5_FOUND ) set(HDF5_BIN_DIR $ENV{HDF5_ROOT}/bin)
if(DEFINED ENV{HDF5_ROOT}) else (DEFINED ENV{HDF5_ROOT})
set(HDF5_BIN_DIR $ENV{HDF5_ROOT}/bin) set(HDF5_BIN_DIR ${HDF5_C_INCLUDE_DIR}/../bin)
else (DEFINED ENV{HDF5_ROOT}) endif (DEFINED ENV{HDF5_ROOT})
set(HDF5_BIN_DIR ${HDF5_C_INCLUDE_DIR}/../bin) message("Install hdf5 libraries from ${HDF5_BIN_DIR} ")
endif (DEFINED ENV{HDF5_ROOT}) install( DIRECTORY ${HDF5_BIN_DIR} DESTINATION bin/.. FILES_MATCHING PATTERN "*.dll" )
message("Install hdf5 libraries from ${HDF5_BIN_DIR} ") endif (HDF5_FOUND AND WIN32 AND ISMRMRD_INSTALL_DEPENDENCIES)
install( DIRECTORY ${HDF5_BIN_DIR} DESTINATION bin/.. FILES_MATCHING PATTERN "*.dll" )
endif (HDF5_FOUND)
endif (ISMRMRD_INSTALL_DEPENDENCIES)
endif (WIN32)
# include directories for main library # include directories for main library
set(ISMRMRD_TARGET_INCLUDE_DIRS set(ISMRMRD_TARGET_INCLUDE_DIRS
include include
${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/include
${HDF5_C_INCLUDE_DIR} ${ISMRMRD_DATASET_INCLUDE_DIR}
) )
set(ISMRMRD_TARGET_SOURCES set(ISMRMRD_TARGET_SOURCES
libsrc/ismrmrd.c libsrc/ismrmrd.c
libsrc/ismrmrd.cpp libsrc/ismrmrd.cpp
libsrc/dataset.c
libsrc/dataset.cpp
libsrc/xml.cpp libsrc/xml.cpp
libsrc/meta.cpp libsrc/meta.cpp
${ISMRMRD_DATASET_SOURCES}
) )
set(ISMRMRD_TARGET_LINK_LIBS ${HDF5_LIBRARIES}) set(ISMRMRD_TARGET_LINK_LIBS ${ISMRMRD_DATASET_LIBRARIES})
# optional handling of system-installed pugixml # optional handling of system-installed pugixml
if(USE_SYSTEM_PUGIXML) if(USE_SYSTEM_PUGIXML)
...@@ -183,40 +188,35 @@ install(TARGETS ismrmrd DESTINATION lib) ...@@ -183,40 +188,35 @@ install(TARGETS ismrmrd DESTINATION lib)
install(DIRECTORY include/ismrmrd DESTINATION include) install(DIRECTORY include/ismrmrd DESTINATION include)
# install the schema file # install the schema file
install(FILES schema/ismrmrd.xsd install(FILES schema/ismrmrd.xsd DESTINATION share/ismrmrd/schema)
DESTINATION share/ismrmrd/schema)
# install the cmake modules # install the cmake modules
install(FILES install(FILES cmake/FindIsmrmrd.cmake cmake/FindFFTW3.cmake DESTINATION share/ismrmrd/cmake)
cmake/FindIsmrmrd.cmake
cmake/FindFFTW3.cmake
cmake/FindNumPy.cmake
DESTINATION
share/ismrmrd/cmake
)
# --- Main Library (end) ---- # --- Main Library (end) ----
# turn on testing
enable_testing()
# process subdirectories # process subdirectories
add_subdirectory(doc) add_subdirectory(doc)
add_subdirectory(examples/c)
add_subdirectory(utilities) add_subdirectory(utilities)
if (HDF5_FOUND)
add_subdirectory(examples/c)
endif (HDF5_FOUND)
# TODO: make this work on Windows
if (NOT WIN32)
add_subdirectory(tests)
endif (NOT WIN32)
# install the matlab api # install the matlab api
install(DIRECTORY matlab DESTINATION share/ismrmrd) install(DIRECTORY matlab DESTINATION share/ismrmrd)
# TODO build and install the python bindings
# Create package # Create package
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
include(${ISMRMRD_CMAKE_DIR}/ismrmrd_cpack.cmake) include(${ISMRMRD_CMAKE_DIR}/ismrmrd_cpack.cmake)
if(CPACK_GENERATOR) if(CPACK_GENERATOR)
message(STATUS "Found CPack generators: ${CPACK_GENERATOR}") message(STATUS "Found CPack generators: ${CPACK_GENERATOR}")
configure_file("${ISMRMRD_CMAKE_DIR}/cpack_options.cmake.in" configure_file("${ISMRMRD_CMAKE_DIR}/cpack_options.cmake.in" ${ISMRMRD_CPACK_CFG_FILE} @ONLY)
${ISMRMRD_CPACK_CFG_FILE} @ONLY)
set(CPACK_PROJECT_CONFIG_FILE ${ISMRMRD_CPACK_CFG_FILE}) set(CPACK_PROJECT_CONFIG_FILE ${ISMRMRD_CPACK_CFG_FILE})
include (CPack) include(CPack)
endif() endif(CPACK_GENERATOR)
[![Build Status](https://travis-ci.org/ismrmrd/ismrmrd.svg?branch=master)](https://travis-ci.org/ismrmrd/ismrmrd)
ISMRM Raw Data Format (ISMRMRD) ISMRM Raw Data Format (ISMRMRD)
=============================== ===============================
...@@ -12,7 +14,7 @@ To download the source code, clone the git archive: ...@@ -12,7 +14,7 @@ To download the source code, clone the git archive:
API Documentation can be found at https://ismrmrd.github.io/api/. API Documentation can be found at https://ismrmrd.github.io/api/.
You will need CMake, HDF5, Boost and optionally Doxygen and FFTW to build the C/C++ code. Please see the ISMRMRD documentation for specific installation instructions for [Linux](https://ismrmrd.github.io/index.html#linux-installation), [Mac OS X](https://ismrmrd.github.io/index.html#mac-osx-installation), and [Windows](https://ismrmrd.github.io/index.html#windows-installation). You will need CMake, HDF5, and optionally Boost and FFTW to build the C/C++ code. To generate the API documentation you will need Doxygen. Please see the ISMRMRD documentation for specific installation instructions for [Linux](https://ismrmrd.github.io/index.html#linux-installation), [Mac OS X](https://ismrmrd.github.io/index.html#mac-osx-installation), and [Windows](https://ismrmrd.github.io/index.html#windows-installation).
Overview Overview
--------- ---------
...@@ -26,3 +28,8 @@ A raw data set consist mainly of 2 sections: ...@@ -26,3 +28,8 @@ A raw data set consist mainly of 2 sections:
1. Raw data section. This section contains all the acquired data in the experiment. Each data item is preceded by a C-struct with encoding numbers, etc. Following this data header is a channel header and data for each acquired channel. The raw data headers are defined in a C/C++ header file (ismrmrd.h). Please see the [C header](https://github.com/ismrmrd/ismrmrd/blob/master/include/ismrmrd/ismrmrd.h) and the [documentation](https://ismrmrd.github.io/index.html#fixed-data-structures) for more information. 1. Raw data section. This section contains all the acquired data in the experiment. Each data item is preceded by a C-struct with encoding numbers, etc. Following this data header is a channel header and data for each acquired channel. The raw data headers are defined in a C/C++ header file (ismrmrd.h). Please see the [C header](https://github.com/ismrmrd/ismrmrd/blob/master/include/ismrmrd/ismrmrd.h) and the [documentation](https://ismrmrd.github.io/index.html#fixed-data-structures) for more information.
In addition to these sections, the ISMRMRD format also specifies an image header for storing reconstructed images and the accompanying C/C++ library provides a convenient way of writing such images into HDF5 files along with generic arrays for storing less well defined data structures, e.g. coil sensitivity maps or other calibration data. In addition to these sections, the ISMRMRD format also specifies an image header for storing reconstructed images and the accompanying C/C++ library provides a convenient way of writing such images into HDF5 files along with generic arrays for storing less well defined data structures, e.g. coil sensitivity maps or other calibration data.
Other Resources
---------------
- [Python implementation](https://www.github.com/ismrmrd/ismrmrd-python)
# - Find Java
# This module finds if Java is installed and determines where the
# include files and libraries are. This code sets the following
# variables:
#
# Java_JAVA_EXECUTABLE = the full path to the Java runtime
# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator
# Java_XJC_EXECUTABLE = the full path to the Java JAXB generator
# Java_JAR_EXECUTABLE = the full path to the Java archiver
# Java_VERSION_STRING = Version of the package found (java version), eg. 1.6.0_12
# Java_VERSION_MAJOR = The major version of the package found.
# Java_VERSION_MINOR = The minor version of the package found.
# Java_VERSION_PATCH = The patch version of the package found.
# Java_VERSION_TWEAK = The tweak version of the package found (after '_')
# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak)
#
# The minimum required version of Java can be specified using the
# standard CMake syntax, e.g. find_package(Java 1.5)
#
# NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to be
# identical. For example some java version may return:
# Java_VERSION_STRING = 1.5.0_17
# and
# Java_VERSION = 1.5.0.17
#
# another example is the Java OEM, with:
# Java_VERSION_STRING = 1.6.0-oem
# and
# Java_VERSION = 1.6.0
#
# For these components the following variables are set:
#
# Java_FOUND - TRUE if all components are found.
# Java_INCLUDE_DIRS - Full paths to all include dirs.
# Java_LIBRARIES - Full paths to all libraries.
# Java_<component>_FOUND - TRUE if <component> is found.
#
# Example Usages:
# find_package(Java)
# find_package(Java COMPONENTS Runtime)
# find_package(Java COMPONENTS Development)
#
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
# Copyright 2009-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# The HINTS option should only be used for values computed from the system.
set(_JAVA_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
$ENV{JAVA_HOME}/bin
)
# Hard-coded guesses should still go in PATHS. This ensures that the user
# environment can always override hard guesses.
set(_JAVA_PATHS
/usr/lib/java/bin
/usr/share/java/bin
/usr/local/java/bin
/usr/local/java/share/bin
/usr/java/j2sdk1.4.2_04
/usr/lib/j2sdk1.4-sun/bin
/usr/java/j2sdk1.4.2_09/bin
/usr/lib/j2sdk1.5-sun/bin
/opt/sun-jdk-1.5.0.04/bin
)
find_program(Java_JAVA_EXECUTABLE
NAMES java
HINTS ${_JAVA_HINTS}
PATHS ${_JAVA_PATHS}
)
if(Java_JAVA_EXECUTABLE)
execute_process(COMMAND ${Java_JAVA_EXECUTABLE} -version
RESULT_VARIABLE res
OUTPUT_VARIABLE var
ERROR_VARIABLE var # sun-java output to stderr
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if( res )
if(${Java_FIND_REQUIRED})
message( FATAL_ERROR "Error executing java -version" )
else()
message( STATUS "Warning, could not run java --version")
endif()
else()
# extract major/minor version and patch level from "java -version" output
# Tested on linux using
# 1. Sun / Sun OEM
# 2. OpenJDK 1.6
# 3. GCJ 1.5
# 4. Kaffe 1.4.2
if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*")
# This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*"
"\\1" Java_VERSION_STRING "${var}" )
elseif(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
# Kaffe style
string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*"
"\\1" Java_VERSION_STRING "${var}" )
else()
if(NOT Java_FIND_QUIETLY)
message(WARNING "regex not supported: ${var}. Please report")
endif()
endif()
string( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" )
string( REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_MINOR "${Java_VERSION_STRING}" )
string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_PATCH "${Java_VERSION_STRING}" )
# warning tweak version can be empty:
string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+[_\\.]?([0-9]*).*$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" )
if( Java_VERSION_TWEAK STREQUAL "" ) # check case where tweak is not defined
set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH})
else()
set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}.${Java_VERSION_TWEAK})
endif()
endif()
endif()
find_program(Java_JAR_EXECUTABLE
NAMES jar
HINTS ${_JAVA_HINTS}
PATHS ${_JAVA_PATHS}
)
find_program(Java_JAVAC_EXECUTABLE
NAMES javac
HINTS ${_JAVA_HINTS}
PATHS ${_JAVA_PATHS}
)
find_program(Java_XJC_EXECUTABLE
NAMES xjc
HINTS ${_JAVA_HINTS}
PATHS ${_JAVA_PATHS}
)
find_program(Java_JAVAH_EXECUTABLE
NAMES javah
HINTS ${_JAVA_HINTS}
PATHS ${_JAVA_PATHS}
)
find_program(Java_JAVADOC_EXECUTABLE
NAMES javadoc
HINTS ${_JAVA_HINTS}
PATHS ${_JAVA_PATHS}
)
include(FindPackageHandleStandardArgs)
if(Java_FIND_COMPONENTS)
foreach(component ${Java_FIND_COMPONENTS})
# User just want to execute some Java byte-compiled
if(component STREQUAL "Runtime")
find_package_handle_standard_args(Java
REQUIRED_VARS Java_JAVA_EXECUTABLE
VERSION_VAR Java_VERSION
)
elseif(component STREQUAL "Development")
find_package_handle_standard_args(Java
REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
Java_XJC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
VERSION_VAR Java_VERSION
)
else()
message(FATAL_ERROR "Comp: ${component} is not handled")
endif()
set(Java_${component}_FOUND TRUE)
endforeach()
else()
# Check for everything
find_package_handle_standard_args(Java
REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
Java_XJC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
VERSION_VAR Java_VERSION
)
endif()
mark_as_advanced(
Java_JAVA_EXECUTABLE
Java_JAR_EXECUTABLE
Java_JAVAC_EXECUTABLE
Java_XJC_EXECUTABLE
Java_JAVAH_EXECUTABLE
Java_JAVADOC_EXECUTABLE
)
# LEGACY
set(JAVA_RUNTIME ${Java_JAVA_EXECUTABLE})
set(JAVA_ARCHIVE ${Java_JAR_EXECUTABLE})
set(JAVA_COMPILE ${Java_JAVAC_EXECUTABLE})
# - Find the NumPy libraries
# This module finds if NumPy is installed, and sets the following variables
# indicating where it is.
#
# TODO: Update to provide the libraries and paths for linking npymath lib.
#
# NUMPY_FOUND - was NumPy found
# NUMPY_VERSION - the version of NumPy found as a string
# NUMPY_VERSION_MAJOR - the major version number of NumPy
# NUMPY_VERSION_MINOR - the minor version number of NumPy
# NUMPY_VERSION_PATCH - the patch version number of NumPy
# NUMPY_VERSION_DECIMAL - e.g. version 1.6.1 is 10601
# NUMPY_INCLUDE_DIRS - path to the NumPy include files
#============================================================================
# Copyright 2012 Continuum Analytics, Inc.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
#============================================================================
# Finding NumPy involves calling the Python interpreter
if(NumPy_FIND_REQUIRED)
find_package(PythonInterp REQUIRED)
else()
find_package(PythonInterp)
endif()
if(NOT PYTHONINTERP_FOUND)
set(NUMPY_FOUND FALSE)
return()
endif()
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
"import numpy as n; print(n.__version__); print(n.get_include());"
RESULT_VARIABLE _NUMPY_SEARCH_SUCCESS
OUTPUT_VARIABLE _NUMPY_VALUES_OUTPUT
ERROR_VARIABLE _NUMPY_ERROR_VALUE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT _NUMPY_SEARCH_SUCCESS MATCHES 0)
if(NumPy_FIND_REQUIRED)
message(FATAL_ERROR
"NumPy import failure:\n${_NUMPY_ERROR_VALUE}")
endif()
set(NUMPY_FOUND FALSE)
return()
endif()
# Convert the process output into a list
string(REGEX REPLACE ";" "\\\\;" _NUMPY_VALUES ${_NUMPY_VALUES_OUTPUT})
string(REGEX REPLACE "\n" ";" _NUMPY_VALUES ${_NUMPY_VALUES})
list(GET _NUMPY_VALUES 0 NUMPY_VERSION)
list(GET _NUMPY_VALUES 1 NUMPY_INCLUDE_DIRS)
string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" _VER_CHECK "${NUMPY_VERSION}")
if("${_VER_CHECK}" STREQUAL "")
# The output from Python was unexpected. Raise an error always
# here, because we found NumPy, but it appears to be corrupted somehow.
message(FATAL_ERROR
"Requested version and include path from NumPy, got instead:\n${_NUMPY_VALUES_OUTPUT}\n")
return()
endif()
# Make sure all directory separators are '/'
string(REGEX REPLACE "\\\\" "/" NUMPY_INCLUDE_DIRS ${NUMPY_INCLUDE_DIRS})
# Get the major and minor version numbers
string(REGEX REPLACE "\\." ";" _NUMPY_VERSION_LIST ${NUMPY_VERSION})
list(GET _NUMPY_VERSION_LIST 0 NUMPY_VERSION_MAJOR)
list(GET _NUMPY_VERSION_LIST 1 NUMPY_VERSION_MINOR)
list(GET _NUMPY_VERSION_LIST 2 NUMPY_VERSION_PATCH)
string(REGEX MATCH "[0-9]*" NUMPY_VERSION_PATCH ${NUMPY_VERSION_PATCH})
math(EXPR NUMPY_VERSION_DECIMAL
"(${NUMPY_VERSION_MAJOR} * 10000) + (${NUMPY_VERSION_MINOR} * 100) + ${NUMPY_VERSION_PATCH}")
find_package_message(NUMPY
"Found NumPy: version \"${NUMPY_VERSION}\" ${NUMPY_INCLUDE_DIRS}"
"${NUMPY_INCLUDE_DIRS}${NUMPY_VERSION}")
set(NUMPY_FOUND TRUE)
...@@ -8,7 +8,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "@ISMRMRD_VERSION_MAJOR@") ...@@ -8,7 +8,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "@ISMRMRD_VERSION_MAJOR@")
set(CPACK_PACKAGE_VERSION_MINOR "@ISMRMRD_VERSION_MINOR@") set(CPACK_PACKAGE_VERSION_MINOR "@ISMRMRD_VERSION_MINOR@")
set(CPACK_PACKAGE_VERSION_PATCH "@ISMRMRD_VERSION_PATCH@") set(CPACK_PACKAGE_VERSION_PATCH "@ISMRMRD_VERSION_PATCH@")
set(CPACK_PACKAGE_NAME "@PROJECT_NAME@") set(CPACK_PACKAGE_NAME "@PROJECT_NAME@")
set(CPACK_PACKAGE_VENDOR "https://sourceforge.net/p/ismrmrd") set(CPACK_PACKAGE_VENDOR "http://ismrmrd.github.io/")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ISMRM Raw Data Format (ISMRMRD)") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ISMRM Raw Data Format (ISMRMRD)")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "@PROJECT_NAME_LOWER@") set(CPACK_PACKAGE_INSTALL_DIRECTORY "@PROJECT_NAME_LOWER@")
set(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_SOURCE_DIR@/LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_SOURCE_DIR@/LICENSE")
...@@ -18,19 +18,13 @@ set(CPACK_PACKAGE_MAINTAINER "Michael S. Hansen <michael.hansen@nih.gov>") ...@@ -18,19 +18,13 @@ set(CPACK_PACKAGE_MAINTAINER "Michael S. Hansen <michael.hansen@nih.gov>")
set(CPACK_PACKAGE_CONTACT "Michael S. Hansen <michael.hansen@nih.gov>") set(CPACK_PACKAGE_CONTACT "Michael S. Hansen <michael.hansen@nih.gov>")
# DEB specific # DEB specific
set(CPACK_DEBIAN_PACKAGE_DEPENDS "@DEBIAN_PACKAGE_DEPENDS@")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel") set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Implementation of the ISMRMRD format.") set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Implementation of the ISMRMRD format.")
# RPM specific
# TODO: set(CPACK_RPM_PACKAGE_REQUIRES "@RPM_PACKAGE_DEPENDS@")
# TODO: set(CPACK_RPM_PACKAGE_DESCRIPTION "Implementation of the ISMRMRD format.")
# NSIS specific # NSIS specific
set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\ismrmrd.sourceforge.net") set(CPACK_NSIS_HELP_LINK "http://ismrmrd.github.io")
set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\ismrmrd.sourceforge.net") set(CPACK_NSIS_URL_INFO_ABOUT "http://ismrmrd.github.io")
set(CPACK_NSIS_MODIFY_PATH ON) set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_DISPLAY_NAME "ismrmrd") set(CPACK_NSIS_DISPLAY_NAME "ismrmrd")
......
...@@ -8,31 +8,33 @@ if(UNIX) ...@@ -8,31 +8,33 @@ if(UNIX)
if(EXISTS ${DPKG_PROGRAM}) if(EXISTS ${DPKG_PROGRAM})
list(APPEND CPACK_GENERATOR "DEB") list(APPEND CPACK_GENERATOR "DEB")
endif(EXISTS ${DPKG_PROGRAM}) endif(EXISTS ${DPKG_PROGRAM})
# TODO: RPM
#find_program(RPMBUILD_PROGRAM rpmbuild)
#if(EXISTS ${RPMBUILD_PROGRAM})
# list(APPEND CPACK_GENERATOR "RPM")
#endif(EXISTS ${RPMBUILD_PROGRAM})
endif(UNIX) endif(UNIX)
if(WIN32) # Enable/Disable automatic search for dependencies:
# NSLS set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
list(APPEND CPACK_GENERATOR "NSIS")
endif(WIN32)
# TODO: list(APPEND CPACK_SOURCE_GENERATOR "TGZ") # Enable/Disable component install for CPack generator DEB
# TODO: list(APPEND CPACK_SOURCE_GENERATOR "ZIP") set(CPACK_DEB_COMPONENT_INSTALL OFF)
list(APPEND CPACK_SOURCE_IGNORE_FILES ";.git;.gitignore;todo.txt;_clang-format;build/") set(CPACK_DEB_PACKAGE_COMPONENT OFF)
# set dependencies explicitly # Set dependencies explicitly
include(InstallRequiredSystemLibraries) set(CPACK_DEBIAN_PACKAGE_DEPENDS "libhdf5-7, libfftw3-3, libboost-program-options-dev")
set(DEBIAN_PACKAGE_DEPENDS "libhdf5-7, libfftw3-3, libboost-program-options-dev")
# TODO: set(RPM_PACKAGE_DEPENDS "hdf5-devel")
# where the package metadata are # Where the package metadata are
set(ISMRMRD_CPACK_CFG_FILE "${PROJECT_BINARY_DIR}/cpack_options.cmake") set(ISMRMRD_CPACK_CFG_FILE "${PROJECT_BINARY_DIR}/cpack_options.cmake")
# Where the package to be installed # Where the package to be installed
#set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX})
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
message("CPACK_PACKAGING_INSTALL_PREFIX: " ${CPACK_PACKAGING_INSTALL_PREFIX}) message("CPACK_PACKAGING_INSTALL_PREFIX: " ${CPACK_PACKAGING_INSTALL_PREFIX})
if(WIN32)
# NSLS
list(APPEND CPACK_GENERATOR "NSIS")
endif(WIN32)
list(APPEND CPACK_SOURCE_GENERATOR "TGZ")
list(APPEND CPACK_SOURCE_GENERATOR "ZIP")
list(APPEND CPACK_SOURCE_IGNORE_FILES ";.git;.gitignore;todo.txt;_clang-format;build/")
# set dependencies explicitly
include(InstallRequiredSystemLibraries)
include_directories(${CMAKE_SOURCE_DIR}/include) cmake_minimum_required(VERSION 2.8)
project(ISMRMRD-C-EXAMPLE)
add_executable(ismrmrd_c_demo main.c) # if building this example as a standalone project
target_link_libraries(ismrmrd_c_demo ismrmrd) if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
install(TARGETS ismrmrd_c_demo DESTINATION bin) if(NOT DEFINED ENV{ISMRMRD_HOME})
message(FATAL_ERROR "ISMRMRD_HOME environment variable must be defined")
endif(NOT DEFINED ENV{ISMRMRD_HOME})
list(APPEND CMAKE_MODULE_PATH "$ENV{ISMRMRD_HOME}/share/ismrmrd/cmake")
find_package(Ismrmrd REQUIRED)
# otherwise, building it as part of ISMRMRD itself
else(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(ISMRMRD_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include")
set(ISMRMRD_LIBRARIES ismrmrd)
endif(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
include_directories(${ISMRMRD_INCLUDE_DIR})
add_executable(ismrmrd_c_example main.c)
target_link_libraries(ismrmrd_c_example ${ISMRMRD_LIBRARIES})
install(TARGETS ismrmrd_c_example DESTINATION bin)
This is an example of a simple C project that is built on ISMRMRD. This is an example of a simple C project that is built on ISMRMRD.
Instructions for building: Instructions for building:
1. Install ISMRMRD
1. Install ISMRMRD and CMake
2. Define the environment variable ISMRMRD_HOME, 2. Define the environment variable ISMRMRD_HOME,
e.g. ISMRMRD_HOME=/usr/local/ismrmrd e.g. `export ISMRMRD_HOME=/usr/local/ismrmrd`
3. In a directory of your choosing: 3. Compile the example:
mkdir buildcdemo
cmake ${ISMRMRD_HOME}/examples/c mkdir build
make cmake ..
./ismrmrd_c_demo make
\ No newline at end of file ./ismrmrd_c_example
...@@ -45,12 +45,9 @@ int main(void) ...@@ -45,12 +45,9 @@ int main(void)
ismrmrd_write_header(&dataset1, xmlhdr); ismrmrd_write_header(&dataset1, xmlhdr);
/* Append some acquisitions */ /* Append some acquisitions */
/* must initialize an acquisition before you can use it */
ismrmrd_init_acquisition(&acq);
nacq_write = 5; nacq_write = 5;
for (n=0; n < nacq_write; n++) { for (n=0; n < nacq_write; n++) {
/* must free an acquisition before you can reinitialize it */ /* must initialize an acquisition before you can use it */
ismrmrd_init_acquisition(&acq);
ismrmrd_init_acquisition(&acq); ismrmrd_init_acquisition(&acq);
acq.head.number_of_samples = 128; acq.head.number_of_samples = 128;
acq.head.active_channels = 4; acq.head.active_channels = 4;
...@@ -76,6 +73,7 @@ int main(void) ...@@ -76,6 +73,7 @@ int main(void)
ismrmrd_set_flag(&(acq.head.flags), ISMRMRD_ACQ_LAST_IN_SLICE); ismrmrd_set_flag(&(acq.head.flags), ISMRMRD_ACQ_LAST_IN_SLICE);
} }
ismrmrd_append_acquisition(&dataset1, &acq); ismrmrd_append_acquisition(&dataset1, &acq);
ismrmrd_cleanup_acquisition(&acq);
} }
/* Close the dataset */ /* Close the dataset */
...@@ -91,6 +89,7 @@ int main(void) ...@@ -91,6 +89,7 @@ int main(void)
/* Read the header */ /* Read the header */
xmlstring = ismrmrd_read_header(&dataset2); xmlstring = ismrmrd_read_header(&dataset2);
printf("Header: %s\n", xmlstring); printf("Header: %s\n", xmlstring);
free(xmlstring);
/* Get the number of acquisitions */ /* Get the number of acquisitions */
nacq_read = ismrmrd_get_number_of_acquisitions(&dataset2); nacq_read = ismrmrd_get_number_of_acquisitions(&dataset2);
...@@ -131,6 +130,8 @@ int main(void) ...@@ -131,6 +130,8 @@ int main(void)
#else #else
printf("Data 3: %f\t 2: %f\n", creal(acq3.data[4]), creal(acq2.data[4])); printf("Data 3: %f\t