Imported Upstream version 1.2.0

parents
*~
*swp
*.so
build/
.DS_Store
# autogenerated
cmake/cpack_options.cmake
cmake_minimum_required(VERSION 2.8)
project(ISMRMRD)
# set project specific cmake module path
set (ISMRMRD_CMAKE_DIR ${PROJECT_SOURCE_DIR}/cmake CACHE PATH
"Location of CMake scripts")
# command line options
option(USE_SYSTEM_PUGIXML "Use pugixml installed on the system" OFF)
# and include it to the search list
list(APPEND CMAKE_MODULE_PATH ${ISMRMRD_CMAKE_DIR})
# whether to install dependencies
if (WIN32)
OPTION(ISMRMRD_INSTALL_DEPENDENCIES "Install ismrmrd dependencies in windows" Off)
endif (WIN32)
# set the build type to Release if not specified
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# compiler flags
if (WIN32)
add_definitions(-DWIN32 -D_WIN32 -D_WINDOWS)
add_definitions(-DUNICODE -D_UNICODE)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
add_definitions(-D__func__=__FUNCTION__)
else (WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif (WIN32)
# --- VERSIONING (begin) ----
#The ISMRMRD convention is to use version numbers with the format:
# XX.YY.ZZ (major, minor, patch)
#
#The major number increments when the binary compatibility of
#the fixed memory layout struts (e.g. AcquisitionHeader) is broken.
#The minor number changes when there are changes to the XML schema for
#the flexible header. The micro number changes when there are small changes
#in the utility libraries, that don't affect the data format itself.
set(ISMRMRD_VERSION_MAJOR 1)
set(ISMRMRD_VERSION_MINOR 2)
set(ISMRMRD_VERSION_PATCH 0)
set(ISMRMRD_XML_SCHEMA_SHA1 "99a63f4e8cf08ffc268f5ee8b8c8b2a1edf69412")
#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
string(REPLACE ";" "" SCHEMA_NO_BREAKS ${SCHEMA_STRINGS}) #Concatenate the list of strings
string(REGEX REPLACE ">[ \t]+<" "><" SCHEMA_NO_SPACE ${SCHEMA_NO_BREAKS}) #Remove spaces and tabs
string(STRIP ${SCHEMA_NO_SPACE} SCHEMA_NO_SPACE) #Strip any leading/trailing whitespace
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ismrmrd_no_white_space.xsd ${SCHEMA_NO_SPACE}) #Write to file
#Now hash the cleaned up file
file(SHA1 ${CMAKE_CURRENT_BINARY_DIR}/ismrmrd_no_white_space.xsd ISMRMRD_CURRENT_XML_SCHEMA_SHA1)
#Compare to last known hash
if (NOT (${ISMRMRD_XML_SCHEMA_SHA1} STREQUAL ${ISMRMRD_CURRENT_XML_SCHEMA_SHA1}))
message("")
message("-----------------------------------------------")
message(" !!VERSION ERROR!! ")
message(" ")
message(" Expected SHA1 hash: ")
message(" ${ISMRMRD_XML_SCHEMA_SHA1}")
message(" Actual SHA1 hash: ")
message(" ${ISMRMRD_CURRENT_XML_SCHEMA_SHA1}")
message(" ")
message(" The XML Schema (ismrmrmd.xsd) has changed and ")
message(" the MINOR version number should be increased ")
message(" and the SHA1 has should be updated in the ")
message(" CMakelists.txt file. ")
message(" ")
message(" If you don't know what this message means, you")
message(" probably shouldn't be changing anything ")
message("-----------------------------------------------")
message("")
message(FATAL_ERROR " FATAL XML VERSION ERROR")
endif()
set(ISMRMRD_VERSION_STRING ${ISMRMRD_VERSION_MAJOR}.${ISMRMRD_VERSION_MINOR}.${ISMRMRD_VERSION_PATCH})
set(ISMRMRD_SOVERSION ${ISMRMRD_VERSION_MAJOR}.${ISMRMRD_VERSION_MINOR})
# Generate the version.h header file
find_package(Git)
if (GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY
${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE ISMRMRD_GIT_SHA1 ERROR_VARIABLE ISMRMRD_GIT_STDERR)
string(STRIP "${ISMRMRD_GIT_SHA1}" ISMRMRD_GIT_SHA1)
string(LENGTH "${ISMRMRD_GIT_SHA1}" ISMRMRD_GIT_SHA1_LEN)
if (${ISMRMRD_GIT_SHA1_LEN} LESS 40)
message(WARNING "Could not determine SHA-1 hash: ${ISMRMRD_GIT_STDERR}")
set(ISMRMRD_GIT_SHA1 "NA")
endif (${ISMRMRD_GIT_SHA1_LEN} LESS 40)
else()
set(ISMRMRD_GIT_SHA1 "NA")
endif()
configure_file(include/version.in ${CMAKE_BINARY_DIR}/include/ismrmrd/version.h)
install(FILES ${CMAKE_BINARY_DIR}/include/ismrmrd/version.h DESTINATION include/ismrmrd)
# note: for the utilities in this project that need ismrmrd/version.h
# remember to add ${CMAKE_BINARY_DIR}/include to the include path
# --- VERSIONING (end) ----
# --- Main Library (begin) ----
# required packages for main library
find_package(HDF5 1.8 COMPONENTS C REQUIRED)
# in windows, install the HDF5 dependencies
if (WIN32)
if (ISMRMRD_INSTALL_DEPENDENCIES)
if ( HDF5_FOUND )
if(DEFINED ENV{HDF5_ROOT})
set(HDF5_BIN_DIR $ENV{HDF5_ROOT}/bin)
else (DEFINED ENV{HDF5_ROOT})
set(HDF5_BIN_DIR ${HDF5_C_INCLUDE_DIR}/../bin)
endif (DEFINED ENV{HDF5_ROOT})
message("Install hdf5 libraries from ${HDF5_BIN_DIR} ")
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
set(ISMRMRD_TARGET_INCLUDE_DIRS
include
${CMAKE_BINARY_DIR}/include
${HDF5_C_INCLUDE_DIR}
)
set(ISMRMRD_TARGET_SOURCES
libsrc/ismrmrd.c
libsrc/ismrmrd.cpp
libsrc/dataset.c
libsrc/dataset.cpp
libsrc/xml.cpp
libsrc/meta.cpp
)
set(ISMRMRD_TARGET_LINK_LIBS ${HDF5_LIBRARIES})
# optional handling of system-installed pugixml
if(USE_SYSTEM_PUGIXML)
find_package(PugiXML)
if(PugiXML_FOUND)
message("Found system pugixml: ${PugiXML_INCLUDE_DIR} ${PugiXML_LIBRARY}")
list(APPEND ISMRMRD_TARGET_INCLUDE_DIRS ${PugiXML_INCLUDE_DIR})
list(APPEND ISMRMRD_TARGET_LINK_LIBS ${PugiXML_LIBRARY})
else(PugiXML_FOUND)
message(FATAL_ERROR "Pugixml library not found on the system, try without "
"setting USE_SYSTEM_PUGIXML to use the version provided in the source "
"tree.")
endif(PugiXML_FOUND)
list(APPEND ISMRMRD_TARGET_INCLUDE_DIRS ${PugiXML_INCLUDE_DIR})
list(APPEND ISMRMRD_TARGET_LINK_LIBS ${PugiXML_LIBRARY})
else(USE_SYSTEM_PUGIXML)
list(APPEND ISMRMRD_TARGET_SOURCES libsrc/pugixml.cpp)
endif(USE_SYSTEM_PUGIXML)
# main library
include_directories(${ISMRMRD_TARGET_INCLUDE_DIRS})
add_library(ismrmrd SHARED ${ISMRMRD_TARGET_SOURCES})
set_target_properties(ismrmrd PROPERTIES
VERSION ${ISMRMRD_VERSION_STRING}
SOVERSION ${ISMRMRD_SOVERSION}
)
target_link_libraries(ismrmrd ${ISMRMRD_TARGET_LINK_LIBS})
# install the main library
install(TARGETS ismrmrd DESTINATION lib)
# install the headers
install(DIRECTORY include/ismrmrd DESTINATION include)
# install the schema file
install(FILES schema/ismrmrd.xsd
DESTINATION share/ismrmrd/schema)
# install the cmake modules
install(FILES
cmake/FindIsmrmrd.cmake
cmake/FindFFTW3.cmake
cmake/FindNumPy.cmake
DESTINATION
share/ismrmrd/cmake
)
# --- Main Library (end) ----
# turn on testing
enable_testing()
# process subdirectories
add_subdirectory(doc)
add_subdirectory(examples/c)
add_subdirectory(utilities)
# install the matlab api
install(DIRECTORY matlab DESTINATION share/ismrmrd)
# TODO build and install the python bindings
# Create package
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
include(${ISMRMRD_CMAKE_DIR}/ismrmrd_cpack.cmake)
if(CPACK_GENERATOR)
message(STATUS "Found CPack generators: ${CPACK_GENERATOR}")
configure_file("${ISMRMRD_CMAKE_DIR}/cpack_options.cmake.in"
${ISMRMRD_CPACK_CFG_FILE} @ONLY)
set(CPACK_PROJECT_CONFIG_FILE ${ISMRMRD_CPACK_CFG_FILE})
include (CPack)
endif()
ISMRMRD SOFTWARE LICENSE JULY 2013
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, THIS PERMISSION NOTICE, AND THE LIMITATION
OF LIABILITY BELOW SHALL BE INCLUDED IN ALL COPIES OR REDISTRIBUTIONS
OF SUBSTANTIAL PORTIONS OF THE SOFTWARE.
SOFTWARE IS BEING DEVELOPED IN PART AT THE NATIONAL HEART, LUNG, AND BLOOD
INSTITUTE, NATIONAL INSTITUTES OF HEALTH BY AN EMPLOYEE OF THE FEDERAL
GOVERNMENT IN THE COURSE OF HIS OFFICIAL DUTIES. PURSUANT TO TITLE 17,
SECTION 105 OF THE UNITED STATES CODE, THIS SOFTWARE IS NOT SUBJECT TO
COPYRIGHT PROTECTION AND IS IN THE PUBLIC DOMAIN. EXCEPT AS CONTAINED IN
THIS NOTICE, THE NAME OF THE AUTHORS, THE NATIONAL HEART, LUNG, AND BLOOD
INSTITUTE (NHLBI), OR THE NATIONAL INSTITUTES OF HEALTH (NIH) MAY NOT
BE USED TO ENDORSE OR PROMOTE PRODUCTS DERIVED FROM THIS SOFTWARE WITHOUT
SPECIFIC PRIOR WRITTEN PERMISSION FROM THE NHLBI OR THE NIH.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 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.
\ No newline at end of file
ISMRM Raw Data Format (ISMRMRD)
===============================
A prerequisite for sharing magnetic resonance (imaging) reconstruction algorithms and code is a common raw data format. This document describes such a common raw data format and attempts to capture the data fields that are require to describe enough details about the magnetic resonance experiment to reconstruct images from the data. This standard was developed by a subcommittee of the ISMRM Sedona 2013 workshop. Please see the [ISMRMRD Documentation](https://ismrmrd.github.io) for more information.
Obtaining and Installing
-------------------------
To download the source code, clone the git archive:
git clone https://github.com/ismrmrd/ismrmrd
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).
Overview
---------
The raw data format combines a mix of flexible data structures (XML header) and fixed structures (equivalent to C-structs).
A raw data set consist mainly of 2 sections:
1. A flexible XML format document that can contain an arbitrary number of fields and accommodate everything from simple values (b-values, etc.) to entire vendor protocols, etc. The purpose of this XML document is to provide parameters that may be meaningful for some experiments but not for others. This XML format is defined by an XML Schema Definition file (ismrmrd.xsd). Please see the [example header](https://github.com/ismrmrd/ismrmrd/blob/master/schema/ismrmrd_example_extended.xml), [schema](https://github.com/ismrmrd/ismrmrd/blob/master/schema/ismrmrd.xsd), and the [documentation](https://ismrmrd.github.io/index.html#flexible-data-header) 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.
---
# BasedOnStyle: LLVM
AccessModifierOffset: -4
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
ColumnLimit: 0
ConstructorInitializerAllOnOneLineOrOnePerLine: false
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerBindsToType: false
SpaceBeforeAssignmentOperators: true
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: false
Standard: Cpp03
IndentWidth: 4
TabWidth: 4
UseTab: Never
BreakBeforeBraces: Attach
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
...
ismrmrd.c
*.so
*.h5
ISMRMRD_HOME ?= /usr/local
CPPFLAGS = -I$(ISMRMRD_HOME)/include
LDFLAGS = -L$(ISMRMRD_HOME)/lib
ismrmrd.so: ismrmrd.pyx cismrmrd.pxd setup.py
python setup.py build_ext -i
install: ismrmrd.so
install -d $(ISMRMRD_HOME)/python
install $< $(ISMRMRD_HOME)/python/
clean:
rm ismrmrd.c ismrmrd.so
This diff is collapsed.
import ismrmrd
acq = ismrmrd.Acquisition()
acq.head.version = 42
print(acq.head.version)
img = ismrmrd.Image()
f = ismrmrd.Dataset('./testdata.h5', '/dataset', True)
print f.filename
# xml = f.readHeader()
This diff is collapsed.
import os
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
ismrmrd_home = os.environ['ISMRMRD_HOME']
ext = Extension(
"ismrmrd",
["cismrmrd.pxd", "ismrmrd.pyx"],
include_dirs=[os.path.join(ismrmrd_home, 'include'),
numpy.get_include()],
library_dirs=[os.path.join(ismrmrd_home, 'lib')],
libraries=["ismrmrd"],
extra_link_args=[],
)
setup(
name="ismrmrd",
ext_modules=[ext],
cmdclass={'build_ext':build_ext}
)
# - Try to find FFTW3.
# Usage: find_package(FFTW3 [COMPONENTS [single double long-double threads]])
#
# Variables used by this module:
# FFTW3_ROOT_DIR - FFTW3 root directory
# Variables defined by this module:
# FFTW3_FOUND - system has FFTW3
# FFTW3_INCLUDE_DIR - the FFTW3 include directory (cached)
# FFTW3_INCLUDE_DIRS - the FFTW3 include directories
# (identical to FFTW3_INCLUDE_DIR)
# FFTW3[FL]?_LIBRARY - the FFTW3 library - double, single(F),
# long-double(L) precision (cached)
# FFTW3[FL]?_THREADS_LIBRARY - the threaded FFTW3 library - double, single(F),
# long-double(L) precision (cached)
# FFTW3_LIBRARIES - list of all FFTW3 libraries found
# Copyright (C) 2009-2010
# ASTRON (Netherlands Institute for Radio Astronomy)
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This file is part of the LOFAR software suite.
# The LOFAR software suite is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The LOFAR software suite is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
#
# $Id: FindFFTW3.cmake 15918 2010-06-25 11:12:42Z loose $
# Use double precision by default.
if(FFTW3_FIND_COMPONENTS MATCHES "^$")
set(_components double)
else()
set(_components ${FFTW3_FIND_COMPONENTS})
endif()
# Loop over each component.
set(_libraries)
foreach(_comp ${_components})
if(_comp STREQUAL "single")
list(APPEND _libraries fftw3f)
elseif(_comp STREQUAL "double")
list(APPEND _libraries fftw3)
elseif(_comp STREQUAL "long-double")
list(APPEND _libraries fftw3l)
elseif(_comp STREQUAL "threads")
set(_use_threads ON)
else(_comp STREQUAL "single")
message(FATAL_ERROR "FindFFTW3: unknown component `${_comp}' specified. "
"Valid components are `single', `double', `long-double', and `threads'.")
endif(_comp STREQUAL "single")
endforeach(_comp ${_components})
# If using threads, we need to link against threaded libraries as well.
if(_use_threads)
set(_thread_libs)
foreach(_lib ${_libraries})
list(APPEND _thread_libs ${_lib}_threads)
endforeach(_lib ${_libraries})
set(_libraries ${_thread_libs} ${_libraries})
endif(_use_threads)
# Keep a list of variable names that we need to pass on to
# find_package_handle_standard_args().
set(_check_list)
# Search for all requested libraries.
if (WIN32)
foreach(_lib ${_libraries})
string(TOUPPER ${_lib} _LIB)
find_library(${_LIB}_LIBRARY lib${_lib}-3
HINTS $ENV{FFTW3_ROOT_DIR} PATH_SUFFIXES lib)
mark_as_advanced(${_LIB}_LIBRARY)
list(APPEND FFTW3_LIBRARIES ${${_LIB}_LIBRARY})
list(APPEND _check_list ${_LIB}_LIBRARY)
endforeach(_lib ${_libraries})
message("FFTW3 WINDOWS libraries: " ${FFTW3_LIBRARIES})
else (WIN32)
foreach(_lib ${_libraries})
string(TOUPPER ${_lib} _LIB)
find_library(${_LIB}_LIBRARY ${_lib}
HINTS $ENV{FFTW3_ROOT_DIR} PATH_SUFFIXES lib)
mark_as_advanced(${_LIB}_LIBRARY)
list(APPEND FFTW3_LIBRARIES ${${_LIB}_LIBRARY})
list(APPEND _check_list ${_LIB}_LIBRARY)
endforeach(_lib ${_libraries})
message("FFTW3 UNIX libraries: " ${FFTW3_LIBRARIES})
endif (WIN32)
# Search for the header file.
find_path(FFTW3_INCLUDE_DIR fftw3.h
HINTS $ENV{FFTW3_ROOT_DIR} PATH_SUFFIXES include)
mark_as_advanced(FFTW3_INCLUDE_DIR)
list(APPEND _check_list FFTW3_INCLUDE_DIR)
# Handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFTW3 DEFAULT_MSG ${_check_list})
# - Find ISMRMRRD
# ISMRMRD_FOUND - true if an ISMRMRD installation is found.
# ISMRMRD_INCLUDE_DIR - where to find ismrmrd.h, etc.
# ISMRMRD_LIBRARIES - libismrmrd.so and libismrmrd_xml.so
# ISMRMRD_SCHEMA_DIR - where to find ismrmrd.xsd
FIND_PATH( ISMRMRD_INCLUDE_DIR ismrmrd/ismrmrd.h
HINTS $ENV{ISMRMRD_HOME} PATHS /usr/local /usr PATH_SUFFIXES include)
FIND_PATH( ISMRMRD_SCHEMA_DIR ismrmrd.xsd
HINTS $ENV{ISMRMRD_HOME} PATHS /usr/local /usr PATH_SUFFIXES share/ismrmrd/schema)
FIND_LIBRARY( ISMRMRD_LIBRARY NAMES ismrmrd
HINTS $ENV{ISMRMRD_HOME} /usr/local /usr PATH_SUFFIXES lib)
SET(ISMRMRD_LIBRARIES ${ISMRMRD_LIBRARY})
INCLUDE( "FindPackageHandleStandardArgs" )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( "Ismrmrd" DEFAULT_MSG ISMRMRD_INCLUDE_DIR ISMRMRD_LIBRARIES ISMRMRD_SCHEMA_DIR)
MARK_AS_ADVANCED( ISMRMRD_INCLUDE_DIR ISMRMRD_LIBRARIES ISMRMRD_SCHEMA_DIR)
#if(ISMRMRD_FOUND)
# message("ISMRMRD found ${ISMRMRD_LIBRARIES}")
#endif(ISMRMRD_FOUND)
# - 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")