diff --git a/CMake/PackageDepends/MITK_Boost_Config.cmake b/CMake/PackageDepends/MITK_Boost_Config.cmake
index 1f2eb572f2..0414b37a77 100644
--- a/CMake/PackageDepends/MITK_Boost_Config.cmake
+++ b/CMake/PackageDepends/MITK_Boost_Config.cmake
@@ -1,29 +1,29 @@
if(MITK_USE_Boost)
if(NOT MITK_USE_SYSTEM_Boost)
set(Boost_NO_SYSTEM_PATHS 1)
endif()
set(Boost_USE_MULTITHREADED 1)
set(Boost_USE_STATIC_LIBS 0)
set(Boost_USE_STATIC_RUNTIME 0)
if(MITK_USE_Boost_LIBRARIES)
if(NOT MITK_USE_SYSTEM_Boost)
set(BOOST_INCLUDEDIR ${CMAKE_BINARY_DIR}/../Boost-install/include)
set(BOOST_LIBRARYDIR ${CMAKE_BINARY_DIR}/../Boost-install/lib)
- set(Boost_ADDITIONAL_VERSIONS 1.55)
+ set(Boost_ADDITIONAL_VERSIONS 1.56)
endif()
- find_package(Boost 1.55.0 REQUIRED COMPONENTS ${MITK_USE_Boost_LIBRARIES} QUIET)
+ find_package(Boost 1.56.0 REQUIRED COMPONENTS ${MITK_USE_Boost_LIBRARIES} QUIET)
else()
- find_package(Boost 1.55.0 REQUIRED QUIET)
+ find_package(Boost 1.56.0 REQUIRED QUIET)
endif()
list(APPEND ALL_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS})
if(Boost_LIBRARIES)
list(APPEND ALL_LIBRARIES ${Boost_LIBRARIES})
link_directories(${Boost_LIBRARY_DIRS})
endif()
endif(MITK_USE_Boost)
diff --git a/CMakeExternals/Boost.cmake b/CMakeExternals/Boost.cmake
index 472d69ca3d..6b609f1d7d 100644
--- a/CMakeExternals/Boost.cmake
+++ b/CMakeExternals/Boost.cmake
@@ -1,109 +1,109 @@
#-----------------------------------------------------------------------------
# Boost
#-----------------------------------------------------------------------------
if(MITK_USE_Boost)
# Sanity checks
if(DEFINED BOOST_ROOT AND NOT EXISTS ${BOOST_ROOT})
message(FATAL_ERROR "BOOST_ROOT variable is defined but corresponds to non-existing directory")
endif()
string(REPLACE "^^" ";" MITK_USE_Boost_LIBRARIES "${MITK_USE_Boost_LIBRARIES}")
set(proj Boost)
set(proj_DEPENDENCIES )
set(Boost_DEPENDS ${proj})
if(NOT DEFINED BOOST_ROOT AND NOT MITK_USE_SYSTEM_Boost)
set(_boost_libs )
set(INSTALL_COMMAND "")
if(MITK_USE_Boost_LIBRARIES)
# Set the boost root to the libraries install directory
set(BOOST_ROOT "${CMAKE_CURRENT_BINARY_DIR}/${proj}-install")
# We need binary boost libraries
foreach(_boost_lib ${MITK_USE_Boost_LIBRARIES})
set(_boost_libs ${_boost_libs} --with-${_boost_lib})
endforeach()
if(WIN32)
set(_boost_variant "")
set(_shell_extension .bat)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_boost_address_model "address-model=64")
else()
set(_boost_address_model "address-model=32")
endif()
if(MSVC)
if(MSVC_VERSION EQUAL 1400)
set(_boost_toolset "toolset=msvc-8.0")
elseif(MSVC_VERSION EQUAL 1500)
set(_boost_toolset "toolset=msvc-9.0")
elseif(MSVC_VERSION EQUAL 1600)
set(_boost_toolset "toolset=msvc-10.0")
elseif(MSVC_VERSION EQUAL 1700)
set(_boost_toolset "toolset=msvc-11.0")
endif()
endif()
else()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_boost_variant "variant=debug")
else()
set(_boost_variant "variant=release")
endif()
set(_shell_extension .sh)
endif()
if(APPLE)
set(APPLE_CMAKE_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/${proj}-cmake/ChangeBoostLibsInstallNameForMac.cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeExternals/ChangeBoostLibsInstallNameForMac.cmake.in ${APPLE_CMAKE_SCRIPT} @ONLY)
set(INSTALL_COMMAND ${CMAKE_COMMAND} -P ${APPLE_CMAKE_SCRIPT})
# Set OSX_SYSROOT
set (APPLE_SYSROOT_FLAG)
if (NOT ${CMAKE_OSX_SYSROOT} STREQUAL "")
set (APPLE_SYSROOT_FLAG --sysroot=${CMAKE_OSX_SYSROOT})
endif()
# Set the boost build command for apple
set(_boost_build_cmd ${CMAKE_CURRENT_BINARY_DIR}/${proj}-src/bjam ${APPLE_SYSROOT_FLAG} --builddir=${CMAKE_CURRENT_BINARY_DIR}/${proj}-build --prefix=${CMAKE_CURRENT_BINARY_DIR}/${proj}-install
${_boost_toolset} ${_boost_address_model} ${_boost_variant} ${_boost_libs} link=shared,static threading=multi runtime-link=shared -q install)
else()
set(_boost_build_cmd ${CMAKE_CURRENT_BINARY_DIR}/${proj}-src/bjam --build-dir=${CMAKE_CURRENT_BINARY_DIR}/${proj}-build --prefix=${CMAKE_CURRENT_BINARY_DIR}/${proj}-install ${_boost_toolset} ${_boost_address_model}
${_boost_variant} ${_boost_libs} link=shared,static threading=multi runtime-link=shared -q install)
endif()
set(_boost_cfg_cmd ${CMAKE_CURRENT_BINARY_DIR}/${proj}-src/bootstrap${_shell_extension})
else()
# If no libraries are specified set the boost root to the boost src directory
set(BOOST_ROOT "${CMAKE_CURRENT_BINARY_DIR}/${proj}-src")
set(_boost_cfg_cmd )
set(_boost_build_cmd )
endif()
ExternalProject_Add(${proj}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}-src
# Boost needs in-source builds
BINARY_DIR ${proj}-src
PREFIX ${proj}-cmake
- URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/boost_1_55_0.tar.bz2
- URL_MD5 d6eef4b4cacb2183f2bf265a5a03a354
+ URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/boost_1_56_0.tar.bz2
+ URL_MD5 a744cf167b05d72335f27c88115f211d
INSTALL_DIR ${proj}-install
CONFIGURE_COMMAND "${_boost_cfg_cmd}"
BUILD_COMMAND "${_boost_build_cmd}"
INSTALL_COMMAND "${INSTALL_COMMAND}"
DEPENDS ${proj_DEPENDENCIES}
)
else()
mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
endif()
endif()
diff --git a/CMakeExternals/SOFA.cmake b/CMakeExternals/SOFA.cmake
index ea2caaa3ca..78974ecf1a 100644
--- a/CMakeExternals/SOFA.cmake
+++ b/CMakeExternals/SOFA.cmake
@@ -1,100 +1,100 @@
#-----------------------------------------------------------------------------
# SOFA
#-----------------------------------------------------------------------------
if(MITK_USE_SOFA)
# Sanity checks
if(DEFINED SOFA_DIR AND NOT EXISTS ${SOFA_DIR})
message(FATAL_ERROR "SOFA_DIR variable is defined but corresponds to non-existing directory")
endif()
set(proj SOFA)
set(proj_DEPENDENCIES Boost GLEW)
set(SOFA_DEPENDS ${proj})
set(preconfigure_cmake_args
-DGLEW_DIR:PATH=${GLEW_DIR}
-DSOFA-APPLICATION_MODELER:BOOL=OFF
-DSOFA-APPLICATION_RUNSOFA:BOOL=OFF
-DSOFA-APPLICATION_SOFABATCH:BOOL=OFF
-DSOFA-EXTERNAL_BOOST:BOOL=ON
-DSOFA-EXTERNAL_BOOST_PATH:PATH=${CMAKE_BINARY_DIR}/Boost-install/lib
-DSOFA-EXTERNAL_CSPARSE:BOOL=ON
-DSOFA-EXTERNAL_GLEW:BOOL=ON
-DSOFA-EXTERNAL_PNG:BOOL=OFF
-DSOFA-EXTERNAL_ZLIB:BOOL=OFF
-DSOFA-LIB_COMPONENT_SPARSE_SOLVER:BOOL=ON
-DSOFA-LIB_GUI_GLUT:BOOL=OFF
-DSOFA-LIB_GUI_QT:BOOL=OFF
-DSOFA-LIB_GUI_QTVIEWER:BOOL=OFF
-DSOFA-TUTORIAL_CHAIN_HYBRID:BOOL=OFF
-DSOFA-TUTORIAL_COMPOSITE_OBJECT:BOOL=OFF
-DSOFA-TUTORIAL_MIXED_PENDULUM:BOOL=OFF
-DSOFA-TUTORIAL_ONE_PARTICLE:BOOL=OFF
-DSOFA-TUTORIAL_ONE_TETRAHEDRON:BOOL=OFF
)
if(NOT APPLE)
list(APPEND proj_DEPENDENCIES GLUT)
list(APPEND preconfigure_cmake_args
-DSOFA-EXTERNAL_FREEGLUT:BOOL=ON
-DGLUT_DIR:PATH=${GLUT_DIR}
)
endif()
if(NOT MITK_USE_SYSTEM_Boost)
list(APPEND preconfigure_cmake_args
-DBoost_NO_SYSTEM_PATHS:BOOL=ON
-DBOOST_INCLUDEDIR:PATH=${CMAKE_BINARY_DIR}/Boost-install/include
-DBOOST_LIBRARYDIR:PATH=${CMAKE_BINARY_DIR}/Boost-install/lib
- -DBoost_ADDITIONAL_VERSIONS:STRING=1.55
+ -DBoost_ADDITIONAL_VERSIONS:STRING=1.56
)
endif()
if(MITK_USE_SOFA_PLUGINS_DIR)
list(APPEND preconfigure_cmake_args
-DSOFA_APPLICATIONS_PLUGINS_DIR:PATH=${MITK_USE_SOFA_PLUGINS_DIR}
)
foreach(plugin ${MITK_USE_SOFA_PLUGINS})
string(TOUPPER ${plugin} plugin)
list(APPEND preconfigure_cmake_args
-DSOFA-PLUGIN_${plugin}:BOOL=ON
)
endforeach()
endif()
set(rev "10669")
set(SOFA_PATCH_COMMAND ${CMAKE_COMMAND} -DTEMPLATE_FILE:FILEPATH=${MITK_SOURCE_DIR}/CMakeExternals/EmptyFileForPatching.dummy -P ${MITK_SOURCE_DIR}/CMakeExternals/PatchSOFA-rev${rev}.cmake)
set(SOFA_PRECONFIGURE_COMMAND ${CMAKE_COMMAND} -G${gen} ${ep_common_args} ${preconfigure_cmake_args} ${boost_cmake_args} ${CMAKE_BINARY_DIR}/${proj}-src)
if(NOT DEFINED SOFA_DIR)
ExternalProject_Add(${proj}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}-src
BINARY_DIR ${proj}-build
PREFIX ${proj}-cmake
URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/SOFA-rev${rev}.tar.gz
URL_MD5 d01a194f54b933f4cdfdfc75b2f81a2f
PATCH_COMMAND ${SOFA_PATCH_COMMAND}
INSTALL_COMMAND ""
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
${ep_common_args}
DEPENDS ${proj_DEPENDENCIES}
)
ExternalProject_Add_Step(${proj} preconfigure
COMMAND ${SOFA_PRECONFIGURE_COMMAND}
WORKING_DIRECTORY ${proj}-build
DEPENDEES patch
DEPENDERS configure
LOG 1
)
set(SOFA_DIR ${CMAKE_CURRENT_BINARY_DIR}/${proj}-build)
else()
mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
endif()
endif()
diff --git a/Documentation/Doxygen/DeveloperManual/Starting/SettingUpMITK/BuildInstructions.dox b/Documentation/Doxygen/DeveloperManual/Starting/SettingUpMITK/BuildInstructions.dox
index 67fa18d753..dab91b2be2 100644
--- a/Documentation/Doxygen/DeveloperManual/Starting/SettingUpMITK/BuildInstructions.dox
+++ b/Documentation/Doxygen/DeveloperManual/Starting/SettingUpMITK/BuildInstructions.dox
@@ -1,204 +1,204 @@
/**
\page BuildInstructionsPage Build Instructions
\tableofcontents
\section BuildInstructions_Introduction Introduction
The MITK build system (which is based on CMake) supports a "superbuild" process, meaning that it will download, configure, and build
all required third-party libraries (except Qt) automatically. These instructions will show you how to use the MITK superbuild.
\note This page explains explicitly how to build MITK itself. If you want to create your own project based on MITK, the process
described below is completely automated. Please see \ref HowToNewProject.
For more advanced users, the last sections explain how to inject custom build libraries into the superbuild process.
\section BuildInstructions_Prerequisites Prerequisites
You need:
-# Git from http://git-scm.com (there are also numerous third-party graphical clients available). We recomment using
Git, but see below for a way how to get the current source code without using it.
-# CMake (version \minimumCMakeVersion or higher)
-# Qt 4.x if you plan to develop Qt-based applications
(version \minimumQt4Version or above is required, Qt 5.x is only supported experimentally for a very limited number of modules)
-# If you are using Mac OS X you need an Xcode installation as this provides the neccessary compilers and SDKs
\section BuildInstructions_Qt A note about Qt
Nokia provides several binary packages for Qt. You must make sure that the package you download matches
your toolchain. On Linux, getting Qt by installing the packages provided by your Linux package manager is the preferred way.
On Windows, the Nokia provided binaries are compiled for 32bit architectures. You cannot build your own project for a 64bit machine and
use the 32bit Qt libraries. You have two options for a 64bit Qt-based application:
-# Download an inofficial 64bit installer, for example here. Note
that we cannot offer support for problems with MITK due to the usage of this kind of installers.
-# Compile Qt yourself. This is shortly described below.
To compile Qt on Windows using Visual Studio, follow the steps below:
-# Download the Qt sources and unpack them, e.g. to C:/qt-everywhere-opensource-src-4.7.4
-# Open a Visual Studio command prompt. Make sure to use the appropriate command prompt for either a 32 bit or 64 bit build.
Note that Visual Studio Express does not come with 64bit compilers out of the box (the Professional version does).
-# Configure Qt by executing the configure.exe command in your Qt source directory. The following configure options will
build a Qt compatible with MITK:
\verbatim
configure.exe -prefix C:\Qt\4.7.4_vc9_x64 -debug-and-release -qt-sql-sqlite -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -mp -nomake examples -nomake demos -nomake docs
\endverbatim
-# Build and install the Qt libraries
\verbatim
nmake
nmake install
\endverbatim
After "nmake install" completed successfully, you may delete your Qt source directory.
\section BuildInstructions_Get_Source Get a source tree
Since MITK is under active development we recommend to use git to check out
the latest stable release from the homepage. If you decide to use the most current nightly
release, make sure to get a stable tree: Check the
MITK dashboard
before checking out. If the build tree is not clean, you can specify an
older revision for the checkout or get a stable tar ball from
www.mitk.org.
If you don't want to use Git, you may also download the current source code (or any other older version)
as a tar.gz package by clicking on the
snapshot link. You can then
skip the clone step below.
To clone MITK's current git repository do:
\code
git clone http://git.mitk.org/MITK.git
\endcode
\section BuildInstructions_Build_With_CMake Build MITK with CMake
Create a new directory for the superbuild binary tree, change to it and call CMake:
In the shell (assuming you current directory is the same as the one where you
issued the git clone command):
\code
mkdir MITK-superbuild
cd MITK-superbuild
ccmake ../MITK
\endcode
If you use Windows, then you just start the CMake GUI and enter the location of the source and of the binary tree,
choose a suitable generator and configure the project.
If you use Mac OS X you will have to tweak the CMake configuration:
- First of all you have to check the selected compilers, i.e.:
- CMAKE_CXX_COMPILER
- CMAKE_C_COMPILER
- both should be either apple's clang or apple's gcc compiler
- Next you have to assure hat CMAKE_OSX_SYSROOT points to the correct SDK location:
- This is either /Developer/SDKs/Developer/SDKs/MacOSX10.7.sdk or if you have installed Xcode 4.3+ it is located in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/
CMake will present you a couple of options, these are the most important ones:
- MITK_USE_ACVD Build MITK code which depends on ACVD (this will download and build ACVD)
- MITK_USE_BLUEBERRY Build the BlueBerry application framework
- - MITK_USE_Boost Build MITK code which depends on Boost (this will download Boost 1.55)
+ - MITK_USE_Boost Build MITK code which depends on Boost (this will download Boost 1.56)
- MITK_USE_Boost_LIBRARIES If you need binary Boost libraries, specify them here.
- MITK_USE_OpenCV Build MITK code which depends on OpenCV (this will download and build OpenCV 2.4)
- MITK_USE_Python Enables Python wrapping in MITK. This will also configure ITK, VTK, and OpenCV (if enabled) to build Python wrappers.
- MITK_USE_QT Build MITK code which depends on Qt
- MITK_USE_SOFA Build MITK code which depends on SOFA (this will download and build SOFA)
- QT_QMAKE_EXECUTABLE The path to the qmake executable of your Qt installation
If you are satisfied with the configuration of your MITK superbuild, generate the project files with
CMake by pressing "Generate".
Linux and Mac OS X users usually just enter "make" (optionally supplying the number threads to be used for
a parallel build):
\code
make -j4
\endcode
\note On Mac OS X: If you follow these steps CMake will produce Makefiles and therefore you cannot use Xcode but you have to use e.g. the QtCreator for programming. At the moment developing MITK with Xcode is not supported and using Xcode the superbuild doesn't complete without errors.
Windows users using Visual Studio can open the generated MITK-superbuild.sln solution file
in the MITK-superbuild directory and start the build by building the BUILD_ALL project.
\section BuildInstructions_Customize Customize your MITK superbuild
The MITK superbuild configured MITK with all needed external libraries. The build directories of these libraries,
and of MITK itself are located inside the MITK-superbuild directory. For example, the directory layout may
look like:
\code
MITK-superbuild
|- ITK-build
|- VTK-build
|- MITK-build
\endcode
To change the configuration of the MITK build, choose the MITK-build directory as the binary directory in the
CMake GUI. After generating the project files, build the MITK project by either issuing "make" in the MITK-build
directory (Linux), or by opening MITK-build/MITK.sln and building the project with Visual Studio.
You may also change the configuration of any project configured via the superbuild process. Make sure to also build
the changed project and also the projects which depend on it.
\section BuildInstructions_Running Running Applications
On Linux, just execute the application you want to run. MITK executables are located in
MITK-superbuild/MITK-build/bin
On Windows, the PATH environment variable must contain the directories containging third-party libraries.
The MITK build system generated Windows Batch files in the MITK-build directory which set up a correct
environment and opens the appropriate Visual Studio solution file. Use (and maybe modify/enhance) these Batch files
to be able to start and debug MITK applications from inside Visual Studio.
\section BuildInstructions_Documentation Documentation
If you have the Doxygen documentation tool installed, you get a new project
(Visual Studio) or "make" target named "doc". You can build this to generate the HTML documentation of MITK in
the Documentation/Doxygen directory of your MITK-build binary tree or in the MITK_DOXYGEN_OUTPUT_DIR CMake variable
(if specified).
\section BuildInstructions_Extending Extend MITK on your own (using the application framework BlueBerry)
Please see \ref NewPluginPage
\section BuildInstructions_As_Toolkit Use MITK in your own project (as a toolkit)
To use MITK in your external project, add the CMake command find_package(MITK REQUIRED)
to your CMakeLists.txt and make use of the CMake macros MITK_CHECK_MODULE(result_var )
and MITK_USE_MODULE()
provided by MITK.
Here is an example CMakeLists.txt (from the Examples/QtAppExample/ directory) which allows you
to create a Qt based application using MITK to display an image.
\include QtAppExample/CMakeLists.txt
\section BuildInstructions_Advanced_Customization Superbuild Customization
You can inject pre-build third-party libraries into the MITK superbuild by setting certain CMake variables before
the first configure step. MITK will then use these third-party libraries instead of downloading and building them
itself. Note you must take care to configure those libraries with all options MITK requires.
The variables listed below are provided for injecting third-party libraries. Their occurrence in the CMake GUI or
in ccmake may depend on specific MITK_USE_* options set to ON. You may also use the variable names below without the
EXTERNAL_ prefix, for example when providing their values on a command line call to CMake.
- EXTERNAL_BOOST_ROOT Set this variable to your custom Boost installation
- EXTERNAL_CTK_DIR Set this variable to your CTK binary tree (the directory containing the CTKConfig.cmake file)
- EXTERNAL_CableSwig_DIR Set this variable to your CableSwig binary tree for Python wrapping (the directory containing the CableSwigConfig.cmake file)
- EXTERNAL_DCMTK_DIR Set this variable to your DCMTK binary tree (the directory containing the DCMTKConfig.cmake file)
- EXTERNAL_GDCM_DIR Set this variable to your GDCM binary tree (the directory containing the GDCMConfig.cmake file)
- EXTERNAL_ITK_DIR Set this variable to your ITK binary tree (the directory containing the ITKConfig.cmake file)
- EXTERNAL_OpenCV_DIR Set this variable to your OpenCV binary tree (the directory containing the OpenCVConfig.cmake file)
- EXTERNAL_SOFA_DIR Set this variable to your SOFA binary tree (the directory containing the SOFAConfig.cmake file)
- EXTERNAL_VTK_DIR Set this variable to your VTK binary tree (the directory containing the VTKConfig.cmake file)
To set CMake options before the first configure step is invoked, supply them on the command line, i.e.
\code
ccmake -DITK_DIR:PATH=/opt/ITK-release ../MITK
\endcode
See the following link for more information about how to configure third-party libraries:
\subpage BuildToolkits "How to build ITK, VTK and QT"
*/
diff --git a/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt b/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt
index bd38665a82..c6bbc6b951 100644
--- a/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt
+++ b/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt
@@ -1,11 +1,15 @@
+# With apple gcc 4.2.1 the following waring leads to an build error if boost is enabled
+if(APPLE)
+ mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=empty-body" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+endif()
MITK_CREATE_MODULE(
SUBPROJECTS MITK-DTI
INCLUDE_DIRS Algorithms Algorithms/Reconstruction Algorithms/Registration Algorithms/Reconstruction/MultishellProcessing DicomImport IODataStructures/DiffusionWeightedImages IODataStructures/QBallImages IODataStructures/TensorImages IODataStructures Rendering ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS MitkMapperExt MitkPlanarFigure MitkImageExtraction MitkSceneSerializationBase MitkDICOMReader
PACKAGE_DEPENDS VTK|vtkFiltersProgrammable ITK|ITKDistanceMap+ITKRegistrationCommon+ITKLabelVoting+ITKVTK Boost
ITK|ITKMetricsv4+ITKRegistrationMethodsv4
WARNINGS_AS_ERRORS
)
add_subdirectory(Testing)
diff --git a/Modules/DiffusionImaging/FiberTracking/IODataStructures/mitkFiberfoxParameters.cpp b/Modules/DiffusionImaging/FiberTracking/IODataStructures/mitkFiberfoxParameters.cpp
index d443e5924a..1142b15b42 100644
--- a/Modules/DiffusionImaging/FiberTracking/IODataStructures/mitkFiberfoxParameters.cpp
+++ b/Modules/DiffusionImaging/FiberTracking/IODataStructures/mitkFiberfoxParameters.cpp
@@ -1,689 +1,689 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include
#include
#include
#include
#include
#include
template< class ScalarType >
mitk::FiberfoxParameters< ScalarType >::FiberfoxParameters()
: m_NoiseModel(NULL)
{
}
template< class ScalarType >
mitk::FiberfoxParameters< ScalarType >::~FiberfoxParameters()
{
// if (m_NoiseModel!=NULL)
// delete m_NoiseModel;
}
void mitk::SignalGenerationParameters::GenerateGradientHalfShell()
{
int NPoints = 2*m_NumGradients;
m_GradientDirections.clear();
m_NumBaseline = NPoints/20;
if (m_NumBaseline==0)
m_NumBaseline=1;
GradientType g;
g.Fill(0.0);
for (unsigned int i=0; i theta; theta.set_size(NPoints);
vnl_vector phi; phi.set_size(NPoints);
double C = sqrt(4*M_PI);
phi(0) = 0.0;
phi(NPoints-1) = 0.0;
for(int i=0; i0 && i mitk::SignalGenerationParameters::GetBaselineIndices()
{
std::vector< int > result;
for( unsigned int i=0; im_GradientDirections.size(); i++)
if (m_GradientDirections.at(i).GetNorm()<0.0001)
result.push_back(i);
return result;
}
unsigned int mitk::SignalGenerationParameters::GetFirstBaselineIndex()
{
for( unsigned int i=0; im_GradientDirections.size(); i++)
if (m_GradientDirections.at(i).GetNorm()<0.0001)
return i;
return -1;
}
bool mitk::SignalGenerationParameters::IsBaselineIndex(unsigned int idx)
{
if (m_GradientDirections.size()>idx && m_GradientDirections.at(idx).GetNorm()<0.0001)
return true;
return false;
}
unsigned int mitk::SignalGenerationParameters::GetNumWeightedVolumes()
{
return m_NumGradients;
}
unsigned int mitk::SignalGenerationParameters::GetNumBaselineVolumes()
{
return m_NumBaseline;
}
unsigned int mitk::SignalGenerationParameters::GetNumVolumes()
{
return m_GradientDirections.size();
}
mitk::SignalGenerationParameters::GradientListType mitk::SignalGenerationParameters::GetGradientDirections()
{
return m_GradientDirections;
}
mitk::SignalGenerationParameters::GradientType mitk::SignalGenerationParameters::GetGradientDirection(unsigned int i)
{
return m_GradientDirections.at(i);
}
void mitk::SignalGenerationParameters::SetNumWeightedVolumes(int numGradients)
{
m_NumGradients = numGradients;
GenerateGradientHalfShell();
}
void mitk::SignalGenerationParameters::SetGradienDirections(GradientListType gradientList)
{
m_GradientDirections = gradientList;
m_NumGradients = 0;
m_NumBaseline = 0;
for( unsigned int i=0; im_GradientDirections.size(); i++)
{
if (m_GradientDirections.at(i).GetNorm()>0.0001)
m_NumGradients++;
else
m_NumBaseline++;
}
}
void mitk::SignalGenerationParameters::SetGradienDirections(mitk::DiffusionImage::GradientDirectionContainerType::Pointer gradientList)
{
m_NumGradients = 0;
m_NumBaseline = 0;
m_GradientDirections.clear();
for( unsigned int i=0; iSize(); i++)
{
GradientType g;
g[0] = gradientList->at(i)[0];
g[1] = gradientList->at(i)[1];
g[2] = gradientList->at(i)[2];
m_GradientDirections.push_back(g);
if (m_GradientDirections.at(i).GetNorm()>0.0001)
m_NumGradients++;
else
m_NumBaseline++;
}
}
template< class ScalarType >
void mitk::FiberfoxParameters< ScalarType >::SaveParameters(string filename)
{
if(filename.empty())
return;
if(".ffp"!=filename.substr(filename.size()-4, 4))
filename += ".ffp";
boost::property_tree::ptree parameters;
// fiber generation parameters
parameters.put("fiberfox.fibers.distribution", m_FiberGen.m_Distribution);
parameters.put("fiberfox.fibers.variance", m_FiberGen.m_Variance);
parameters.put("fiberfox.fibers.density", m_FiberGen.m_Density);
parameters.put("fiberfox.fibers.spline.sampling", m_FiberGen.m_Sampling);
parameters.put("fiberfox.fibers.spline.tension", m_FiberGen.m_Tension);
parameters.put("fiberfox.fibers.spline.continuity", m_FiberGen.m_Continuity);
parameters.put("fiberfox.fibers.spline.bias", m_FiberGen.m_Bias);
parameters.put("fiberfox.fibers.rotation.x", m_FiberGen.m_Rotation[0]);
parameters.put("fiberfox.fibers.rotation.y", m_FiberGen.m_Rotation[1]);
parameters.put("fiberfox.fibers.rotation.z", m_FiberGen.m_Rotation[2]);
parameters.put("fiberfox.fibers.translation.x", m_FiberGen.m_Translation[0]);
parameters.put("fiberfox.fibers.translation.y", m_FiberGen.m_Translation[1]);
parameters.put("fiberfox.fibers.translation.z", m_FiberGen.m_Translation[2]);
parameters.put("fiberfox.fibers.scale.x", m_FiberGen.m_Scale[0]);
parameters.put("fiberfox.fibers.scale.y", m_FiberGen.m_Scale[1]);
parameters.put("fiberfox.fibers.scale.z", m_FiberGen.m_Scale[2]);
// image generation parameters
parameters.put("fiberfox.image.basic.size.x", m_SignalGen.m_ImageRegion.GetSize(0));
parameters.put("fiberfox.image.basic.size.y", m_SignalGen.m_ImageRegion.GetSize(1));
parameters.put("fiberfox.image.basic.size.z", m_SignalGen.m_ImageRegion.GetSize(2));
parameters.put("fiberfox.image.basic.spacing.x", m_SignalGen.m_ImageSpacing[0]);
parameters.put("fiberfox.image.basic.spacing.y", m_SignalGen.m_ImageSpacing[1]);
parameters.put("fiberfox.image.basic.spacing.z", m_SignalGen.m_ImageSpacing[2]);
parameters.put("fiberfox.image.basic.origin.x", m_SignalGen.m_ImageOrigin[0]);
parameters.put("fiberfox.image.basic.origin.y", m_SignalGen.m_ImageOrigin[1]);
parameters.put("fiberfox.image.basic.origin.z", m_SignalGen.m_ImageOrigin[2]);
parameters.put("fiberfox.image.basic.direction.1", m_SignalGen.m_ImageDirection[0][0]);
parameters.put("fiberfox.image.basic.direction.2", m_SignalGen.m_ImageDirection[0][1]);
parameters.put("fiberfox.image.basic.direction.3", m_SignalGen.m_ImageDirection[0][2]);
parameters.put("fiberfox.image.basic.direction.4", m_SignalGen.m_ImageDirection[1][0]);
parameters.put("fiberfox.image.basic.direction.5", m_SignalGen.m_ImageDirection[1][1]);
parameters.put("fiberfox.image.basic.direction.6", m_SignalGen.m_ImageDirection[1][2]);
parameters.put("fiberfox.image.basic.direction.7", m_SignalGen.m_ImageDirection[2][0]);
parameters.put("fiberfox.image.basic.direction.8", m_SignalGen.m_ImageDirection[2][1]);
parameters.put("fiberfox.image.basic.direction.9", m_SignalGen.m_ImageDirection[2][2]);
parameters.put("fiberfox.image.basic.numgradients", m_SignalGen.GetNumWeightedVolumes());
for( unsigned int i=0; im_SignalGen.GetNumVolumes(); i++)
{
parameters.put("fiberfox.image.gradients."+boost::lexical_cast(i)+".x", m_SignalGen.GetGradientDirection(i)[0]);
parameters.put("fiberfox.image.gradients."+boost::lexical_cast(i)+".y", m_SignalGen.GetGradientDirection(i)[1]);
parameters.put("fiberfox.image.gradients."+boost::lexical_cast(i)+".z", m_SignalGen.GetGradientDirection(i)[2]);
}
parameters.put("fiberfox.image.signalScale", m_SignalGen.m_SignalScale);
parameters.put("fiberfox.image.tEcho", m_SignalGen.m_tEcho);
parameters.put("fiberfox.image.tLine", m_SignalGen.m_tLine);
parameters.put("fiberfox.image.tInhom", m_SignalGen.m_tInhom);
parameters.put("fiberfox.image.bvalue", m_SignalGen.m_Bvalue);
parameters.put("fiberfox.image.simulatekspace", m_SignalGen.m_SimulateKspaceAcquisition);
parameters.put("fiberfox.image.axonRadius", m_SignalGen.m_AxonRadius);
parameters.put("fiberfox.image.diffusiondirectionmode", m_SignalGen.m_DiffusionDirectionMode);
parameters.put("fiberfox.image.fiberseparationthreshold", m_SignalGen.m_FiberSeparationThreshold);
parameters.put("fiberfox.image.doSimulateRelaxation", m_SignalGen.m_DoSimulateRelaxation);
parameters.put("fiberfox.image.doDisablePartialVolume", m_SignalGen.m_DoDisablePartialVolume);
parameters.put("fiberfox.image.artifacts.spikesnum", m_SignalGen.m_Spikes);
parameters.put("fiberfox.image.artifacts.spikesscale", m_SignalGen.m_SpikeAmplitude);
parameters.put("fiberfox.image.artifacts.kspaceLineOffset", m_SignalGen.m_KspaceLineOffset);
parameters.put("fiberfox.image.artifacts.eddyStrength", m_SignalGen.m_EddyStrength);
parameters.put("fiberfox.image.artifacts.eddyTau", m_SignalGen.m_Tau);
parameters.put("fiberfox.image.artifacts.aliasingfactor", m_SignalGen.m_CroppingFactor);
parameters.put("fiberfox.image.artifacts.addringing", m_SignalGen.m_DoAddGibbsRinging);
parameters.put("fiberfox.image.artifacts.doAddMotion", m_SignalGen.m_DoAddMotion);
parameters.put("fiberfox.image.artifacts.randomMotion", m_SignalGen.m_DoRandomizeMotion);
parameters.put("fiberfox.image.artifacts.translation0", m_SignalGen.m_Translation[0]);
parameters.put("fiberfox.image.artifacts.translation1", m_SignalGen.m_Translation[1]);
parameters.put("fiberfox.image.artifacts.translation2", m_SignalGen.m_Translation[2]);
parameters.put("fiberfox.image.artifacts.rotation0", m_SignalGen.m_Rotation[0]);
parameters.put("fiberfox.image.artifacts.rotation1", m_SignalGen.m_Rotation[1]);
parameters.put("fiberfox.image.artifacts.rotation2", m_SignalGen.m_Rotation[2]);
parameters.put("fiberfox.image.artifacts.addnoise", m_Misc.m_CheckAddNoiseBox);
parameters.put("fiberfox.image.artifacts.addghosts", m_Misc.m_CheckAddGhostsBox);
parameters.put("fiberfox.image.artifacts.addaliasing", m_Misc.m_CheckAddAliasingBox);
parameters.put("fiberfox.image.artifacts.addspikes", m_Misc.m_CheckAddSpikesBox);
parameters.put("fiberfox.image.artifacts.addeddycurrents", m_Misc.m_CheckAddEddyCurrentsBox);
parameters.put("fiberfox.image.artifacts.doAddDistortions", m_Misc.m_CheckAddDistortionsBox);
parameters.put("fiberfox.image.outputvolumefractions", m_Misc.m_CheckOutputVolumeFractionsBox);
parameters.put("fiberfox.image.showadvanced", m_Misc.m_CheckAdvancedSignalOptionsBox);
parameters.put("fiberfox.image.signalmodelstring", m_Misc.m_SignalModelString);
parameters.put("fiberfox.image.artifactmodelstring", m_Misc.m_ArtifactModelString);
parameters.put("fiberfox.image.outpath", m_Misc.m_OutputPath);
parameters.put("fiberfox.fibers.realtime", m_Misc.m_CheckRealTimeFibersBox);
parameters.put("fiberfox.fibers.showadvanced", m_Misc.m_CheckAdvancedFiberOptionsBox);
parameters.put("fiberfox.fibers.constantradius", m_Misc.m_CheckConstantRadiusBox);
parameters.put("fiberfox.fibers.includeFiducials", m_Misc.m_CheckIncludeFiducialsBox);
if (m_NoiseModel!=NULL)
{
parameters.put("fiberfox.image.artifacts.noisevariance", m_NoiseModel->GetNoiseVariance());
if (dynamic_cast*>(m_NoiseModel))
parameters.put("fiberfox.image.artifacts.noisetype", "rice");
else if (dynamic_cast*>(m_NoiseModel))
parameters.put("fiberfox.image.artifacts.noisetype", "chisquare");
}
for (int i=0; i* signalModel = NULL;
if (i(i)+".type", "fiber");
}
else
{
signalModel = m_NonFiberModelList.at(i-m_FiberModelList.size());
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".type", "non-fiber");
}
if (dynamic_cast*>(signalModel))
{
mitk::StickModel* model = dynamic_cast*>(signalModel);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".model", "stick");
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".d", model->GetDiffusivity());
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".t2", model->GetT2());
}
else if (dynamic_cast*>(signalModel))
{
mitk::TensorModel* model = dynamic_cast*>(signalModel);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".model", "tensor");
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".d1", model->GetDiffusivity1());
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".d2", model->GetDiffusivity2());
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".d3", model->GetDiffusivity3());
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".t2", model->GetT2());
}
else if (dynamic_cast*>(signalModel))
{
mitk::RawShModel* model = dynamic_cast*>(signalModel);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".model", "prototype");
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".minFA", model->GetFaRange().first);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".maxFA", model->GetFaRange().second);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".minADC", model->GetAdcRange().first);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".maxADC", model->GetAdcRange().second);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".maxNumSamples", model->GetMaxNumKernels());
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".numSamples", model->GetNumberOfKernels());
int shOrder = model->GetShOrder();
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".numCoeffs", (shOrder*shOrder + shOrder + 2)/2 + shOrder);
for (unsigned int j=0; jGetNumberOfKernels(); j++)
{
vnl_vector< double > coeffs = model->GetCoefficients(j);
for (unsigned int k=0; k(i)+".kernels."+boost::lexical_cast(j)+".coeffs."+boost::lexical_cast(k), coeffs[k]);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".kernels."+boost::lexical_cast(j)+".B0", model->GetBaselineSignal(j));
}
}
else if (dynamic_cast*>(signalModel))
{
mitk::BallModel* model = dynamic_cast*>(signalModel);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".model", "ball");
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".d", model->GetDiffusivity());
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".t2", model->GetT2());
}
else if (dynamic_cast*>(signalModel))
{
mitk::AstroStickModel* model = dynamic_cast*>(signalModel);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".model", "astrosticks");
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".d", model->GetDiffusivity());
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".t2", model->GetT2());
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".randomize", model->GetRandomizeSticks());
}
else if (dynamic_cast*>(signalModel))
{
mitk::DotModel* model = dynamic_cast*>(signalModel);
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".model", "dot");
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".t2", model->GetT2());
}
if (signalModel!=NULL)
{
parameters.put("fiberfox.image.compartments."+boost::lexical_cast(i)+".ID", signalModel->m_CompartmentId);
if (signalModel->GetVolumeFractionImage().IsNotNull())
{
try{
itk::ImageFileWriter::Pointer writer = itk::ImageFileWriter::New();
writer->SetFileName(filename+"_VOLUME"+boost::lexical_cast(signalModel->m_CompartmentId)+".nrrd");
writer->SetInput(signalModel->GetVolumeFractionImage());
writer->Update();
MITK_INFO << "Volume fraction image for compartment "+boost::lexical_cast(signalModel->m_CompartmentId)+" saved.";
}
catch(...)
{
}
}
}
}
- boost::property_tree::xml_writer_settings writerSettings(' ', 2);
+ boost::property_tree::xml_writer_settings writerSettings(' ', 2);
boost::property_tree::xml_parser::write_xml(filename, parameters, std::locale(), writerSettings);
try{
itk::ImageFileWriter::Pointer writer = itk::ImageFileWriter::New();
writer->SetFileName(filename+"_FMAP.nrrd");
writer->SetInput(m_SignalGen.m_FrequencyMap);
writer->Update();
}
catch(...)
{
MITK_INFO << "No frequency map saved.";
}
try{
itk::ImageFileWriter::Pointer writer = itk::ImageFileWriter::New();
writer->SetFileName(filename+"_MASK.nrrd");
writer->SetInput(m_SignalGen.m_MaskImage);
writer->Update();
}
catch(...)
{
MITK_INFO << "No mask image saved.";
}
}
template< class ScalarType >
void mitk::FiberfoxParameters< ScalarType >::LoadParameters(string filename)
{
if(filename.empty())
return;
boost::property_tree::ptree parameterTree;
boost::property_tree::xml_parser::read_xml(filename, parameterTree);
m_FiberModelList.clear();
m_NonFiberModelList.clear();
if (m_NoiseModel!=NULL)
delete m_NoiseModel;
BOOST_FOREACH( boost::property_tree::ptree::value_type const& v1, parameterTree.get_child("fiberfox") )
{
if( v1.first == "fibers" )
{
m_Misc.m_CheckRealTimeFibersBox = v1.second.get("realtime", m_Misc.m_CheckRealTimeFibersBox);
m_Misc.m_CheckAdvancedFiberOptionsBox = v1.second.get("showadvanced", m_Misc.m_CheckAdvancedFiberOptionsBox);
m_Misc.m_CheckConstantRadiusBox = v1.second.get("constantradius", m_Misc.m_CheckConstantRadiusBox);
m_Misc.m_CheckIncludeFiducialsBox = v1.second.get("includeFiducials", m_Misc.m_CheckIncludeFiducialsBox);
switch (v1.second.get("distribution", 0))
{
case 0:
m_FiberGen.m_Distribution = FiberGenerationParameters::DISTRIBUTE_UNIFORM;
break;
case 1:
m_FiberGen.m_Distribution = FiberGenerationParameters::DISTRIBUTE_GAUSSIAN;
break;
default:
m_FiberGen.m_Distribution = FiberGenerationParameters::DISTRIBUTE_UNIFORM;
}
m_FiberGen.m_Variance = v1.second.get("variance", m_FiberGen.m_Variance);
m_FiberGen.m_Density = v1.second.get("density", m_FiberGen.m_Density);
m_FiberGen.m_Sampling = v1.second.get("spline.sampling", m_FiberGen.m_Sampling);
m_FiberGen.m_Tension = v1.second.get("spline.tension", m_FiberGen.m_Tension);
m_FiberGen.m_Continuity = v1.second.get("spline.continuity", m_FiberGen.m_Continuity);
m_FiberGen.m_Bias = v1.second.get("spline.bias", m_FiberGen.m_Bias);
m_FiberGen.m_Rotation[0] = v1.second.get("rotation.x", m_FiberGen.m_Rotation[0]);
m_FiberGen.m_Rotation[1] = v1.second.get("rotation.y", m_FiberGen.m_Rotation[1]);
m_FiberGen.m_Rotation[2] = v1.second.get("rotation.z", m_FiberGen.m_Rotation[2]);
m_FiberGen.m_Translation[0] = v1.second.get("translation.x", m_FiberGen.m_Translation[0]);
m_FiberGen.m_Translation[1] = v1.second.get("translation.y", m_FiberGen.m_Translation[1]);
m_FiberGen.m_Translation[2] = v1.second.get("translation.z", m_FiberGen.m_Translation[2]);
m_FiberGen.m_Scale[0] = v1.second.get("scale.x", m_FiberGen.m_Scale[0]);
m_FiberGen.m_Scale[1] = v1.second.get("scale.y", m_FiberGen.m_Scale[1]);
m_FiberGen.m_Scale[2] = v1.second.get("scale.z", m_FiberGen.m_Scale[2]);
}
else if ( v1.first == "image" )
{
m_Misc.m_SignalModelString = v1.second.get("signalmodelstring", m_Misc.m_SignalModelString);
m_Misc.m_ArtifactModelString = v1.second.get("artifactmodelstring", m_Misc.m_ArtifactModelString);
m_Misc.m_OutputPath = v1.second.get("outpath", m_Misc.m_OutputPath);
m_Misc.m_CheckOutputVolumeFractionsBox = v1.second.get("outputvolumefractions", m_Misc.m_CheckOutputVolumeFractionsBox);
m_Misc.m_CheckAdvancedSignalOptionsBox = v1.second.get("showadvanced", m_Misc.m_CheckAdvancedSignalOptionsBox);
m_Misc.m_CheckAddDistortionsBox = v1.second.get("artifacts.doAddDistortions", m_Misc.m_CheckAddDistortionsBox);
m_Misc.m_CheckAddNoiseBox = v1.second.get("artifacts.addnoise", m_Misc.m_CheckAddNoiseBox);
m_Misc.m_CheckAddGhostsBox = v1.second.get("artifacts.addghosts", m_Misc.m_CheckAddGhostsBox);
m_Misc.m_CheckAddAliasingBox = v1.second.get("artifacts.addaliasing", m_Misc.m_CheckAddAliasingBox);
m_Misc.m_CheckAddSpikesBox = v1.second.get("artifacts.addspikes", m_Misc.m_CheckAddSpikesBox);
m_Misc.m_CheckAddEddyCurrentsBox = v1.second.get("artifacts.addeddycurrents", m_Misc.m_CheckAddEddyCurrentsBox);
m_SignalGen.m_ImageRegion.SetSize(0, v1.second.get("basic.size.x",m_SignalGen.m_ImageRegion.GetSize(0)));
m_SignalGen.m_ImageRegion.SetSize(1, v1.second.get("basic.size.y",m_SignalGen.m_ImageRegion.GetSize(1)));
m_SignalGen.m_ImageRegion.SetSize(2, v1.second.get("basic.size.z",m_SignalGen.m_ImageRegion.GetSize(2)));
m_SignalGen.m_ImageSpacing[0] = v1.second.get("basic.spacing.x",m_SignalGen.m_ImageSpacing[0]);
m_SignalGen.m_ImageSpacing[1] = v1.second.get("basic.spacing.y",m_SignalGen.m_ImageSpacing[1]);
m_SignalGen.m_ImageSpacing[2] = v1.second.get("basic.spacing.z",m_SignalGen.m_ImageSpacing[2]);
m_SignalGen.m_ImageOrigin[0] = v1.second.get("basic.origin.x",m_SignalGen.m_ImageOrigin[0]);
m_SignalGen.m_ImageOrigin[1] = v1.second.get("basic.origin.y",m_SignalGen.m_ImageOrigin[1]);
m_SignalGen.m_ImageOrigin[2] = v1.second.get("basic.origin.z",m_SignalGen.m_ImageOrigin[2]);
m_SignalGen.m_ImageDirection[0][0] = v1.second.get("basic.direction.1",m_SignalGen.m_ImageDirection[0][0]);
m_SignalGen.m_ImageDirection[0][1] = v1.second.get("basic.direction.2",m_SignalGen.m_ImageDirection[0][1]);
m_SignalGen.m_ImageDirection[0][2] = v1.second.get("basic.direction.3",m_SignalGen.m_ImageDirection[0][2]);
m_SignalGen.m_ImageDirection[1][0] = v1.second.get("basic.direction.4",m_SignalGen.m_ImageDirection[1][0]);
m_SignalGen.m_ImageDirection[1][1] = v1.second.get("basic.direction.5",m_SignalGen.m_ImageDirection[1][1]);
m_SignalGen.m_ImageDirection[1][2] = v1.second.get("basic.direction.6",m_SignalGen.m_ImageDirection[1][2]);
m_SignalGen.m_ImageDirection[2][0] = v1.second.get("basic.direction.7",m_SignalGen.m_ImageDirection[2][0]);
m_SignalGen.m_ImageDirection[2][1] = v1.second.get("basic.direction.8",m_SignalGen.m_ImageDirection[2][1]);
m_SignalGen.m_ImageDirection[2][2] = v1.second.get("basic.direction.9",m_SignalGen.m_ImageDirection[2][2]);
m_SignalGen.m_SignalScale = v1.second.get("signalScale", m_SignalGen.m_SignalScale);
m_SignalGen.m_tEcho = v1.second.get("tEcho", m_SignalGen.m_tEcho);
m_SignalGen.m_tLine = v1.second.get("tLine", m_SignalGen.m_tLine);
m_SignalGen.m_tInhom = v1.second.get("tInhom", m_SignalGen.m_tInhom);
m_SignalGen.m_Bvalue = v1.second.get("bvalue", m_SignalGen.m_Bvalue);
m_SignalGen.m_SimulateKspaceAcquisition = v1.second.get("simulatekspace", m_SignalGen.m_SimulateKspaceAcquisition);
m_SignalGen.m_AxonRadius = v1.second.get("axonRadius", m_SignalGen.m_AxonRadius);
switch (v1.second.get("diffusiondirectionmode", 0))
{
case 0:
m_SignalGen.m_DiffusionDirectionMode = SignalGenerationParameters::FIBER_TANGENT_DIRECTIONS;
break;
case 1:
m_SignalGen.m_DiffusionDirectionMode = SignalGenerationParameters::MAIN_FIBER_DIRECTIONS;
break;
case 2:
m_SignalGen.m_DiffusionDirectionMode = SignalGenerationParameters::RANDOM_DIRECTIONS;
break;
default:
m_SignalGen.m_DiffusionDirectionMode = SignalGenerationParameters::FIBER_TANGENT_DIRECTIONS;
}
m_SignalGen.m_FiberSeparationThreshold = v1.second.get("fiberseparationthreshold", m_SignalGen.m_FiberSeparationThreshold);
m_SignalGen.m_Spikes = v1.second.get("artifacts.spikesnum", m_SignalGen.m_Spikes);
m_SignalGen.m_SpikeAmplitude = v1.second.get("artifacts.spikesscale", m_SignalGen.m_SpikeAmplitude);
m_SignalGen.m_KspaceLineOffset = v1.second.get("artifacts.kspaceLineOffset", m_SignalGen.m_KspaceLineOffset);
m_SignalGen.m_EddyStrength = v1.second.get("artifacts.eddyStrength", m_SignalGen.m_EddyStrength);
m_SignalGen.m_Tau = v1.second.get("artifacts.eddyTau", m_SignalGen.m_Tau);
m_SignalGen.m_CroppingFactor = v1.second.get("artifacts.aliasingfactor", m_SignalGen.m_CroppingFactor);
m_SignalGen.m_DoAddGibbsRinging = v1.second.get("artifacts.addringing", m_SignalGen.m_DoAddGibbsRinging);
m_SignalGen.m_DoSimulateRelaxation = v1.second.get("doSimulateRelaxation", m_SignalGen.m_DoSimulateRelaxation);
m_SignalGen.m_DoDisablePartialVolume = v1.second.get("doDisablePartialVolume", m_SignalGen.m_DoDisablePartialVolume);
m_SignalGen.m_DoAddMotion = v1.second.get("artifacts.doAddMotion", m_SignalGen.m_DoAddMotion);
m_SignalGen.m_DoRandomizeMotion = v1.second.get("artifacts.randomMotion", m_SignalGen.m_DoRandomizeMotion);
m_SignalGen.m_Translation[0] = v1.second.get("artifacts.translation0", m_SignalGen.m_Translation[0]);
m_SignalGen.m_Translation[1] = v1.second.get("artifacts.translation1", m_SignalGen.m_Translation[1]);
m_SignalGen.m_Translation[2] = v1.second.get("artifacts.translation2", m_SignalGen.m_Translation[2]);
m_SignalGen.m_Rotation[0] = v1.second.get("artifacts.rotation0", m_SignalGen.m_Rotation[0]);
m_SignalGen.m_Rotation[1] = v1.second.get("artifacts.rotation1", m_SignalGen.m_Rotation[1]);
m_SignalGen.m_Rotation[2] = v1.second.get("artifacts.rotation2", m_SignalGen.m_Rotation[2]);
// m_SignalGen.SetNumWeightedVolumes(v1.second.get("numgradients", m_SignalGen.GetNumWeightedVolumes()));
SignalGenerationParameters::GradientListType gradients;
BOOST_FOREACH( boost::property_tree::ptree::value_type const& v2, v1.second.get_child("gradients") )
{
SignalGenerationParameters::GradientType g;
g[0] = v2.second.get("x");
g[1] = v2.second.get("y");
g[2] = v2.second.get("z");
gradients.push_back(g);
}
m_SignalGen.SetGradienDirections(gradients);
try
{
if (v1.second.get("artifacts.noisetype")=="rice")
{
m_NoiseModel = new mitk::RicianNoiseModel();
m_NoiseModel->SetNoiseVariance(v1.second.get("artifacts.noisevariance"));
}
}
catch(...) {}
try
{
if (v1.second.get("artifacts.noisetype")=="chisquare")
{
m_NoiseModel = new mitk::ChiSquareNoiseModel();
m_NoiseModel->SetNoiseVariance(v1.second.get("artifacts.noisevariance"));
}
}
catch(...){ }
BOOST_FOREACH( boost::property_tree::ptree::value_type const& v2, v1.second.get_child("compartments") )
{
mitk::DiffusionSignalModel* signalModel = NULL;
std::string model = v2.second.get("model");
if (model=="stick")
{
mitk::StickModel* model = new mitk::StickModel();
model->SetDiffusivity(v2.second.get("d"));
model->SetT2(v2.second.get("t2"));
model->m_CompartmentId = v2.second.get("ID");
if (v2.second.get("type")=="fiber")
m_FiberModelList.push_back(model);
else if (v2.second.get("type")=="non-fiber")
m_NonFiberModelList.push_back(model);
signalModel = model;
}
else if (model=="tensor")
{
mitk::TensorModel* model = new mitk::TensorModel();
model->SetDiffusivity1(v2.second.get("d1"));
model->SetDiffusivity2(v2.second.get("d2"));
model->SetDiffusivity3(v2.second.get("d3"));
model->SetT2(v2.second.get("t2"));
model->m_CompartmentId = v2.second.get("ID");
if (v2.second.get("type")=="fiber")
m_FiberModelList.push_back(model);
else if (v2.second.get("type")=="non-fiber")
m_NonFiberModelList.push_back(model);
signalModel = model;
}
else if (model=="ball")
{
mitk::BallModel* model = new mitk::BallModel();
model->SetDiffusivity(v2.second.get("d"));
model->SetT2(v2.second.get("t2"));
model->m_CompartmentId = v2.second.get("ID");
if (v2.second.get("type")=="fiber")
m_FiberModelList.push_back(model);
else if (v2.second.get("type")=="non-fiber")
m_NonFiberModelList.push_back(model);
signalModel = model;
}
else if (model=="astrosticks")
{
mitk::AstroStickModel* model = new AstroStickModel();
model->SetDiffusivity(v2.second.get("d"));
model->SetT2(v2.second.get("t2"));
model->SetRandomizeSticks(v2.second.get("randomize"));
model->m_CompartmentId = v2.second.get("ID");
if (v2.second.get("type")=="fiber")
m_FiberModelList.push_back(model);
else if (v2.second.get("type")=="non-fiber")
m_NonFiberModelList.push_back(model);
signalModel = model;
}
else if (model=="dot")
{
mitk::DotModel* model = new mitk::DotModel();
model->SetT2(v2.second.get("t2"));
model->m_CompartmentId = v2.second.get("ID");
if (v2.second.get("type")=="fiber")
m_FiberModelList.push_back(model);
else if (v2.second.get("type")=="non-fiber")
m_NonFiberModelList.push_back(model);
signalModel = model;
}
else if (model=="prototype")
{
mitk::RawShModel* model = new mitk::RawShModel();
model->SetMaxNumKernels(v2.second.get("maxNumSamples"));
model->SetFaRange(v2.second.get("minFA"), v2.second.get("maxFA"));
model->SetAdcRange(v2.second.get("minADC"), v2.second.get("maxADC"));
model->m_CompartmentId = v2.second.get("ID");
unsigned int numCoeffs = v2.second.get("numCoeffs");
unsigned int numSamples = v2.second.get("numSamples");
for (unsigned int j=0; j coeffs(numCoeffs);
for (unsigned int k=0; k("kernels."+boost::lexical_cast(j)+".coeffs."+boost::lexical_cast(k));
}
model->SetShCoefficients( coeffs, v2.second.get("kernels."+boost::lexical_cast(j)+".B0") );
}
if (v2.second.get("type")=="fiber")
m_FiberModelList.push_back(model);
else if (v2.second.get("type")=="non-fiber")
m_NonFiberModelList.push_back(model);
signalModel = model;
}
if (signalModel!=NULL)
{
signalModel->SetGradientList(gradients);
try{
itk::ImageFileReader::Pointer reader = itk::ImageFileReader::New();
reader->SetFileName(filename+"_VOLUME"+v2.second.get("ID")+".nrrd");
reader->Update();
signalModel->SetVolumeFractionImage(reader->GetOutput());
}
catch(...)
{
}
}
}
}
}
try{
itk::ImageFileReader::Pointer reader = itk::ImageFileReader::New();
reader->SetFileName(filename+"_FMAP.nrrd");
reader->Update();
m_SignalGen.m_FrequencyMap = reader->GetOutput();
}
catch(...)
{
MITK_INFO << "No frequency map saved.";
}
try{
itk::ImageFileReader::Pointer reader = itk::ImageFileReader::New();
reader->SetFileName(filename+"_MASK.nrrd");
reader->Update();
m_SignalGen.m_MaskImage = reader->GetOutput();
}
catch(...)
{
MITK_INFO << "No mask image saved.";
}
}
template< class ScalarType >
void mitk::FiberfoxParameters< ScalarType >::PrintSelf()
{
MITK_INFO << "Not implemented :(";
}
diff --git a/Modules/DiffusionImaging/Quantification/CMakeLists.txt b/Modules/DiffusionImaging/Quantification/CMakeLists.txt
index 434d7cdf06..4c677be959 100644
--- a/Modules/DiffusionImaging/Quantification/CMakeLists.txt
+++ b/Modules/DiffusionImaging/Quantification/CMakeLists.txt
@@ -1,9 +1,14 @@
+# With apple gcc 4.2.1 the following waring leads to an build error if boost is enabled
+if(APPLE)
+ mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=empty-body" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+endif()
+
#DiffusionImaging/Quantification
MITK_CREATE_MODULE(
SUBPROJECTS MITK-DTI
INCLUDE_DIRS Algorithms IODataStructures IODataStructures/TbssImages Rendering ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS MitkDiffusionCore MitkFiberTracking MitkGraphAlgorithms
WARNINGS_AS_ERRORS
)
add_subdirectory(Testing)