Commit c5152df1 authored by Marc Modat's avatar Marc Modat

p9-percent-parsing-aladin change the parsing argument for inlier and variance in aladin

parent 6d367767
project(NiftyReg)
#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.0)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.8\\.0$")
cmake_minimum_required(VERSION 2.8.8)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.8\\.8$")
mark_as_advanced(FORCE CMAKE_BACKWARDS_COMPATIBILITY)
else("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.8\\.0$")
else("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.8\\.8$")
mark_as_advanced(CLEAR CMAKE_BACKWARDS_COMPATIBILITY)
endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.8\\.0$")
endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.8\\.8$")
#-----------------------------------------------------------------------------
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message("In-source builds not allowed by NiftyReg police.")
message("Please create a new directory (called a build directory) and run CMake from there.")
message(FATAL_ERROR "You may need to remove CMakeCache.txt and CMakeFiles.")
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
#-----------------------------------------------------------------------------
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif(NOT CMAKE_BUILD_TYPE)
#-----------------------------------------------------------------------------
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower)
if(NOT cmake_build_type_tolower STREQUAL "debug"
......@@ -23,24 +26,27 @@ if(NOT cmake_build_type_tolower STREQUAL "debug"
AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")
message("Unknown build type \"${CMAKE_BUILD_TYPE}\".")
message(FATAL_ERROR "Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).")
endif()
endif(NOT cmake_build_type_tolower STREQUAL "debug"
AND NOT cmake_build_type_tolower STREQUAL "release"
AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")
if(cmake_build_type_tolower STREQUAL "debug")
set(DEBUG_MODE ON)
elseif(cmake_build_type_tolower STREQUAL "release")
set(DEBUG_MODE OFF)
endif(cmake_build_type_tolower STREQUAL "debug")
#-----------------------------------------------------------------------------
set(NiftyReg_VERSION_MAJOR 1)
set(NiftyReg_VERSION_MINOR 4)
set(NiftyReg_VERSION_PATCH 0)
#-----------------------------------------------------------------------------
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.8\\.12$")
cmake_policy(SET CMP0022 OLD)
endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.8\\.12$")
endif(COMMAND cmake_policy)
#-----------------------------------------------------------------------------
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_definitions(/W1)
else(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_definitions(-fPIC)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
#-----------------------------------------------------------------------------
option(BUILD_TESTING "To build the unit tests" ON)
option(BUILD_NR_SLICER_EXT "Where NiftyReg meets 3DSlicer" ${NiftyRegExtension_BUILD_SLICER_EXTENSION})
......@@ -51,10 +57,12 @@ option(USE_OPENMP "To use openMP for multi-CPU processing" ON)
option(BUILD_SHARED_LIBS "Build the libraries as shared" OFF)
option(USE_CUDA "To enable CUDA for a GPU implementation of the code" OFF)
option(BUILD_ALL_DEP "All the dependencies are build" OFF)
#-----------------------------------------------------------------------------
if(WIN32)
set(BUILD_ALL_DEP ON CACHE BOOL "All the dependencies are build" FORCE)
endif(WIN32)
#-----------------------------------------------------------------------------
# All dependencies are build to create the 3DSlicer package
if(BUILD_NR_SLICER_EXT)
......@@ -63,6 +71,7 @@ if(BUILD_NR_SLICER_EXT)
else(BUILD_NR_SLICER_EXT)
mark_as_advanced(CLEAR BUILD_ALL_DEP)
endif(BUILD_NR_SLICER_EXT)
#-----------------------------------------------------------------------------
# Z library
# Try first to find the z library on the system and built is from the sources if it can not be find
......@@ -78,6 +87,7 @@ if(NOT BUILD_ALL_DEP)
else(NOT BUILD_ALL_DEP)
include_directories(${CMAKE_SOURCE_DIR}/reg-io/zlib)
endif(NOT BUILD_ALL_DEP)
#-----------------------------------------------------------------------------
# Try to find the png library and header on the system
if(NOT BUILD_ALL_DEP)
......@@ -110,6 +120,7 @@ else(NOT BUILD_ALL_DEP)
endif(NOT BUILD_ALL_DEP)
include_directories(${CMAKE_SOURCE_DIR}/reg-io/png)
include_directories(${PNG_INCLUDE_DIR})
#-----------------------------------------------------------------------------
include_directories(${CMAKE_SOURCE_DIR}/reg-lib)
include_directories(${CMAKE_SOURCE_DIR}/reg-io)
......@@ -118,6 +129,7 @@ include_directories(${CMAKE_SOURCE_DIR}/third-party)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/reg-io/nrrd)
include_directories(${CMAKE_SOURCE_DIR}/reg-io/nrrd/NrrdIO)
#-----------------------------------------------------------------------------
if(USE_DOUBLE)
if(USE_SSE)
......@@ -132,12 +144,14 @@ if(USE_DOUBLE)
endif(USE_CUDA)
add_definitions(-D_USE_NR_DOUBLE)
endif(USE_DOUBLE)
#-----------------------------------------------------------------------------
if(USE_SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse")
add_definitions(-D_USE_SSE)
endif(USE_SSE)
#-----------------------------------------------------------------------------
if(USE_OPENMP)
find_package(OpenMP)
......@@ -149,6 +163,7 @@ if(USE_OPENMP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif(NOT OPENMP_FOUND)
endif(USE_OPENMP)
#-----------------------------------------------------------------------------
if(BUILD_SHARED_LIBS)
if(USE_CUDA)
......@@ -161,58 +176,66 @@ if(BUILD_SHARED_LIBS)
else(BUILD_SHARED_LIBS)
set(NIFTYREG_LIBRARY_TYPE STATIC)
endif(BUILD_SHARED_LIBS)
#-----------------------------------------------------------------------------
if(USE_CUDA)
# Check if the CUDA driver are available
find_package(CUDA)
mark_as_advanced(CUDA_SDK_ROOT_DIR)
if(CUDA_FOUND)
# Display the CUDA version
message(STATUS "The CUDA version you have is v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}")
# Compile an executable to check if there is at least one suitable graphical card
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cuda/checkCudaCard.cpp
CMAKE_FLAGS
-DINCLUDE_DIRECTORIES:STRING=${CUDA_INCLUDE_DIRS}
-DLINK_LIBRARIES:STRING=${CUDA_LIBRARIES}
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT_VAR
RUN_OUTPUT_VARIABLE RUN_OUTPUT_VAR
)
# Check if the executable could not compile
if(NOT COMPILE_RESULT_VAR)
message(WARNING "The code to check the presence of a CUDA-enabled card failed.")
message(WARNING "The USE_CUDA flag has been turned OFF.")
set(USE_CUDA OFF CACHE BOOL "To enable CUDA for a GPU implementation of the code" FORCE)
else(NOT COMPILE_RESULT_VAR)
# Check if the executable return failure
if(RUN_RESULT_VAR)
message(WARNING "No CUDA-enabled card has been detected\nResult message: ${RUN_RESULT_VAR}\nError message: ${RUN_OUTPUT_VAR}\nThe USE_CUDA flag has been turned OFF.")
set(USE_CUDA OFF CACHE BOOL "To enable CUDA for a GPU implementation of the code" FORCE)
else(RUN_RESULT_VAR)
# Check if ptxas information should be displayed
set(CUDA_CAPABILITY "" CACHE STRING "CUDA capability to use to generate the ptxas information (1.0, 2.0, 3.0) [0]")
mark_as_advanced(FORCE CUDA_CAPABILITY)
if(CUDA_CAPABILITY EQUAL "1.0")
set(CUDA_NVCC_FLAGS
"${CUDA_NVCC_FLAGS} --ptxas-options=-v --generate-code arch=compute_10,code=sm_10")
elseif(CUDA_CAPABILITY EQUAL "2.0")
set(CUDA_NVCC_FLAGS
"${CUDA_NVCC_FLAGS} --ptxas-options=-v --generate-code arch=compute_20,code=sm_20")
elseif(CUDA_CAPABILITY EQUAL "3.0")
set(CUDA_NVCC_FLAGS
"${CUDA_NVCC_FLAGS} --ptxas-options=-v --generate-code arch=compute_30,code=sm_30")
endif(CUDA_CAPABILITY EQUAL "1.0")
# The CUDA implementation is used
add_definitions(-D_USE_CUDA)
message(STATUS "Found CUDA and a CUDA-enabled card - the GPU code will be compiled.")
endif(RUN_RESULT_VAR)
endif(NOT COMPILE_RESULT_VAR)
# Check if the CUDA driver are available
find_package(CUDA)
mark_as_advanced(CUDA_SDK_ROOT_DIR)
if(CUDA_FOUND)
# Display the CUDA version
message(STATUS "The CUDA version you have is v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}")
# Compile an executable to check if there is at least one suitable graphical card
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cuda/checkCudaCard.cpp
CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=${CUDA_INCLUDE_DIRS} -DLINK_LIBRARIES:STRING=${CUDA_LIBRARIES}
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT_VAR
RUN_OUTPUT_VARIABLE RUN_OUTPUT_VAR
)
# Check if the executable could not compile
if(NOT COMPILE_RESULT_VAR)
message(WARNING "The code to check the presence of a CUDA-enabled card failed.")
message(WARNING "The USE_CUDA flag has been turned OFF.")
set(USE_CUDA OFF CACHE BOOL "To enable CUDA for a GPU implementation of the code" FORCE)
# Check if the executable return failure
elseif(RUN_RESULT_VAR)
message(WARNING "No CUDA-enabled card has been detected\nResult code: ${RUN_RESULT_VAR}\nError message: ${RUN_OUTPUT_VAR}\nThe USE_CUDA flag has been turned OFF.")
set(USE_CUDA OFF CACHE BOOL "To enable CUDA for a GPU implementation of the code" FORCE)
else(NOT COMPILE_RESULT_VAR)
message(STATUS "Found CUDA and a CUDA-enabled card: ${RUN_OUTPUT_VAR}")
set(CUDA_NVCC_FLAGS "")
#check cuda version and adjust compile flags
if(RUN_OUTPUT_VAR EQUAL "1.0")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_10,code=sm_10")
elseif(RUN_OUTPUT_VAR EQUAL "2.0")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_20,code=sm_20")
elseif(RUN_OUTPUT_VAR EQUAL "3.0")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_30,code=sm_30")
elseif(RUN_OUTPUT_VAR EQUAL "3.5")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_35,code=sm_35")
elseif(RUN_OUTPUT_VAR EQUAL "5.0")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_50,code=sm_50")
endif(RUN_OUTPUT_VAR EQUAL "1.0")
#adjust for debug and release versions
if(DEBUG_MODE)
#common debug flags for all architectures
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --ptxas-options=-v -g -G -lineinfo")
else(DEBUG_MODE)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -use_fast_math -O3 -Xcompiler")
endif(DEBUG_MODE)
message(STATUS "NVCC Debug: ${DEBUG_MODE} | NVCC Flags: ${CUDA_NVCC_FLAGS}")
# The CUDA implementation is used
add_definitions(-D_USE_CUDA)
endif(NOT COMPILE_RESULT_VAR)
else(CUDA_FOUND)
set(USE_CUDA OFF CACHE BOOL "To enable CUDA for a GPU implementation of the code" FORCE)
message(WARNING "CUDA is not compatible with shared libraries. Forcing BUILD_SHARED_LIBS to OFF")
endif(CUDA_FOUND)
set(USE_CUDA OFF CACHE BOOL "To enable CUDA for a GPU implementation of the code" FORCE)
message(WARNING "CUDA is not compatible with shared libraries. Forcing BUILD_SHARED_LIBS to OFF")
endif(CUDA_FOUND)
endif(USE_CUDA)
#-----------------------------------------------------------------------------
find_package(Git)
if(GIT_FOUND)
......@@ -232,6 +255,7 @@ if(GIT_FOUND)
else(GIT_FOUND)
add_definitions(-D_GIT_HASH="${NiftyReg_VERSION_MAJOR}.${NiftyReg_VERSION_MINOR}.${NiftyReg_VERSION_PATCH}")
endif(GIT_FOUND)
#-----------------------------------------------------------------------------
subdirs(reg-io)
subdirs(reg-lib)
......@@ -242,6 +266,7 @@ if(BUILD_TESTING)
include(${CMAKE_ROOT}/Modules/Dart.cmake)
subdirs(reg-test)
endif(BUILD_TESTING)
#-----------------------------------------------------------------------------
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
......@@ -254,6 +279,7 @@ if(DOXYGEN_FOUND)
)
message(STATUS "Found doxygen")
endif(DOXYGEN_FOUND)
#-----------------------------------------------------------------------------
# The package is only build if 3DSlicer package is not build as well
if(NOT BUILD_NR_SLICER_EXT)
......
......@@ -76,15 +76,15 @@ void Usage(char *exec)
printf("\t-interp\t\t\tInterpolation order to use internally to warp the floating image.\n");
printf("\t-iso\t\t\tMake floating and reference images isotropic if required.\n");
printf("\t-%%v <int>\t\tPercentage of blocks to use in the optimisation scheme. [50]\n");
printf("\t-%%i <int>\t\tPercentage of blocks to consider as inlier in the optimisation scheme. [50]\n");
printf("\t-pv <int>\t\tPercentage of blocks to use in the optimisation scheme. [50]\n");
printf("\t-pi <int>\t\tPercentage of blocks to consider as inlier in the optimisation scheme. [50]\n");
#if defined (_OPENMP)
printf("\t-omp <int>\t\tNumber of thread to use with OpenMP. [%i]\n",
omp_get_num_procs());
#endif
printf("\t-voff\t\t\tTurns verbose off [on]\n");
#ifdef _GIT_HASH
printf("\n\t-v\t\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
printf("\n\t--version\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
......@@ -244,7 +244,7 @@ int main(int argc, char **argv)
{
alignCentre=0;
}
else if(strcmp(argv[i], "-%v")==0 || strcmp(argv[i], "--vv")==0)
else if(strcmp(argv[i], "-%v")==0 || strcmp(argv[i], "--pv")==0)
{
float value=atof(argv[++i]);
if(value<0.f || value>100.f){
......@@ -253,7 +253,7 @@ int main(int argc, char **argv)
}
blockPercentage=value;
}
else if(strcmp(argv[i], "-%i")==0 || strcmp(argv[i], "--ii")==0)
else if(strcmp(argv[i], "-%i")==0 || strcmp(argv[i], "--pi")==0)
{
float value=atof(argv[++i]);
if(value<0.f || value>100.f){
......
......@@ -166,7 +166,7 @@ char xml_aladin[] =
" </integer>\n"
" <float>\n"
" <name>blockPercentage</name>\n"
" <longflag>vv</longflag>\n"
" <longflag>pv</longflag>\n"
" <description>Percentage of blocks to use in the optimisation scheme</description>\n"
" <label>Percentage block</label>\n"
" <default>50</default>\n"
......@@ -178,7 +178,7 @@ char xml_aladin[] =
" </float>\n"
" <float>\n"
" <name>inlierPercentage</name>\n"
" <longflag>ii</longflag>\n"
" <longflag>pi</longflag>\n"
" <description>Percentage of blocks to consider as inlier in the optimisation scheme</description>\n"
" <label>Percentage inlier</label>\n"
" <default>50</default>\n"
......
......@@ -48,7 +48,7 @@ void usage(char *exec)
printf("\t-demean2 <referenceImage> <NonRigidTrans1> <floatingImage1> ... <NonRigidTransN> <floatingImageN>\n");
printf("\t-demean3 <referenceImage> <AffineMat1> <NonRigidTrans1> <floatingImage1> ... <AffineMatN> <NonRigidTransN> <floatingImageN>\n\n");
#ifdef _GIT_HASH
printf("\n\t-v\tPrint current source code git hash key and exit\n\t\t(%s)\n",_GIT_HASH);
printf("\n\t--version\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
}
......
......@@ -161,7 +161,7 @@ void Usage(char *exec)
printf("\t-voff\t\t\tTo turn verbose off\n");
#ifdef _GIT_HASH
printf("\t-v\t\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
printf("\n\t--version\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf("For further description of the penalty term, use: %s -helpPenalty\n", exec);
......
......@@ -119,7 +119,7 @@ void Usage(char *exec)
printf("\t-jacL <filename>\n");
printf("\t\tFilename of the Log of the Jacobian determinant map.\n");
#ifdef _GIT_HASH
printf("\n\t-v\tPrint current source code git hash key and exit\n\t\t(%s)\n",_GIT_HASH);
printf("\n\t--version\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
......
......@@ -66,7 +66,7 @@ void Usage(char *exec)
printf("\t-nmi\t\tReturns the NMI value (64 bins are used)\n");
printf("\t-ssd\t\tReturns the SSD value\n");
#ifdef _GIT_HASH
printf("\n\t-v\t\tPrint current source code git hash key and exit\n\t\t\t(%s)\n",_GIT_HASH);
printf("\n\t--version\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
......
......@@ -68,7 +68,7 @@ void Usage(char *exec)
printf("\t-tensor\n\t\tThe last six timepoints of the floating image are considered to be tensor order as XX, XY, YY, XZ, YZ, ZZ [off]\n");
printf("\t-voff\n\t\tTurns verbose off [on]\n");
#ifdef _GIT_HASH
printf("\t-v\n\t\tPrint current source code git hash key and exit\n\t\t(%s)\n",_GIT_HASH);
printf("\n\t--version\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
......
......@@ -90,7 +90,7 @@ void Usage(char *exec)
printf("\t-iso\t\t\tThe resulting image is made isotropic\n");
printf("\t-noscl\t\t\tThe scl_slope and scl_inter are set to 1 and 0 respectively\n");
#ifdef _GIT_HASH
printf("\n\t-v\t\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
printf("\n\t--version\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
......
......@@ -132,7 +132,7 @@ void Usage(char *exec)
printf("\t\tfilename4 - Output affine transformation file name\n\n");
#ifdef _GIT_HASH
printf("\t-v\tPrint current source code git hash key and exit\n\t\t(%s)\n\n",_GIT_HASH);
printf("\n\t--version\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("\t* The supported transformation types are:\n");
......
......@@ -15,14 +15,14 @@ endforeach(NAME)
#-----------------------------------------------------------------------------
set(LIST _reg_tools)
foreach(NAME ${LIST})
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} ${NAME}.h ${NAME}.cpp)
target_link_libraries(${NAME} _reg_maths reg_nifti)
install(TARGETS ${NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${NAME}.h DESTINATION include)
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} ${NAME}.h ${NAME}.cpp)
target_link_libraries(${NAME} _reg_maths reg_nifti)
install(TARGETS ${NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${NAME}.h DESTINATION include)
endforeach(NAME)
#-----------------------------------------------------------------------------
set(LIST _reg_globalTransformation)
......@@ -36,14 +36,14 @@ set(LIST ${LIST} _reg_dti)
set(LIST ${LIST} _reg_blockMatching)
set(LIST ${LIST} _reg_femTransformation)
foreach(NAME ${LIST})
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} ${NAME}.h ${NAME}.cpp)
target_link_libraries(${NAME} _reg_tools _reg_maths _reg_globalTransformation)
install(TARGETS ${NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${NAME}.h DESTINATION include)
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} ${NAME}.h ${NAME}.cpp)
target_link_libraries(${NAME} _reg_tools _reg_maths)
install(TARGETS ${NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${NAME}.h DESTINATION include)
endforeach(NAME)
install(FILES _reg_measure.h DESTINATION include)
#-----------------------------------------------------------------------------
......@@ -111,31 +111,97 @@ if(USE_CUDA)
#-----------------------------------------------------------------------------
endif(USE_CUDA)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
## BUILD THE F3D LIBRARY CPU OR GPU
set(NAME _reg_f3d)
if(USE_CUDA)
#-----------------------------------------------------------------------------
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
cuda_add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} _reg_base.h _reg_base.cpp ${NAME}.h ${NAME}.cpp ${NAME}_sym.h ${NAME}_sym.cpp ${NAME}2.h ${NAME}2.cpp ${NAME}_gpu.h ${NAME}_gpu.cpp)
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
cuda_add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} _reg_base.h _reg_base.cpp ${NAME}.h ${NAME}.cpp ${NAME}_sym.h ${NAME}_sym.cpp ${NAME}2.h ${NAME}2.cpp ${NAME}_gpu.h ${NAME}_gpu.cpp)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(${NAME} _reg_localTransformation _reg_resampling _reg_globalTransformation _reg_KLdivergence _reg_ssd _reg_nmi _reg_dti _reg_lncc _reg_optimiser _reg_tools _reg_ReadWriteImage _reg_optimiser_gpu _reg_localTransformation_gpu _reg_resampling_gpu _reg_globalTransformation_gpu _reg_nmi_gpu _reg_ssd_gpu _reg_tools_gpu _reg_common_gpu)
cuda_add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE}
_reg_base.h
_reg_base.cpp
${NAME}.h
${NAME}.cpp
${NAME}_sym.h
${NAME}_sym.cpp
${NAME}2.h
${NAME}2.cpp
${NAME}_gpu.h
${NAME}_gpu.cpp)
target_link_libraries(${NAME}
_reg_localTransformation
_reg_resampling
_reg_globalTransformation
_reg_KLdivergence
_reg_ssd
_reg_nmi
_reg_dti
_reg_lncc
_reg_optimiser
_reg_tools
_reg_ReadWriteImage
_reg_optimiser_gpu
_reg_localTransformation_gpu
_reg_resampling_gpu
_reg_globalTransformation_gpu
_reg_nmi_gpu
_reg_ssd_gpu
_reg_tools_gpu
_reg_common_gpu)
install(FILES ${NAME}_gpu.h ${NAME}_gpu.cpp DESTINATION include)
#-----------------------------------------------------------------------------
else(USE_CUDA)
#-----------------------------------------------------------------------------
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_library(${NAME} SHARED _reg_base.h _reg_base.cpp ${NAME}.h ${NAME}.cpp ${NAME}2.h ${NAME}2.cpp ${NAME}_sym.h ${NAME}_sym.cpp)
add_library(${NAME} SHARED
_reg_base.h
_reg_base.cpp
${NAME}.h
${NAME}.cpp
${NAME}2.h
${NAME}2.cpp
${NAME}_sym.h
${NAME}_sym.cpp)
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} _reg_base.h _reg_base.cpp ${NAME}.h ${NAME}.cpp ${NAME}2.h ${NAME}2.cpp ${NAME}_sym.h ${NAME}_sym.cpp)
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE}
_reg_base.h
_reg_base.h
_reg_base.cpp
${NAME}.h
${NAME}.cpp
${NAME}2.h
${NAME}2.cpp
${NAME}_sym.h
${NAME}_sym.cpp)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(${NAME} _reg_localTransformation _reg_resampling _reg_globalTransformation _reg_lncc _reg_dti _reg_KLdivergence _reg_ssd _reg_nmi _reg_optimiser _reg_tools _reg_ReadWriteImage)
#-----------------------------------------------------------------------------
target_link_libraries(${NAME}
_reg_localTransformation
_reg_resampling
_reg_globalTransformation
_reg_lncc
_reg_dti
_reg_KLdivergence
_reg_ssd _reg_nmi
_reg_optimiser
_reg_tools
_reg_ReadWriteImage)
endif(USE_CUDA)
#-----------------------------------------------------------------------------
install(TARGETS ${NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
......@@ -144,50 +210,26 @@ install(TARGETS ${NAME}
install(FILES ${NAME}.h ${NAME}.cpp DESTINATION include)
install(FILES ${NAME}2.h ${NAME}2.cpp DESTINATION include)
install(FILES ${NAME}_sym.h ${NAME}_sym.cpp DESTINATION include)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
## BUILD THE ALADIN LIBRARY CPU
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
set(NAME _reg_aladin)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_library(${NAME} SHARED
${NAME}.h
${NAME}.cpp
${NAME}_sym.h
${NAME}_sym.cpp
)
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE}
${NAME}.h
${NAME}.cpp
${NAME}_sym.h
${NAME}_sym.cpp
)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(${NAME}
......@@ -200,13 +242,11 @@ target_link_libraries(${NAME}
_reg_tools
_reg_ReadWriteImage
)
install(TARGETS ${NAME}
RUNTIME DESTINATION lib
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${NAME}.h ${NAME}_sym.h ${NAME}.cpp ${NAME}_sym.cpp _reg_macros.h DESTINATION include)
#-----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment