diff --git a/CMakeLists.txt b/CMakeLists.txt index 446765a35fdae193ac299ef1cad09b6774fc4804..321fcfe4c922ea4bb640031ac7aa02b943a6f257 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,15 +67,24 @@ SET(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_ # => Comment for OTB 2.6.0 -#OPTION(BUILD_TESTING "Build testing." OFF) +OPTION(BUILD_TESTING "Build testing." OFF) +#----------------------------------------------------------------------------- +# OTB build configuration options. +IF(WIN32) +# do not build shared lib under windows +SET(BUILD_SHARED_LIBS OFF) +MESSAGE("Disabling build shared lib option on windows like OS.") +ELSE(WIN32) +OPTION(BUILD_SHARED_LIBS "Build OTB with shared libraries." ON) +ENDIF(WIN32) +SET(OTB_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) #----------------------------------------------------------------------------- # Case for release 2.2.1 # Use the openjpeg library. OPTION(OTB_USE_JPEG2000 "Use to support jpeg2000 image file format." ON) -#MARK_AS_ADVANCED(OTB_USE_JPEG2000) #----------------------------------------------------------------------------- @@ -88,19 +97,13 @@ OPTION(OTB_USE_JPEG2000 "Use to support jpeg2000 image file format." ON) OPTION(OTB_USE_EXTERNAL_EXPAT "Use an outside build of EXPAT." OFF) MARK_AS_ADVANCED(OTB_USE_EXTERNAL_EXPAT) -#SET(OTB_COMPILE_EXPAT ${OTB_USE_EXTERNAL_EXPAT}) + IF(OTB_USE_EXTERNAL_EXPAT) FIND_PACKAGE(EXPAT) IF(EXPAT_FOUND) # Control expat compatibility INCLUDE_DIRECTORIES(BEFORE ${EXPAT_INCLUDE_DIR}) LINK_DIRECTORIES( ${EXPAT_LIBRARY} ) -# TRY_COMPILE(OTB_TYPE_COMPILE_EXPAT -# ${OTB_BINARY_DIR}/CMakeTmp -# ${OTB_SOURCE_DIR}/CMake/otbTestCompileExpat.cxx ) -# IF( NOT OTB_TYPE_COMPILE_EXPAT) -# SET(OTB_USE_EXTERNAL_EXPAT OFF) -# ENDIF( NOT OTB_TYPE_COMPILE_EXPAT) ELSE(EXPAT_FOUND) MESSAGE(FATAL_ERROR "Cannot build OTB project without lib EXPAT. Please set EXPAT_DIR or set OTB_USE_EXTERNAL_EXPAT OFF to use INTERNAL EXPAT set on OTB/Utilities repository.") @@ -210,7 +213,7 @@ IF(OTB_USE_VISU_GUI) IF( NOT OPENGL_FOUND ) MESSAGE(FATAL_ERROR "Impossible to find OpenGL on your system.\nCannot build OTB Visu module without OpenGL library.\nInstall OpenGL on your system OR set OTB_USE_VISU to OFF to disable OTB Visu module generation !") - ENDIF( NOT OPENGL_FOUND ) + ENDIF( NOT OPENGL_FOUND ) IF( NOT OPENGL_GLU_FOUND ) MESSAGE(FATAL_ERROR "Impossible to find GLU library on your system.\nCannot build OTB Visu module without GLU library.\nInstall GLU library on your system OR set OTB_USE_VISU to OFF to disable OTB Visu module generation !") ENDIF( NOT OPENGL_GLU_FOUND ) @@ -218,17 +221,6 @@ IF(OTB_USE_VISU_GUI) IF(OPENGL_INCLUDE_DIR) INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) ENDIF(OPENGL_INCLUDE_DIR) - -# INCLUDE(CheckIncludeFiles) -# CHECK_INCLUDE_FILES("GL/glu.h" HAVE_GL_GLU_H) -# IF ( NOT HAVE_GL_GLU_H ) -# FIND_PATH(OTB_GLU_INCLUDE_PATH "GL/glu.h" ${OPENGL_INCLUDE_PATH}) -# IF(NOT OTB_GLU_INCLUDE_PATH) -# SET(OTB_GLU_INCLUDE_PATH "") -# MESSAGE("Impossible to find GLU files (include lib), detected by the FIND_PACKAGE(OpenGL) command.\nCannot build OTB Visu module without GLU library.\n=> You must install GLU (Mesa package, etc.) on your system OR set OTB_USE_VISU to OFF to disable OTB Visu module generation !") -# ENDIF(NOT OTB_GLU_INCLUDE_PATH) -# ENDIF ( NOT HAVE_GL_GLU_H ) - #------------------------------- # FLTK Library @@ -281,17 +273,6 @@ OPTION(OTB_USE_CURL "Use curl library." OFF) MARK_AS_ADVANCED(OTB_USE_CURL) IF(OTB_USE_CURL) -# INCLUDE(CheckIncludeFiles) -# INCLUDE(CheckLibraryExists) -# CHECK_INCLUDE_FILES("curl/curl.h" OTB_HAVE_CURL_HEADER) -# CHECK_LIBRARY_EXISTS("curl" "curl_easy_init" "" OTB_HAVE_CURL_LIBRARY) -# IF( NOT OTB_HAVE_CURL_HEADER ) -# MESSAGE("Cannot find CURL include directory. Please set CURL_INCLUDE_DIRS or SET OTB_USE_CURL OFF.") -# ENDIF( NOT OTB_HAVE_CURL_HEADER) -# IF( NOT OTB_HAVE_CURL_LIBRARY ) -# MESSAGE("Cannot find CURL include directory. Please set CURL_LIBRARY_DIRS or SET OTB_USE_CURL OFF.") -# ENDIF( NOT OTB_HAVE_CURL_LIBRARY) - FIND_PATH(CURL_INCLUDE_DIR curl/curl.h PATHS) MARK_AS_ADVANCED(CURL_INCLUDE_DIR) IF (NOT CURL_INCLUDE_DIR) @@ -442,20 +423,6 @@ INCLUDE_DIRECTORIES( ${OTB_LIBRARY_PATH} ) # Put "." in the rpath of all OTB shared libraries. LINK_DIRECTORIES(.) -#----------------------------------------------------------------------------- -# OTB build configuration options. -OPTION(BUILD_SHARED_LIBS "Build OTB with shared libraries." ON) -SET(OTB_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) - -# => Comment for OTB 2.6.0 -# Options for building some of the most common core templates explicitly only -# once. This has only been tested on gcc compilers. -# OPTION(OTB_EXPLICIT_INSTANTIATION "BETA-Try to explicitly build some of the core templates explictitly rather than over and over again." OFF) -# MARK_AS_ADVANCED(OTB_EXPLICIT_INSTANTIATION) -# IF( OTB_EXPLICIT_INSTANTIATION ) -# ADD_DEFINITIONS(-DOTB_EXPLICIT_INSTANTIATION) -# ENDIF( OTB_EXPLICIT_INSTANTIATION ) - #----------------------------------------------------------------------------- # Option for display all developpment message !!! OPTION(OTB_SHOW_ALL_MSG_DEBUG "OTB developers : Show all messages (debug, dev, etc...) use only for otb developers." OFF) @@ -500,21 +467,10 @@ INCLUDE(${OTB_SOURCE_DIR}/Wrapping/otbWrapSetup.cmake) OPTION(OTB_USE_PATENTED "Build patented examples. ITK must be genereted whith patented option (ITK_USE_PATENTED = ON)." OFF) MARK_AS_ADVANCED(OTB_USE_PATENTED) - -IF(WIN32) - IF(BUILD_SHARED_LIBS) - SET(OTB_COMMON_BUILD_TYPE "SHARED") - ELSE(BUILD_SHARED_LIBS) - SET(OTB_COMMON_BUILD_TYPE "STATIC") - ENDIF(BUILD_SHARED_LIBS) - SET(BUILD_SHARED_LIBS OFF) -ENDIF(WIN32) - - IF(OTB_USE_VISU_GUI) SET(OTB_VISU_GUI_LIBRARIES "${FLTK_LIBRARIES};${OPENGL_LIBRARIES};${FLTK_PLATFORM_DEPENDENT_LIBS}") IF(APPLE) - SET(OTB_VISU_GUI_LIBRARIES "${OTB_VISU_GUI_LIBRARIES} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib ") + SET(OTB_VISU_GUI_LIBRARIES "${OTB_VISU_GUI_LIBRARIES};-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib") ENDIF(APPLE) ELSE(OTB_USE_VISU_GUI) SET(OTB_VISU_GUI_LIBRARIES "") @@ -528,9 +484,7 @@ ENDIF(OTB_USE_VISU_GUI) # Use OTB_ALLS_UTILITIES_DEPENDENT_LIBRARIES to LINK Utilities Algo libraries into your executable # => Create OTB_IO_UTILITIES_DEPENDENT_LIBRARIES -#SET(OTB_IO_UTILITIES_DEPENDENT_LIBRARIES "gdal dxf otbkml tinyXML otbgeotiff otbxtiff otbossim otbossimBase otbossimElevation otbossimFont otbossimKBool otbossimMatrix otbossimPlugin otbossimProjectionImaging otbossimSupportData otbossimVec otbossimVpfUtil") SET(OTB_IO_UTILITIES_DEPENDENT_LIBRARIES "gdal;dxf;tinyXML;otbgeotiff;otbxtiff;otbossim" ) -#otbossimBase otbossimElevation otbossimFont otbossimKBool otbossimMatrix otbossimPlugin otbossimProjectionImaging otbossimSupportData otbossimVec otbossimVpfUtil") IF(NOT OTB_USE_EXTERNAL_OPENTHREADS) SET(OTB_IO_UTILITIES_DEPENDENT_LIBRARIES "${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES};${OPENTHREADS_LIBRARY}") @@ -548,12 +502,6 @@ IF( OTB_COMPILE_JPEG2000 ) SET(OTB_IO_UTILITIES_DEPENDENT_LIBRARIES "${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES};otbopenjpeg") ENDIF( OTB_COMPILE_JPEG2000 ) - -# Add VISU libraries -#IF(OTB_USE_VISU_GUI) -# SET(OTB_IO_UTILITIES_DEPENDENT_LIBRARIES "${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES} ${OTB_VISU_GUI_LIBRARIES}") -#ENDIF(OTB_USE_VISU_GUI) - # => Create OTB_ALGO_UTILITIES_DEPENDENT_LIBRARIES SET(OTB_ALGO_UTILITIES_DEPENDENT_LIBRARIES "otb6S;otbgalib;InsightJournal;otbsvm") @@ -588,63 +536,10 @@ SET(OTB_REQUIRED_C_FLAGS "${ITK_REQUIRED_C_FLAGS}") SET(OTB_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS}") SET(OTB_REQUIRED_LINK_FLAGS "${ITK_REQUIRED_LINK_FLAGS}") -# IF(CMAKE_COMPILER_IS_GNUCXX) -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -ftemplate-depth-50") -# IF(APPLE) -# SET(OTB_REQUIRED_C_FLAGS "${OTB_REQUIRED_C_FLAGS} -no-cpp-precomp") -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -no-cpp-precomp") -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -Wno-long-double") -# ENDIF(APPLE) -# ENDIF(CMAKE_COMPILER_IS_GNUCXX) - -# IF(UNIX) -# IF(NOT CMAKE_COMPILER_IS_GNUCXX) -# INCLUDE(${OTB_SOURCE_DIR}/CMake/TestNO_ICC_IDYNAMIC_NEEDED.cmake) -# TESTNO_ICC_IDYNAMIC_NEEDED(NO_ICC_IDYNAMIC_NEEDED ${OTB_SOURCE_DIR}/CMake ) -# IF(NO_ICC_IDYNAMIC_NEEDED) -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS}") -# ELSE(NO_ICC_IDYNAMIC_NEEDED) -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -i_dynamic") -# ENDIF(NO_ICC_IDYNAMIC_NEEDED) -# ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) -# ENDIF(UNIX) - -# Force the use of ansi cxx flags (i.e. -LANG:std on sgi ) -# IF("x${CMAKE_ANSI_CXXFLAGS}" MATCHES "^x.*[^ ]") -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") -# ENDIF("x${CMAKE_ANSI_CXXFLAGS}" MATCHES "^x.*[^ ]") -# IF("x${CMAKE_ANSI_CFLAGS}" MATCHES "^x.*[^ ]") -# SET(OTB_REQUIRED_C_FLAGS "${OTB_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") -# ENDIF("x${CMAKE_ANSI_CFLAGS}" MATCHES "^x.*[^ ]") - -# IF(CMAKE_SYSTEM MATCHES "IRIX.*") -# IF(NOT CMAKE_COMPILER_IS_GNUCXX) -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -woff 15,84,1110,1209,1424,1468,3102,3210,3439 -no_auto_include -ptused -no_prelink") -# SET(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} -Wl,-woff15") -# ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) -# ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*") - IF(MINGW) LINK_LIBRARIES(gdi32) ENDIF(MINGW) -# for the gnu compiler a -D_PTHREADS is needed on sun -# for the native compiler a -mt flag is needed on the sun -# IF(CMAKE_USE_PTHREADS) -# IF(CMAKE_SYSTEM MATCHES "SunOS.*") -# IF(CMAKE_COMPILER_IS_GNUCXX) -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -D_PTHREADS") -# ELSE(CMAKE_COMPILER_IS_GNUCXX) -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -mt") -# SET(OTB_REQUIRED_C_FLAGS "${OTB_REQUIRED_C_FLAGS} -mt") -# ENDIF(CMAKE_COMPILER_IS_GNUCXX) -# ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*") -# ENDIF(CMAKE_USE_PTHREADS) - -# IF(WIN32) -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -DNOMINMAX") -# ENDIF(WIN32) - #----------------------------------------------------------------------------- # Test for an Objective-C++ compiler. SET(OTB_OBJCXX_COMPILER_WORKS 0) @@ -663,45 +558,8 @@ IF(APPLE) "the following output:\n${OTB_OBJCXX_TRY_COMPILE_OUTPUT}\n\n") ENDIF( OTB_OBJCXX_COMPILER_WORKS ) ENDIF(APPLE) -#----------------------------------------------------------------------------- -# mingw thread support -# IF(MINGW) -# SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -mthreads") -# SET(OTB_REQUIRED_C_FLAGS "${OTB_REQUIRED_C_FLAGS} -mthreads") -# SET(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} -mthreads") -# ENDIF(MINGW) - - -#----------------------------------------------------------------------------- -# => Comment for OTB 2.6.0 -# -# See if compiler preprocessor has the __FUNCTION__ directive used by itkExceptionMacro -# -# INCLUDE(${OTB_SOURCE_DIR}/CMake/CheckCPPDirective.cmake) -# CHECK_CPP_DIRECTIVE_EXISTS(__FUNCTION__ ITK_CPP_FUNCTION) -#----------------------------------------------------------------------------- -# => Comment for OTB 2.6.0 -# Find platform-specific differences in the handling of IEEE floating point -# special values. -# INCLUDE(${OTB_SOURCE_DIR}/CMake/CheckBigBitfield.cmake) -# CHECK_BIG_BITFIELD(BIGBITFIELD_VALUE ${OTB_SOURCE_DIR}/CMake) -# IF(BIGBITFIELD_VALUE) -# SET(BIGBITFIELD 1 CACHE INTERNAL "System handles bit-fields larger than 32 bits.") -# ELSE(BIGBITFIELD_VALUE) -# SET(BIGBITFIELD 0 CACHE INTERNAL "System handles bit-fields larger than 32 bits.") -# ENDIF(BIGBITFIELD_VALUE) - -# => Comment for OTB 2.6.0 -# INCLUDE(${OTB_SOURCE_DIR}/CMake/TestQnanhibit.cmake) -# TEST_QNANHIBIT(QNANHIBIT_VALUE ${OTB_SOURCE_DIR}/CMake) -# IF(QNANHIBIT_VALUE) -# SET(QNANHIBIT 1 CACHE INTERNAL "The 22nd bit of 32-bit floating-point quiet NaN.") -# ELSE(QNANHIBIT_VALUE) -# SET(QNANHIBIT 0 CACHE INTERNAL "The 22nd bit of 32-bit floating-point quiet NaN.") -# ENDIF(QNANHIBIT_VALUE) - INCLUDE(CheckTypeSize) CHECK_TYPE_SIZE("long long" OTB_SIZEOF_LONG_LONG) @@ -709,74 +567,6 @@ CHECK_TYPE_SIZE("__int64" OTB_SIZEOF___INT64) CHECK_TYPE_SIZE("long int" OTB_SIZEOF_LONG_INT) CHECK_TYPE_SIZE("short int" OTB_SIZEOF_SHORT_INT) -# => Comment for OTB 2.6.0 -# IF(OTB_SIZEOF___INT64) -# IF("OTB_TYPE_SAME_LONG_AND___INT64" MATCHES "^OTB_TYPE_SAME_LONG_AND___INT64$") -# MESSAGE(STATUS "Checking whether long and __int64 are the same type") -# TRY_COMPILE(OTB_TYPE_SAME_LONG_AND___INT64 -# ${OTB_BINARY_DIR}/CMakeTmp -# ${OTB_SOURCE_DIR}/CMake/otbTestCompareTypes.cxx -# COMPILE_DEFINITIONS -# -DOTB_TEST_COMPARE_TYPE_1=long -# -DOTB_TEST_COMPARE_TYPE_2=__int64 -# OUTPUT_VARIABLE OUTPUT) -# IF(OTB_TYPE_SAME_LONG_AND___INT64) -# MESSAGE(STATUS "Checking whether long and __int64 are the same type -- yes") -# SET(OTB_TYPE_SAME_LONG_AND___INT64 1 CACHE INTERNAL "Whether long and __int64 are the same type") -# ELSE(OTB_TYPE_SAME_LONG_AND___INT64) -# MESSAGE(STATUS "Checking whether long and __int64 are the same type -- no") -# SET(OTB_TYPE_SAME_LONG_AND___INT64 0 CACHE INTERNAL "Whether long and __int64 are the same type") -# WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log -# "Determining whether long and __int64 are the same type " -# "failed with the following output:\n" -# "${OUTPUT}\n" APPEND) -# ENDIF(OTB_TYPE_SAME_LONG_AND___INT64) -# ENDIF("OTB_TYPE_SAME_LONG_AND___INT64" MATCHES "^OTB_TYPE_SAME_LONG_AND___INT64$") -# ENDIF(OTB_SIZEOF___INT64) -# IF(OTB_SIZEOF_LONG_LONG) -# CONFIGURE_FILE(${OTB_SOURCE_DIR}/CMake/otbTestStreamLongLong.cxx.in -# ${OTB_BINARY_DIR}/otbTestStreamLongLong.cxx @ONLY IMMEDIATE) -# IF("OTB_OSTREAM_SUPPORTS_LONG_LONG" MATCHES "^OTB_OSTREAM_SUPPORTS_LONG_LONG$") -# MESSAGE(STATUS "Checking if ostream supports long long") -# TRY_COMPILE(OTB_OSTREAM_SUPPORTS_LONG_LONG -# ${OTB_BINARY_DIR} -# ${OTB_BINARY_DIR}/otbTestStreamLongLong.cxx -# COMPILE_DEFINITIONS -DOTB_TEST_OSTREAM_LONG_LONG -# OUTPUT_VARIABLE OUTPUT) -# IF(OTB_OSTREAM_SUPPORTS_LONG_LONG) -# MESSAGE(STATUS "Checking if ostream supports long long -- yes") -# SET(OTB_OSTREAM_SUPPORTS_LONG_LONG 1 CACHE INTERNAL "Whether ostream supports long long") -# ELSE(OTB_OSTREAM_SUPPORTS_LONG_LONG) -# MESSAGE(STATUS "Checking if ostream supports long long -- no") -# SET(OTB_OSTREAM_SUPPORTS_LONG_LONG 0 CACHE INTERNAL "Whether ostream supports long long") -# WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log -# "Determining if ostream supports long long " -# "failed with the following output:\n" -# "${OUTPUT}\n" APPEND) -# ENDIF(OTB_OSTREAM_SUPPORTS_LONG_LONG) -# ENDIF("OTB_OSTREAM_SUPPORTS_LONG_LONG" MATCHES "^OTB_OSTREAM_SUPPORTS_LONG_LONG$") -# IF("OTB_ISTREAM_SUPPORTS_LONG_LONG" MATCHES "^OTB_ISTREAM_SUPPORTS_LONG_LONG$") -# MESSAGE(STATUS "Checking if istream supports long long") -# TRY_COMPILE(OTB_ISTREAM_SUPPORTS_LONG_LONG -# ${OTB_BINARY_DIR} -# ${OTB_BINARY_DIR}/otbTestStreamLongLong.cxx -# COMPILE_DEFINITIONS -DOTB_TEST_ISTREAM_LONG_LONG -# OUTPUT_VARIABLE OUTPUT) -# IF(OTB_ISTREAM_SUPPORTS_LONG_LONG) -# MESSAGE(STATUS "Checking if istream supports long long -- yes") -# SET(OTB_ISTREAM_SUPPORTS_LONG_LONG 1 CACHE INTERNAL "Whether istream supports long long") -# ELSE(OTB_ISTREAM_SUPPORTS_LONG_LONG) -# MESSAGE(STATUS "Checking if istream supports long long -- no") -# SET(OTB_ISTREAM_SUPPORTS_LONG_LONG 0 CACHE INTERNAL "Whether istream supports long long") -# WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log -# "Determining if istream supports long long " -# "failed with the following output:\n" -# "${OUTPUT}\n" APPEND) -# ENDIF(OTB_ISTREAM_SUPPORTS_LONG_LONG) -# ENDIF("OTB_ISTREAM_SUPPORTS_LONG_LONG" MATCHES "^OTB_ISTREAM_SUPPORTS_LONG_LONG$") -# ENDIF(OTB_SIZEOF_LONG_LONG) - - #----------------------------------------------------------------------------- # Configure the default OTB_DATA_ROOT for the location of OTB Data. FIND_PATH(OTB_DATA_ROOT OTBData.readme $ENV{OTB_DATA_ROOT}) @@ -845,22 +635,3 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OTB_REQUIRED_CXX_FLAGS}") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}") - -#----------------------------------------------------------------------------- -# => Comment for OTB 2.6.0 -# The frename-registers option does not work due to a bug in the gnu compiler. -# It must be removed or data errors will be produced and incorrect results -# will be produced. This is first documented in the gcc4 man page. -# IF(CMAKE_COMPILER_IS_GNUCXX) -# SET(ALL_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}" ) -# SEPARATE_ARGUMENTS(ALL_FLAGS) -# FOREACH(COMP_OPTION ${ALL_FLAGS}) -# # MESSAGE("${COMP_OPTION} being checked.") -# IF("${COMP_OPTION}" STREQUAL "-frename-registers") -# MESSAGE(FATAL_ERROR "-frename-registers causes runtime bugs. It must be removed from your compilation options.") -# ENDIF("${COMP_OPTION}" STREQUAL "-frename-registers") -# IF("${COMP_OPTION}" STREQUAL "-ffloat-store") -# MESSAGE(FATAL_ERROR "-ffloat-store causes runtime bugs on gcc 3.2.3 (appearently not on gcc 3.4.3, but the exact criteria is not known). It must be removed from your compilation options.") -# ENDIF("${COMP_OPTION}" STREQUAL "-ffloat-store") -# ENDFOREACH(COMP_OPTION) -# ENDIF(CMAKE_COMPILER_IS_GNUCXX) diff --git a/CTestConfig.cmake b/CTestConfig.cmake new file mode 100644 index 0000000000000000000000000000000000000000..e804438c206776b8c42a8314f664bd093157992c --- /dev/null +++ b/CTestConfig.cmake @@ -0,0 +1,12 @@ +SET(CTEST_PROJECT_NAME "OTB") +SET(CTEST_NIGHTLY_START_TIME "00:00:00 EST") + +IF(NOT DEFINED CTEST_DROP_METHOD) + SET(CTEST_DROP_METHOD "http") +ENDIF(NOT DEFINED CTEST_DROP_METHOD) + +IF(CTEST_DROP_METHOD STREQUAL "http") + SET(CTEST_DROP_SITE "www.orfeo-toolbox.org") + SET(CTEST_DROP_LOCATION "/Dashboard/submit.php?project=OTB") + SET(CTEST_TRIGGER_SITE "") +ENDIF(CTEST_DROP_METHOD STREQUAL "http") diff --git a/Code/BasicFilters/otbGaborFilterGenerator.h b/Code/BasicFilters/otbGaborFilterGenerator.h index 194ffa4c6eba37ad2b665c292f9c806d7059c384..ce1fc9b757034e90b9b4b4ba0e14c5f18b7afa92 100644 --- a/Code/BasicFilters/otbGaborFilterGenerator.h +++ b/Code/BasicFilters/otbGaborFilterGenerator.h @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otbGaborFilterGenerator_h -#define _otbGaborFilterGenerator_h +#ifndef __otbGaborFilterGenerator_h +#define __otbGaborFilterGenerator_h #include "itkObject.h" #include "itkObjectFactory.h" diff --git a/Code/BasicFilters/otbGaborFilterGenerator.txx b/Code/BasicFilters/otbGaborFilterGenerator.txx index c271286d8c6fc356ef6f34881064d74a6ce4ce55..c4dc923850f3a12824a175fe97bbc90bc137b95f 100644 --- a/Code/BasicFilters/otbGaborFilterGenerator.txx +++ b/Code/BasicFilters/otbGaborFilterGenerator.txx @@ -18,8 +18,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otbGaborFilterGenerator_txx -#define _otbGaborFilterGenerator_txx +#ifndef __otbGaborFilterGenerator_txx +#define __otbGaborFilterGenerator_txx #include "otbMath.h" diff --git a/Code/BasicFilters/otbMeanShiftImageFilter.h b/Code/BasicFilters/otbMeanShiftImageFilter.h index 564566f412e6120c19965d41382a3c9e6a0bf38d..96720e484d36e3a4f5c5ccfef7d0bb8ce5d01723 100644 --- a/Code/BasicFilters/otbMeanShiftImageFilter.h +++ b/Code/BasicFilters/otbMeanShiftImageFilter.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otbMeanShiftImageFilter_h -#define _otbMeanShiftImageFilter_h +#ifndef __otbMeanShiftImageFilter_h +#define __otbMeanShiftImageFilter_h #include "otbMeanShiftImageFilterBase.h" diff --git a/Code/BasicFilters/otbMeanShiftImageFilter.txx b/Code/BasicFilters/otbMeanShiftImageFilter.txx index f91b892ca59d15729d2019c95c80530c8b8c2e5e..d40a9ae9350c4d14559758fffda67a8c12a50fa6 100644 --- a/Code/BasicFilters/otbMeanShiftImageFilter.txx +++ b/Code/BasicFilters/otbMeanShiftImageFilter.txx @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otbMeanShiftImageFilter_txx -#define _otbMeanShiftImageFilter_txx +#ifndef __otbMeanShiftImageFilter_txx +#define __otbMeanShiftImageFilter_txx #include "otbMeanShiftImageFilter.h" diff --git a/Code/BasicFilters/otbMeanShiftImageFilterBase.h b/Code/BasicFilters/otbMeanShiftImageFilterBase.h index 7e263c1bef124c2812ba87785a6092fe1ee56212..6ecbb7fda0c7ab82fccee7e263c9c841588e0d02 100644 --- a/Code/BasicFilters/otbMeanShiftImageFilterBase.h +++ b/Code/BasicFilters/otbMeanShiftImageFilterBase.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otbMeanShiftImageFilterBase_h -#define _otbMeanShiftImageFilterBase_h +#ifndef __otbMeanShiftImageFilterBase_h +#define __otbMeanShiftImageFilterBase_h #include "itkImageToImageFilter.h" #include "itkVariableLengthVector.h" diff --git a/Code/BasicFilters/otbMeanShiftImageFilterBase.txx b/Code/BasicFilters/otbMeanShiftImageFilterBase.txx index 8e502e06f432c003b5d0da69796f62d14ce2d6bd..cc11a150dea3baf7f2a76e750d2a8435fca195b7 100644 --- a/Code/BasicFilters/otbMeanShiftImageFilterBase.txx +++ b/Code/BasicFilters/otbMeanShiftImageFilterBase.txx @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otbMeanShiftImageFilterBase_txx -#define _otbMeanShiftImageFilterBase_txx +#ifndef __otbMeanShiftImageFilterBase_txx +#define __otbMeanShiftImageFilterBase_txx #include "otbMeanShiftImageFilterBase.h" diff --git a/Code/BasicFilters/otbMeanShiftVectorImageFilter.h b/Code/BasicFilters/otbMeanShiftVectorImageFilter.h index 6280dd65c1ec4fc39f5ce9287c0bad514f0a2eee..dfef1b48c02654b0025a84743a2d8b770523f58a 100644 --- a/Code/BasicFilters/otbMeanShiftVectorImageFilter.h +++ b/Code/BasicFilters/otbMeanShiftVectorImageFilter.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otbMeanShiftVectorImageFilter_h -#define _otbMeanShiftVectorImageFilter_h +#ifndef __otbMeanShiftVectorImageFilter_h +#define __otbMeanShiftVectorImageFilter_h #include "otbMeanShiftImageFilterBase.h" diff --git a/Code/BasicFilters/otbMeanShiftVectorImageFilter.txx b/Code/BasicFilters/otbMeanShiftVectorImageFilter.txx index 4786260d9d19cc9b2e09c6c5dea14d856abb175b..4753ed724b9350dd7caa6cdf84a248225b731f00 100644 --- a/Code/BasicFilters/otbMeanShiftVectorImageFilter.txx +++ b/Code/BasicFilters/otbMeanShiftVectorImageFilter.txx @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otbMeanShiftVectorImageFilter_txx -#define _otbMeanShiftVectorImageFilter_txx +#ifndef __otbMeanShiftVectorImageFilter_txx +#define __otbMeanShiftVectorImageFilter_txx #include "otbMeanShiftVectorImageFilter.h" diff --git a/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.txx b/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.txx index 1341491c7e38f34ecf43fb9533be7e678acc223f..246179c6ffa90e419016a540d00c2459726ca991 100755 --- a/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.txx +++ b/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.txx @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otbOverlapSaveConvolutionImageFilter_txx -#define _otbOverlapSaveConvolutionImageFilter_txx +#ifndef __otbOverlapSaveConvolutionImageFilter_txx +#define __otbOverlapSaveConvolutionImageFilter_txx #include "otbOverlapSaveConvolutionImageFilter.h" diff --git a/Code/BasicFilters/otbStreamingShrinkImageFilter.txx b/Code/BasicFilters/otbStreamingShrinkImageFilter.txx index 833b50a734a88f7317490efb24d4ffefe7d700c6..c8231b7c1e5c526232657e278dfb37cf8f3b6d6f 100644 --- a/Code/BasicFilters/otbStreamingShrinkImageFilter.txx +++ b/Code/BasicFilters/otbStreamingShrinkImageFilter.txx @@ -72,7 +72,7 @@ StreamingShrinkImageFilter<TInputImage, TOutputImage> for (unsigned int i = 0; i < OutputImageType::ImageDimension; i++) { outputSpacing[i] = inputSpacing[i] * static_cast<double>( m_ShrinkFactor); - outputSize[i] = inputSize[i]/m_ShrinkFactor; + outputSize[i] = static_cast<int>( static_cast<double>(inputSize[i])/static_cast<double>( m_ShrinkFactor )) ; //outputStartIndex[i] = inputStartIndex[i]; outputStartIndex[i]=0; } diff --git a/Code/Common/otbPolyLineParametricPathWithValue.h b/Code/Common/otbPolyLineParametricPathWithValue.h index fe6376c5de076f7504dd797ab135d2727b2929ed..01eb8923020773bc250f6b44af474fd294efe8b2 100644 --- a/Code/Common/otbPolyLineParametricPathWithValue.h +++ b/Code/Common/otbPolyLineParametricPathWithValue.h @@ -55,7 +55,7 @@ class ITK_EXPORT PolyLineParametricPathWithValue typedef typename Superclass::VertexType VertexType; typedef typename Superclass::VertexListType VertexListType; typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename VertexListType::ConstIterator VertexListIteratorType; + typedef typename VertexListType::ConstIterator VertexListConstIteratorType; itkGetMacro(Key,std::string); diff --git a/Code/Common/otbPolygon.h b/Code/Common/otbPolygon.h index 0b7b5a0fb32a9311e84bb7312a8497208af69593..dc817e068653b1c4000e535a86e1a31bd4c178d1 100644 --- a/Code/Common/otbPolygon.h +++ b/Code/Common/otbPolygon.h @@ -57,7 +57,7 @@ class ITK_EXPORT Polygon typedef typename Superclass::VertexType VertexType; typedef typename Superclass::VertexListType VertexListType; typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::VertexListIteratorType VertexListIteratorType; + typedef typename Superclass::VertexListConstIteratorType VertexListConstIteratorType; typedef itk::ImageRegion<2> RegionType; typedef typename RegionType::SizeType SizeType; diff --git a/Code/Common/otbPolygon.txx b/Code/Common/otbPolygon.txx index 4ba530997bd1a0cef9e206dc34a2a4097ed2c7fb..039e48ce2b35d56ebfbae3806dc1498bef75b2e2 100644 --- a/Code/Common/otbPolygon.txx +++ b/Code/Common/otbPolygon.txx @@ -36,7 +36,7 @@ Polygon<TValue> double x = point[0]; double y = point[1]; unsigned int crossingCount = 0; - VertexListIteratorType it = this->GetVertexList()->Begin(); + VertexListConstIteratorType it = this->GetVertexList()->Begin(); double xa = it.Value()[0]; double ya = it.Value()[1]; ++it; @@ -117,7 +117,7 @@ Polygon<TValue> double x = point[0]; double y = point[1]; double xb,yb; - VertexListIteratorType it = this->GetVertexList()->Begin(); + VertexListConstIteratorType it = this->GetVertexList()->Begin(); double xa = it.Value()[0]; double ya = it.Value()[1]; double xbegin = xa; @@ -201,8 +201,8 @@ Polygon<TValue> ::NbCrossing(VertexType a, VertexType b) { unsigned int resp = 0; - VertexListIteratorType it = this->GetVertexList()->Begin(); - VertexListIteratorType it_end = this->GetVertexList()->End(); + VertexListConstIteratorType it = this->GetVertexList()->Begin(); + VertexListConstIteratorType it_end = this->GetVertexList()->End(); VertexType current = it.Value(); VertexType first = current; ++it; @@ -235,8 +235,8 @@ Polygon<TValue> ::NbTouching(VertexType a, VertexType b) { unsigned int resp = 0; - VertexListIteratorType it = this->GetVertexList()->Begin(); - VertexListIteratorType it_end = this->GetVertexList()->End(); + VertexListConstIteratorType it = this->GetVertexList()->Begin(); + VertexListConstIteratorType it_end = this->GetVertexList()->End(); VertexType current = it.Value(); VertexType first = current; ++it; @@ -426,7 +426,7 @@ Polygon<TValue> IndexType maxId; maxId.Fill(0); - VertexListIteratorType it = this->GetVertexList()->Begin(); + VertexListConstIteratorType it = this->GetVertexList()->Begin(); long int x,y; @@ -483,7 +483,7 @@ template<class TValue> ::GetSurface() { m_Surface = 0.0; - VertexListIteratorType it = this->GetVertexList()->Begin(); + VertexListConstIteratorType it = this->GetVertexList()->Begin(); if(this->GetVertexList()->Size()>2) { diff --git a/Code/DisparityMap/otbMIRegistrationFilter.h b/Code/DisparityMap/otbMIRegistrationFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..b3937073dc12d89153b6ea829585d046b5d6c0a6 --- /dev/null +++ b/Code/DisparityMap/otbMIRegistrationFilter.h @@ -0,0 +1,126 @@ +#ifndef _otbMIRegistrationFilter_h_ +#define _otbMIRegistrationFilter_h_ + +#include "itkPDEDeformableRegistrationFilter.h" +#include "itkMIRegistrationFunction.h" + +namespace otb { + +/** \class MIRegistrationFilter + * \brief Deformably register two images using the PDEs and Mutual Information. + * + * MIRegistrationFilter implements the ####### + * register two images by computing the deformation field which will map a + * moving image onto a fixed image. + * + * A deformation field is represented as a image whose pixel type is some + * vector type with at least N elements, where N is the dimension of + * the fixed image. The vector type must support element access via operator + * []. It is assumed that the vector elements behave like floating point + * scalars. + * + * This class is templated over the fixed image type, moving image type + * and the deformation field type. + * + * The input fixed and moving images are set via methods SetFixedImage + * and SetMovingImage respectively. An initial deformation field maybe set via + * SetInitialDeformationField or SetInput. If no initial field is set, + * a zero field is used as the initial condition. + * + * The algorithm has one parameter: the number of iteration to be performed. + * + * The output deformation field can be obtained via methods GetOutput + * or GetDeformationField. + * + * This class make use of the finite difference solver hierarchy. Update + * for each iteration is computed in MIRegistrationFunction. + * + * \warning This filter assumes that the fixed image type, moving image type + * and deformation field type all have the same number of dimensions. + * + * \sa MIRegistrationFunction + * \ingroup DeformableImageRegistration MultiThreaded + */ +template<class TFixedImage, class TMovingImage, class TDeformationField> +class ITK_EXPORT MIRegistrationFilter : + public itk::PDEDeformableRegistrationFilter< TFixedImage, TMovingImage, + TDeformationField> +{ +public: + /** Standard class typedefs. */ + typedef MIRegistrationFilter Self; + typedef itk::PDEDeformableRegistrationFilter< + TFixedImage, TMovingImage,TDeformationField> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro( MIRegistrationFilter, + itk::PDEDeformableRegistrationFilter ); + + /** Inherit types from superclass. */ + typedef typename Superclass::TimeStepType TimeStepType; + + /** FixedImage image type. */ + typedef typename Superclass::FixedImageType FixedImageType; + typedef typename Superclass::FixedImagePointer FixedImagePointer; + + /** MovingImage image type. */ + typedef typename Superclass::MovingImageType MovingImageType; + typedef typename Superclass::MovingImagePointer MovingImagePointer; + + /** Deformation field type. */ + typedef typename Superclass::DeformationFieldType + DeformationFieldType; + typedef typename Superclass::DeformationFieldPointer + DeformationFieldPointer; + + /** FiniteDifferenceFunction type. */ + typedef typename Superclass::FiniteDifferenceFunctionType + FiniteDifferenceFunctionType; + + /** MIRegistrationFilterFunction type. */ + typedef itk::MIRegistrationFunction<FixedImageType,MovingImageType, + DeformationFieldType> MIRegistrationFunctionType; + + typedef typename MIRegistrationFunctionType::RadiusType RadiusType; + + /** Get the metric value. The metric value is computed over the the + * overlapping region between the two images. This is value is only + * available for the previous iteration and NOT the current + * iteration. */ + virtual double GetMetric() const; + + + virtual void SetMIRadius(RadiusType radius); + virtual RadiusType GetMIRadius() const; + +protected: + MIRegistrationFilter(); + ~MIRegistrationFilter() {} + void PrintSelf(std::ostream& os, itk::Indent indent) const; + + /** Initialize the state of filter and equation before each iteration. */ + virtual void InitializeIteration(); + + /** Apply update. */ + virtual void ApplyUpdate(TimeStepType dt); + +private: + MIRegistrationFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + +}; + + +} // end namespace otb + +#ifndef ITK_MANUAL_INSTANTIATION +#include "otbMIRegistrationFilter.txx" +#endif + +#endif diff --git a/Code/DisparityMap/otbMIRegistrationFilter.txx b/Code/DisparityMap/otbMIRegistrationFilter.txx new file mode 100644 index 0000000000000000000000000000000000000000..17928f0489af553a99da337301780301381db490 --- /dev/null +++ b/Code/DisparityMap/otbMIRegistrationFilter.txx @@ -0,0 +1,176 @@ +#ifndef _otbMIRegistrationFilter_txx +#define _otbMIRegistrationFilter_txx +#include "otbMIRegistrationFilter.h" + +namespace otb { + +/* + * Default constructor + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +MIRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::MIRegistrationFilter() +{ + + typename MIRegistrationFunctionType::Pointer drfp; + drfp = MIRegistrationFunctionType::New(); + + drfp->SetDeformationField( this->GetDeformationField() ); + + this->SetDifferenceFunction( static_cast<FiniteDifferenceFunctionType *>( + drfp.GetPointer() ) ); + +} + + +template <class TFixedImage, class TMovingImage, class TDeformationField> +void +MIRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + Superclass::PrintSelf( os, indent ); + os << indent << "MI Radius: " << + this->GetMIRadius() << std::endl; +} + + +/* + * Set the function state values before each iteration + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +void +MIRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::InitializeIteration() +{ + + // call the superclass implementation + Superclass::InitializeIteration(); + + // set the gradient selection flag + MIRegistrationFunctionType *drfp = + dynamic_cast<MIRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to MIRegistrationFunction" ); + } + + /* + * Smooth the deformation field + */ + if ( this->GetSmoothDeformationField() ) + { + this->SmoothDeformationField(); + } + +} + + +/* + * Get the metric value from the difference function + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +double +MIRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::GetMetric() const +{ + + MIRegistrationFunctionType *drfp = + dynamic_cast<MIRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to MIRegistrationFunction" ); + } + + return drfp->GetEnergy(); + +} + + +/* + * + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +typename MIRegistrationFilter<TFixedImage,TMovingImage,TDeformationField>::RadiusType +MIRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::GetMIRadius() const +{ + + MIRegistrationFunctionType *drfp = + dynamic_cast<MIRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to MIRegistrationFunction" ); + } + + return drfp->GetRadius(); + +} + +/* + * + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +void +MIRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::SetMIRadius(RadiusType radius) +{ + + MIRegistrationFunctionType *drfp = + dynamic_cast<MIRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to MIRegistrationFunction" ); + } + + drfp->SetRadius(radius); + +} + +/* + * Get the metric value from the difference function + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +void +MIRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::ApplyUpdate(TimeStepType dt) +{ + // If we smooth the update buffer before applying it, then the are + // approximating a viscuous problem as opposed to an elastic problem + if ( this->GetSmoothUpdateField() ) + { + this->SmoothUpdateField(); + } + + this->Superclass::ApplyUpdate(dt); + + MIRegistrationFunctionType *drfp = + dynamic_cast<MIRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to MIRegistrationFunction" ); + } + +// this->SetRMSChange( drfp->GetRMSChange() ); + +} + + + +} // end namespace otb + +#endif diff --git a/Code/DisparityMap/otbNCCRegistrationFilter.h b/Code/DisparityMap/otbNCCRegistrationFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..a0070832220d7866ded251ffd6bb1b6208f5c79b --- /dev/null +++ b/Code/DisparityMap/otbNCCRegistrationFilter.h @@ -0,0 +1,126 @@ +#ifndef _otbNCCRegistrationFilter_h_ +#define _otbNCCRegistrationFilter_h_ + +#include "itkPDEDeformableRegistrationFilter.h" +#include "itkNCCRegistrationFunction.h" + +namespace otb { + +/** \class NCCRegistrationFilter + * \brief Deformably register two images using the PDEs and NCC. + * + * NCCRegistrationFilter implements the ####### + * register two images by computing the deformation field which will map a + * moving image onto a fixed image. + * + * A deformation field is represented as a image whose pixel type is some + * vector type with at least N elements, where N is the dimension of + * the fixed image. The vector type must support element access via operator + * []. It is assumed that the vector elements behave like floating point + * scalars. + * + * This class is templated over the fixed image type, moving image type + * and the deformation field type. + * + * The input fixed and moving images are set via methods SetFixedImage + * and SetMovingImage respectively. An initial deformation field maybe set via + * SetInitialDeformationField or SetInput. If no initial field is set, + * a zero field is used as the initial condition. + * + * The algorithm has one parameter: the number of iteration to be performed. + * + * The output deformation field can be obtained via methods GetOutput + * or GetDeformationField. + * + * This class make use of the finite difference solver hierarchy. Update + * for each iteration is computed in NCCRegistrationFunction. + * + * \warning This filter assumes that the fixed image type, moving image type + * and deformation field type all have the same number of dimensions. + * + * \sa NCCRegistrationFunction + * \ingroup DeformableImageRegistration MultiThreaded + */ +template<class TFixedImage, class TMovingImage, class TDeformationField> +class ITK_EXPORT NCCRegistrationFilter : + public itk::PDEDeformableRegistrationFilter< TFixedImage, TMovingImage, + TDeformationField> +{ +public: + /** Standard class typedefs. */ + typedef NCCRegistrationFilter Self; + typedef itk::PDEDeformableRegistrationFilter< + TFixedImage, TMovingImage,TDeformationField> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro( NCCRegistrationFilter, + itk::PDEDeformableRegistrationFilter ); + + /** Inherit types from superclass. */ + typedef typename Superclass::TimeStepType TimeStepType; + + /** FixedImage image type. */ + typedef typename Superclass::FixedImageType FixedImageType; + typedef typename Superclass::FixedImagePointer FixedImagePointer; + + /** MovingImage image type. */ + typedef typename Superclass::MovingImageType MovingImageType; + typedef typename Superclass::MovingImagePointer MovingImagePointer; + + /** Deformation field type. */ + typedef typename Superclass::DeformationFieldType + DeformationFieldType; + typedef typename Superclass::DeformationFieldPointer + DeformationFieldPointer; + + /** FiniteDifferenceFunction type. */ + typedef typename Superclass::FiniteDifferenceFunctionType + FiniteDifferenceFunctionType; + + /** NCCRegistrationFilterFunction type. */ + typedef itk::NCCRegistrationFunction<FixedImageType,MovingImageType, + DeformationFieldType> NCCRegistrationFunctionType; + + typedef typename NCCRegistrationFunctionType::RadiusType RadiusType; + + /** Get the metric value. The metric value is computed over the the + * overlapping region between the two images. This is value is only + * available for the previous iteration and NOT the current + * iteration. */ + virtual double GetMetric() const; + + + virtual void SetNCCRadius(RadiusType radius); + virtual RadiusType GetNCCRadius() const; + +protected: + NCCRegistrationFilter(); + ~NCCRegistrationFilter() {} + void PrintSelf(std::ostream& os, itk::Indent indent) const; + + /** Initialize the state of filter and equation before each iteration. */ + virtual void InitializeIteration(); + + /** Apply update. */ + virtual void ApplyUpdate(TimeStepType dt); + +private: + NCCRegistrationFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + +}; + + +} // end namespace otb + +#ifndef ITK_MANUAL_INSTANTIATION +#include "otbNCCRegistrationFilter.txx" +#endif + +#endif diff --git a/Code/DisparityMap/otbNCCRegistrationFilter.txx b/Code/DisparityMap/otbNCCRegistrationFilter.txx new file mode 100644 index 0000000000000000000000000000000000000000..cd7633b6defc331d54d42a5b09a3a8bed86f8845 --- /dev/null +++ b/Code/DisparityMap/otbNCCRegistrationFilter.txx @@ -0,0 +1,176 @@ +#ifndef _otbNCCRegistrationFilter_txx +#define _otbNCCRegistrationFilter_txx +#include "otbNCCRegistrationFilter.h" + +namespace otb { + +/* + * Default constructor + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +NCCRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::NCCRegistrationFilter() +{ + + typename NCCRegistrationFunctionType::Pointer drfp; + drfp = NCCRegistrationFunctionType::New(); + + drfp->SetDeformationField( this->GetDeformationField() ); + + this->SetDifferenceFunction( static_cast<FiniteDifferenceFunctionType *>( + drfp.GetPointer() ) ); + +} + + +template <class TFixedImage, class TMovingImage, class TDeformationField> +void +NCCRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + Superclass::PrintSelf( os, indent ); + os << indent << "NCC Radius: " << + this->GetNCCRadius() << std::endl; +} + + +/* + * Set the function state values before each iteration + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +void +NCCRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::InitializeIteration() +{ + + // call the superclass implementation + Superclass::InitializeIteration(); + + // set the gradient selection flag + NCCRegistrationFunctionType *drfp = + dynamic_cast<NCCRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to NCCRegistrationFunction" ); + } + + /* + * Smooth the deformation field + */ + if ( this->GetSmoothDeformationField() ) + { + this->SmoothDeformationField(); + } + +} + + +/* + * Get the metric value from the difference function + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +double +NCCRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::GetMetric() const +{ + + NCCRegistrationFunctionType *drfp = + dynamic_cast<NCCRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to NCCRegistrationFunction" ); + } + + return drfp->GetEnergy(); + +} + + +/* + * + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +typename NCCRegistrationFilter<TFixedImage,TMovingImage,TDeformationField>::RadiusType +NCCRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::GetNCCRadius() const +{ + + NCCRegistrationFunctionType *drfp = + dynamic_cast<NCCRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to NCCRegistrationFunction" ); + } + + return drfp->GetRadius(); + +} + +/* + * + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +void +NCCRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::SetNCCRadius(RadiusType radius) +{ + + NCCRegistrationFunctionType *drfp = + dynamic_cast<NCCRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to NCCRegistrationFunction" ); + } + + drfp->SetRadius(radius); + +} + +/* + * Get the metric value from the difference function + */ +template <class TFixedImage, class TMovingImage, class TDeformationField> +void +NCCRegistrationFilter<TFixedImage,TMovingImage,TDeformationField> +::ApplyUpdate(TimeStepType dt) +{ + // If we smooth the update buffer before applying it, then the are + // approximating a viscuous problem as opposed to an elastic problem + if ( this->GetSmoothUpdateField() ) + { + this->SmoothUpdateField(); + } + + this->Superclass::ApplyUpdate(dt); + + NCCRegistrationFunctionType *drfp = + dynamic_cast<NCCRegistrationFunctionType *> + (this->GetDifferenceFunction().GetPointer()); + + if( !drfp ) + { + itkExceptionMacro( << + "Could not cast difference function to NCCRegistrationFunction" ); + } + +// this->SetRMSChange( drfp->GetRMSChange() ); + +} + + + +} // end namespace otb + +#endif diff --git a/Code/Gui/CMakeLists.txt b/Code/Gui/CMakeLists.txt index 6f608142cade965deaaaf64342d1f3ce1623de6f..05efe68a95d6cfe3f13d02e66f40d1e8455b9cea 100644 --- a/Code/Gui/CMakeLists.txt +++ b/Code/Gui/CMakeLists.txt @@ -6,7 +6,7 @@ FILE(GLOB OTBGui_SRCS "*.cxx" ) # To suppress "ld: cycle in dylib re-exports with /usr/X11R6/lib/libGL.dylib" error on APPLE and SHARED configuration IF(APPLE AND BUILD_SHARED_LIBS) FOREACH(c "" "_DEBUG" "_RELEASE" "_MINSIZEREL" "_RELWITHDEBINFO") - SET(CMAKE_SHARED_LINKER_FLAGS${c} "${CMAKE_SHARED_LINKER_FLAGS${c}} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib") + SET(CMAKE_SHARED_LINKER_FLAGS${c} "${CMAKE_SHARED_LINKER_FLAGS${c}};-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib") ENDFOREACH(c) ENDIF(APPLE AND BUILD_SHARED_LIBS) diff --git a/Code/IO/otbMWImageIO.h b/Code/IO/otbMWImageIO.h index 90187499eaeea298b30596c8f2f70f02597239d5..d7f71500ee402c6da7d447a3e24a1aecfaf976e7 100755 --- a/Code/IO/otbMWImageIO.h +++ b/Code/IO/otbMWImageIO.h @@ -150,7 +150,7 @@ private: std::string m_TypeMW; //used for write itk::ImageIOBase::ByteOrder m_FileByteOrder; std::fstream m_File; - uint m_Ncom; + unsigned int m_Ncom; }; diff --git a/Code/IO/otbRADImageIO.cxx b/Code/IO/otbRADImageIO.cxx index 8aa969fedfbbd29deae49b0649ba39cf0788d29c..6f86c8aa457b6c511088b220c9a4469d5b2e4fd8 100644 --- a/Code/IO/otbRADImageIO.cxx +++ b/Code/IO/otbRADImageIO.cxx @@ -66,7 +66,6 @@ RADImageIO::RADImageIO() m_Origin[1] = 0.0; m_ChannelsFile = NULL; m_FlagWriteImageInformation = true; - } RADImageIO::~RADImageIO() diff --git a/Code/SARPolarimetry/otbPolarimetricData.h b/Code/SARPolarimetry/otbPolarimetricData.h index 9394a62ce2081fb7bf48c9453499c2d0e237e4ed..9fe28e0d939deceb1fe0da5905fc1e99a15476a3 100644 --- a/Code/SARPolarimetry/otbPolarimetricData.h +++ b/Code/SARPolarimetry/otbPolarimetricData.h @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef _otb_PolarimetricData_h -#define _otb_PolarimetricData_h +#ifndef __otb_PolarimetricData_h +#define __otb_PolarimetricData_h #include "itkDataObject.h" #include "itkObjectFactory.h" diff --git a/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.h b/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.h index d1e0fd8d70d4d76919646e45fb305ce4a7365b7c..26963401ada00ebaabe46e36088a4c7c50ca81ac 100644 --- a/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.h +++ b/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.h @@ -63,7 +63,7 @@ public: typedef typename PolygonType::ConstPointer PolygonConstPointerType; typedef typename PolygonType::VertexListType VertexListType; typedef typename PolygonType::ContinuousIndexType ContinuousIndexType; - typedef typename VertexListType::ConstIterator VertexListIteratorType; + typedef typename VertexListType::ConstIterator VertexListConstIteratorType; typedef std::vector<bool> BoolVectorType; /** RCC8 values type */ diff --git a/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.txx b/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.txx index c181c72d8a4aa325735b93a0b6334d0e63f96e6e..cabb79f1fd96262a1e4dbe07b42fa9db7df269a1 100644 --- a/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.txx +++ b/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.txx @@ -156,8 +156,8 @@ PolygonToPolygonRCC8Calculator<TInputPolygon> ::ComputeInterExter(PolygonPointerType polygon1, PolygonPointerType polygon2) { bool resp = false; - VertexListIteratorType it = polygon1->GetVertexList()->Begin(); - VertexListIteratorType it_end = polygon1->GetVertexList()->End(); + VertexListConstIteratorType it = polygon1->GetVertexList()->Begin(); + VertexListConstIteratorType it_end = polygon1->GetVertexList()->End(); ContinuousIndexType current = it.Value(); ContinuousIndexType first = current; @@ -213,8 +213,8 @@ PolygonToPolygonRCC8Calculator<TInputPolygon> ::ComputeInterInter(PolygonPointerType polygon1, PolygonPointerType polygon2) { bool resp = false; - VertexListIteratorType it = polygon1->GetVertexList()->Begin(); - VertexListIteratorType it_end = polygon1->GetVertexList()->End(); + VertexListConstIteratorType it = polygon1->GetVertexList()->Begin(); + VertexListConstIteratorType it_end = polygon1->GetVertexList()->End(); ContinuousIndexType current = it.Value(); ContinuousIndexType first = current; bool currentIsInside = polygon2->IsInside(current); @@ -259,8 +259,8 @@ PolygonToPolygonRCC8Calculator<TInputPolygon> ::ComputeEdgeEdge(PolygonPointerType polygon1, PolygonPointerType polygon2) { bool resp = false; - VertexListIteratorType it = polygon1->GetVertexList()->Begin(); - VertexListIteratorType it_end = polygon1->GetVertexList()->End(); + VertexListConstIteratorType it = polygon1->GetVertexList()->Begin(); + VertexListConstIteratorType it_end = polygon1->GetVertexList()->End(); ContinuousIndexType current = it.Value(); resp = polygon2->IsOnEdge(current); diff --git a/Code/Visu/otbImageViewerBase.h b/Code/Visu/otbImageViewerBase.h index 462d1201405aa26d022eca609449f3604ecce6c6..9af0081bb5583d29ea4ea0ad9f4dbdbf1e851e4e 100644 --- a/Code/Visu/otbImageViewerBase.h +++ b/Code/Visu/otbImageViewerBase.h @@ -155,7 +155,7 @@ namespace otb /// type for the list of the polygon ROI typedef otb::Polygon<LabelType> PolygonType; - typedef typename PolygonType::VertexListIteratorType PolygonIteratorType; + typedef typename PolygonType::VertexListConstIteratorType PolygonIteratorType; typedef otb::ObjectList<PolygonType> PolygonListType; typedef typename PolygonListType::Pointer PolygonListPointerType; typedef typename PolygonListType::Iterator PolygonListIteratorType; @@ -167,7 +167,7 @@ namespace otb typedef std::map<LabelType,ColorType> ROIColorMapType; typedef otb::PolyLineParametricPathWithValue<double,2> PathType; - typedef typename PathType::VertexListIteratorType PathIteratorType; + typedef typename PathType::VertexListConstIteratorType PathIteratorType; typedef otb::ObjectList<PathType> PathListType; typedef typename PathListType::Pointer PathListPointerType; typedef typename PathListType::Iterator PathListIteratorType; diff --git a/Code/Visu/otbImageWidgetPolygonForm.h b/Code/Visu/otbImageWidgetPolygonForm.h index c08a7fc0030779693f9018514454fed9892a3c8c..93fbe1c7f163ba1dc02e57ca9b926df869f4e27e 100644 --- a/Code/Visu/otbImageWidgetPolygonForm.h +++ b/Code/Visu/otbImageWidgetPolygonForm.h @@ -59,7 +59,7 @@ class ITK_EXPORT ImageWidgetPolygonForm typedef typename PolygonType::Pointer PolygonPointerType; typedef typename PolygonType::VertexType VertexType; typedef typename PolygonType::VertexListType VertexListType; - typedef typename VertexListType::ConstIterator VertexListIteratorType; + typedef typename VertexListType::ConstIterator VertexListConstIteratorType; typedef typename PolygonType::ContinuousIndexType ContinuousIndexType; /** Accessors */ diff --git a/Code/Visu/otbImageWidgetPolygonForm.txx b/Code/Visu/otbImageWidgetPolygonForm.txx index bec5d80f7ab374fefb6f6cfb77cee79a54cd3ee8..59b57443c19d73855fad9981ade52e90ac9d4109 100644 --- a/Code/Visu/otbImageWidgetPolygonForm.txx +++ b/Code/Visu/otbImageWidgetPolygonForm.txx @@ -58,7 +58,7 @@ ImageWidgetPolygonForm<TValue> polygonDrawer->Color4d(m_Color[0],m_Color[1],m_Color[2],m_Color[3]); } polygonDrawer->SetBoundaryOnly(!m_Solid); - VertexListIteratorType it = this->GetPolygon()->GetVertexList()->Begin(); + VertexListConstIteratorType it = this->GetPolygon()->GetVertexList()->Begin(); while(it != this->GetPolygon()->GetVertexList()->End()) { diff --git a/Code/Visu/otbImageWidgetPolylineForm.h b/Code/Visu/otbImageWidgetPolylineForm.h index aaf94d7917a7db56d05442e3f52a929ae5ee83f6..8948881c7a981b6492b08fe056e2f8e75add9daf 100644 --- a/Code/Visu/otbImageWidgetPolylineForm.h +++ b/Code/Visu/otbImageWidgetPolylineForm.h @@ -54,7 +54,7 @@ class ITK_EXPORT ImageWidgetPolylineForm typedef typename PolylineType::Pointer PolylinePointerType; typedef typename PolylineType::VertexType VertexType; typedef typename PolylineType::VertexListType VertexListType; - typedef typename VertexListType::ConstIterator VertexListIteratorType; + typedef typename VertexListType::ConstIterator VertexListConstIteratorType; typedef typename PolylineType::ContinuousIndexType ContinuousIndexType; /** Accessors */ diff --git a/Code/Visu/otbImageWidgetPolylineForm.txx b/Code/Visu/otbImageWidgetPolylineForm.txx index 86400dc3fb3b17efd0df4334bda51a7cea9b27fb..4576d18ca66838731190f03fa04d8a30296aa808 100644 --- a/Code/Visu/otbImageWidgetPolylineForm.txx +++ b/Code/Visu/otbImageWidgetPolylineForm.txx @@ -55,7 +55,7 @@ ImageWidgetPolylineForm<TValue> } glBegin(GL_LINE_STRIP); - VertexListIteratorType it = this->GetPolyline()->GetVertexList()->Begin(); + VertexListConstIteratorType it = this->GetPolyline()->GetVertexList()->Begin(); while(it != this->GetPolyline()->GetVertexList()->End()) { diff --git a/Examples/DisparityMap/CMakeLists.txt b/Examples/DisparityMap/CMakeLists.txt index 895199fb1c88b284c23563310e64de9095d75bb2..0a05ed3fe87e916e9c0153d0f3564fab90455a8f 100644 --- a/Examples/DisparityMap/CMakeLists.txt +++ b/Examples/DisparityMap/CMakeLists.txt @@ -5,6 +5,11 @@ ADD_EXECUTABLE(SimpleDisparityMapEstimationExample SimpleDisparityMapEstimationE TARGET_LINK_LIBRARIES(SimpleDisparityMapEstimationExample OTBFeatureExtraction OTBCommon OTBIO ITKCommon ITKIO) +ADD_EXECUTABLE(NCCRegistrationFilterExample NCCRegistrationFilterExample.cxx ) +TARGET_LINK_LIBRARIES(NCCRegistrationFilterExample OTBFeatureExtraction OTBCommon OTBIO ITKCommon +ITKIO) + + IF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) SET(BASELINE ${OTB_DATA_ROOT}/Baseline/Examples/DisparityMap) diff --git a/Examples/DisparityMap/NCCRegistrationFilterExample.cxx b/Examples/DisparityMap/NCCRegistrationFilterExample.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cba58581507bdfa430121b75dcdc7d8ea34b3bd0 --- /dev/null +++ b/Examples/DisparityMap/NCCRegistrationFilterExample.cxx @@ -0,0 +1,131 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.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 above copyright notices for more information. + +=========================================================================*/ +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#ifdef __BORLANDC__ +#define ITK_LEAN_AND_MEAN +#endif + + +// Software Guide : BeginCommandLineArgs +// INPUTS: {fixed.tif}, {moving.tif} +// OUTPUTS: {deformationFieldOutput2.png} +// 5 1.0 2 +// Software Guide : EndCommandLineArgs + + + +#include "otbImage.h" +#include "otbImageFileWriter.h" +#include "otbImageFileReader.h" +#include "otbNCCRegistrationFilter.h" +#include "otbCommandLineArgumentParser.h" +#include "itkRecursiveGaussianImageFilter.h" + +#include <iostream> + + +int main(int argc, char** argv ) +{ + + const unsigned int ImageDimension = 2; + + typedef double PixelType; + typedef itk::Vector<double,ImageDimension> DeformationPixelType; + + typedef double CoordinateRepresentationType; + + //Allocate Images + typedef otb::Image<PixelType,ImageDimension> MovingImageType; + typedef otb::Image<PixelType,ImageDimension> FixedImageType; + typedef otb::Image<DeformationPixelType, + ImageDimension> DeformationFieldType; + + typedef otb::ImageFileReader< FixedImageType > FixedReaderType; + FixedReaderType::Pointer fReader = FixedReaderType::New(); + fReader->SetFileName(argv[1]); + + typedef otb::ImageFileReader< MovingImageType > MovingReaderType; + MovingReaderType::Pointer mReader = MovingReaderType::New(); + mReader->SetFileName(argv[2]); + + + //Blur input images + + typedef itk::RecursiveGaussianImageFilter< FixedImageType, + FixedImageType > FixedBlurType; + + FixedBlurType::Pointer fBlur = FixedBlurType::New(); + fBlur->SetInput( fReader->GetOutput() ); + fBlur->SetSigma( atof(argv[5]) ); + + + typedef itk::RecursiveGaussianImageFilter< MovingImageType, + MovingImageType > MovingBlurType; + + MovingBlurType::Pointer mBlur = MovingBlurType::New(); + mBlur->SetInput( mReader->GetOutput() ); + mBlur->SetSigma( 1.0 ); + + + //Create the filter + typedef otb::NCCRegistrationFilter< FixedImageType, + MovingImageType, + DeformationFieldType > + RegistrationFilterType; + + RegistrationFilterType::Pointer registrator = RegistrationFilterType::New(); + + registrator->SetMovingImage( mBlur->GetOutput() ); + registrator->SetFixedImage( fBlur->GetOutput() ); + + + typedef RegistrationFilterType::RadiusType RadiusType; + + RadiusType radius; + + radius[0] = atoi(argv[4]); + radius[1] = atoi(argv[4]); + + registrator->SetNCCRadius( radius ); + + std::cout << "NCC radius " << registrator->GetNCCRadius() << std::endl; + + + registrator->SetNumberOfIterations( atoi(argv[6]) ); + + registrator->GetDeformationField(); + + registrator->Update(); + + + + typedef otb::ImageFileWriter< DeformationFieldType > DFWriterType; + + DFWriterType::Pointer dfWriter = DFWriterType::New(); + dfWriter->SetFileName(argv[3]); + dfWriter->SetInput( registrator->GetOutput() ); + dfWriter->Update(); + + + return EXIT_SUCCESS; + +} + diff --git a/Examples/IO/VectorDataIOExample.cxx b/Examples/IO/VectorDataIOExample.cxx index 23d12fc1a1cdb10873873809704faefaabd9ca53..1f00ba2cd0554e025d5fb4170214457f63a1df32 100644 --- a/Examples/IO/VectorDataIOExample.cxx +++ b/Examples/IO/VectorDataIOExample.cxx @@ -124,7 +124,7 @@ int main(int argc, char * argv[]) // Software Guide : BeginCodeSnippet typedef otb::Polygon<PixelType> PolygonType; - typedef PolygonType::VertexListIteratorType PolygonIteratorType; + typedef PolygonType::VertexListConstIteratorType PolygonIteratorType; typedef otb::ObjectList<PolygonType> PolygonListType; typedef PolygonListType::Iterator PolygonListIteratorType; diff --git a/Testing/Code/DisparityMap/CMakeLists.txt b/Testing/Code/DisparityMap/CMakeLists.txt index 5543ca5ef77776992dc410f2ed97a3305720c677..6b745eaa73a83c3bf685e2e247757e69e3218f25 100644 --- a/Testing/Code/DisparityMap/CMakeLists.txt +++ b/Testing/Code/DisparityMap/CMakeLists.txt @@ -56,6 +56,17 @@ ADD_TEST(dmTvNearestPointDeformationFieldGenerator ${DISPARITYMAP_TESTS1} ${TEMP}/dmTvNearestPointDeformationField.hdr ) +# ------- otb::NCCRegistrationFilter ---------- + +ADD_TEST(dmTuNCCRegistrationFilterNew ${DISPARITYMAP_TESTS1} + otbNCCRegistrationFilterNew) + +# ------- otb::MIRegistrationFilter ---------- + +ADD_TEST(dmTuMIRegistrationFilterNew ${DISPARITYMAP_TESTS1} + otbMIRegistrationFilterNew) + + # ------- otb::NNearestPointsLinearInterpolateDeformationFieldGenerator ---------- ADD_TEST(dmTuNNearestPointsLinearInterpolateDeformationFieldGeneratorNew ${DISPARITYMAP_TESTS1} @@ -304,6 +315,8 @@ ADD_TEST(dmTvSinusoidDeformationFieldEstimation2 ${DISPARITYMAP_TESTS2} SET(BasicDisparityMap_SRCS1 otbDisparityMapEstimationMethodNew.cxx otbDisparityMapEstimationMethod.cxx +otbNCCRegistrationFilterNew.cxx +otbMIRegistrationFilterNew.cxx otbPointSetToDeformationFieldGeneratorNew.cxx otbNearestPointDeformationFieldGeneratorNew.cxx otbNearestPointDeformationFieldGenerator.cxx diff --git a/Testing/Code/DisparityMap/otbDisparityMapTests1.cxx b/Testing/Code/DisparityMap/otbDisparityMapTests1.cxx index 5e1d66cd3ee630f68ad131b8a10a9464983b5253..82515423c023942365a1ae168b431eb7aafd8c9e 100644 --- a/Testing/Code/DisparityMap/otbDisparityMapTests1.cxx +++ b/Testing/Code/DisparityMap/otbDisparityMapTests1.cxx @@ -36,4 +36,6 @@ REGISTER_TEST(otbNNearestPointsLinearInterpolateDeformationFieldGenerator); REGISTER_TEST(otbBSplinesInterpolateDeformationFieldGeneratorNew); REGISTER_TEST(otbBSplinesInterpolateDeformationFieldGenerator); REGISTER_TEST(otbPointSetWithTransformToDeformationFieldGeneratorNew); +REGISTER_TEST(otbNCCRegistrationFilterNew); +REGISTER_TEST(otbMIRegistrationFilterNew); } diff --git a/Testing/Code/DisparityMap/otbMIRegistrationFilterNew.cxx b/Testing/Code/DisparityMap/otbMIRegistrationFilterNew.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c172705eacee17db0850df4632d1e771d20ab764 --- /dev/null +++ b/Testing/Code/DisparityMap/otbMIRegistrationFilterNew.cxx @@ -0,0 +1,46 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.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 above copyright notices for more information. + +=========================================================================*/ +#include "otbMIRegistrationFilter.h" +#include "otbImage.h" + +int otbMIRegistrationFilterNew(int argc, char* argv[]) +{ + const unsigned int ImageDimension = 2; + + typedef double PixelType; + typedef itk::Vector<double,ImageDimension> DeformationPixelType; + + typedef double CoordinateRepresentationType; + + //Allocate Images + typedef otb::Image<PixelType,ImageDimension> MovingImageType; + typedef otb::Image<PixelType,ImageDimension> FixedImageType; + typedef otb::Image<DeformationPixelType, + ImageDimension> DeformationFieldType; + + //Create the filter + typedef otb::MIRegistrationFilter< FixedImageType, + MovingImageType, + DeformationFieldType > + RegistrationFilterType; + + // Instantiation + RegistrationFilterType::Pointer registrator = RegistrationFilterType::New(); + + return EXIT_SUCCESS; +} diff --git a/Testing/Code/DisparityMap/otbNCCRegistrationFilterNew.cxx b/Testing/Code/DisparityMap/otbNCCRegistrationFilterNew.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ae43515025757b853ec941ada06d5a0aed431d6c --- /dev/null +++ b/Testing/Code/DisparityMap/otbNCCRegistrationFilterNew.cxx @@ -0,0 +1,46 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.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 above copyright notices for more information. + +=========================================================================*/ +#include "otbNCCRegistrationFilter.h" +#include "otbImage.h" + +int otbNCCRegistrationFilterNew(int argc, char* argv[]) +{ + const unsigned int ImageDimension = 2; + + typedef double PixelType; + typedef itk::Vector<double,ImageDimension> DeformationPixelType; + + typedef double CoordinateRepresentationType; + + //Allocate Images + typedef otb::Image<PixelType,ImageDimension> MovingImageType; + typedef otb::Image<PixelType,ImageDimension> FixedImageType; + typedef otb::Image<DeformationPixelType, + ImageDimension> DeformationFieldType; + + //Create the filter + typedef otb::NCCRegistrationFilter< FixedImageType, + MovingImageType, + DeformationFieldType > + RegistrationFilterType; + + // Instantiation + RegistrationFilterType::Pointer registrator = RegistrationFilterType::New(); + + return EXIT_SUCCESS; +} diff --git a/Utilities/FLTK/fluid/CMakeLists.txt b/Utilities/FLTK/fluid/CMakeLists.txt index 5cc1f0bfe2700e6678ad5df0301278319a487902..c06a0a39156d5722b9d1d694d725beb87c66f043 100644 --- a/Utilities/FLTK/fluid/CMakeLists.txt +++ b/Utilities/FLTK/fluid/CMakeLists.txt @@ -27,8 +27,8 @@ INSTALL_TARGETS(/bin fluid) TARGET_LINK_LIBRARIES(fluid ${OTB_VISU_GUI_LIBRARIES} ${FLTK_PLATFORM_DEPENDENT_LIBS}) IF(OPENGL_FOUND) TARGET_LINK_LIBRARIES(fluid fltk_gl) - IF(APPLE) - TARGET_LINK_LIBRARIES(fluid -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib) - ENDIF(APPLE) +# IF(APPLE) +# TARGET_LINK_LIBRARIES(fluid -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib) +# ENDIF(APPLE) ENDIF(OPENGL_FOUND)