diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 61478a057aff60b437b7346ed10b2c2138c63ca9..034c32ab08cc767208cc65c9e84613f26e25489d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -168,52 +168,52 @@ macos-xdk-build:
- git checkout -f -q %CI_COMMIT_SHA%
# - Win10
-windows-10-prepare:
- extends: .windows-prepare
- tags:
- - windows10
- script:
- - call ./CI/dev_env.bat x64 xdk 10
- - clcache.exe -s
- - ctest -C Release -V -S CI/prepare_superbuild.cmake
- - clcache.exe -s
+#~ windows-10-prepare:
+ #~ extends: .windows-prepare
+ #~ tags:
+ #~ - windows10
+ #~ script:
+ #~ - call ./CI/dev_env.bat x64 xdk 10
+ #~ - clcache.exe -s
+ #~ - ctest -C Release -V -S CI/prepare_superbuild.cmake
+ #~ - clcache.exe -s
-windows-10-build:
- extends: .windows-build
- tags:
- - windows10
- script:
- - call ./CI/dev_env.bat x64 otb 10
- - clcache.exe -s
- - ctest -V -S CI/main_superbuild.cmake
- - clcache.exe -s
- - ctest -V -S CI/main_packages.cmake
- dependencies:
- - windows-10-prepare
+#~ windows-10-build:
+ #~ extends: .windows-build
+ #~ tags:
+ #~ - windows10
+ #~ script:
+ #~ - call ./CI/dev_env.bat x64 otb 10
+ #~ - clcache.exe -s
+ #~ - ctest -V -S CI/main_superbuild.cmake
+ #~ - clcache.exe -s
+ #~ - ctest -V -S CI/main_packages.cmake
+ #~ dependencies:
+ #~ - windows-10-prepare
# - Win8.1
-windows-8-prepare:
- extends: .windows-prepare
- tags:
- - windows8
- script:
- - call ./CI/dev_env.bat x86 xdk 8.1
- - clcache.exe -s
- - ctest -C Release -V -S CI/prepare_superbuild.cmake
- - clcache.exe -s
+#~ windows-8-prepare:
+ #~ extends: .windows-prepare
+ #~ tags:
+ #~ - windows8
+ #~ script:
+ #~ - call ./CI/dev_env.bat x86 xdk 8.1
+ #~ - clcache.exe -s
+ #~ - ctest -C Release -V -S CI/prepare_superbuild.cmake
+ #~ - clcache.exe -s
-windows-8-build:
- extends: .windows-build
- tags:
- - windows8
- script:
- - call ./CI/dev_env.bat x86 otb 8.1
- - clcache.exe -s
- - ctest -V -S CI/main_superbuild.cmake
- - clcache.exe -s
- - ctest -V -S CI/main_packages.cmake
- dependencies:
- - windows-8-prepare
+#~ windows-8-build:
+ #~ extends: .windows-build
+ #~ tags:
+ #~ - windows8
+ #~ script:
+ #~ - call ./CI/dev_env.bat x86 otb 8.1
+ #~ - clcache.exe -s
+ #~ - ctest -V -S CI/main_superbuild.cmake
+ #~ - clcache.exe -s
+ #~ - ctest -V -S CI/main_packages.cmake
+ #~ dependencies:
+ #~ - windows-8-prepare
#------------------------- QA related jobs -------------------------------------
ubuntu-xdk-qa-code-coverage:
@@ -289,8 +289,8 @@ deploy:
- ubuntu-xdk-build
- centos-xdk-build
- macos-xdk-build
- - windows-8-build
- - windows-10-build
+# - windows-8-build
+# - windows-10-build
release-container:
image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
diff --git a/CMake/OTBCheckTargetSystemArch.cmake b/CMake/OTBCheckTargetSystemArch.cmake
index a15ac1e0364b6b99f7816f3c4c3950d2defd1a52..522bdc148f83279cc52e1e630910627c3993e4ff 100644
--- a/CMake/OTBCheckTargetSystemArch.cmake
+++ b/CMake/OTBCheckTargetSystemArch.cmake
@@ -44,10 +44,10 @@ macro(OTB_CHECK_TARGET_SYSTEM_ARCH _RESULT1 _RESULT2)
OUTPUT_VARIABLE ov
OUTPUT_STRIP_TRAILING_WHITESPACE
)
-
+
set(${_RESULT1} "${ov}")
set(${_RESULT2} FALSE)
- if("${ov}" STREQUAL "x86_64")
+ if("${ov}" MATCHES "(x86_64|amd64)")
set(${_RESULT2} TRUE)
endif()
endif()
diff --git a/CMake/OTBSetStandardCompilerFlags.cmake b/CMake/OTBSetStandardCompilerFlags.cmake
index 6a7cad037a8930553b177ba94e29e87a9079cc1d..0065ead5b4df5296c1a2d5f2b803ee9573668fbe 100644
--- a/CMake/OTBSetStandardCompilerFlags.cmake
+++ b/CMake/OTBSetStandardCompilerFlags.cmake
@@ -190,41 +190,19 @@ macro(check_compiler_platform_flags)
endif()
endif()
- if(WIN32)
- # Some libraries (e.g. vxl libs) have no dllexport markup, so we can
- # build full shared libraries only with the GNU toolchain. For non
- # gnu compilers on windows, only Common is shared. This allows for
- # plugin type applications to use a dll for OTBCommon which will contain
- # the static for Modified time.
- if(CMAKE_COMPILER_IS_GNUCXX)
- # CMake adds --enable-all-exports on Cygwin (since Cygwin is
- # supposed to be UNIX-like), but we need to add it explicitly for
- # a native windows build with the MinGW tools.
- if(MINGW)
- set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS
- "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import")
- set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS
- "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import")
- set(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-auto-import")
- endif()
- else()
- if(MSVC)
- set(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} /MANIFEST:NO")
- endif()
- # if CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS is on, then
- # BUILD_SHARED_LIBS works as it would on other systems
- if(NOT CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS)
- if(BUILD_SHARED_LIBS)
- set(OTB_LIBRARY_BUILD_TYPE "SHARED")
- else()
- set(OTB_LIBRARY_BUILD_TYPE "STATIC")
- endif()
- # turn off BUILD_SHARED_LIBS as OTB_LIBRARY_BUILD_TYPE
- # is used on the libraries that have markup.
- set(BUILD_SHARED_LIBS OFF)
- endif()
- endif()
+ # CMake adds --enable-all-exports on Cygwin (since Cygwin is
+ # supposed to be UNIX-like), but we need to add it explicitly for
+ # a native windows build with the MinGW tools.
+ if(WIN32 AND MINGW AND CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS
+ "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import")
+ set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS
+ "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import")
+ set(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-auto-import")
+ elseif(MSVC)
+ set(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} /MANIFEST:NO")
endif()
+
#-----------------------------------------------------------------------------
#OTB requires special compiler flags on some platforms.
if(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 256b63ce38b97cbf568db835ed361fa371d9a004..3771a7d600e721fc9e1ba5e00a3b2b6cbf32eb89 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -220,7 +220,7 @@ option(BUILD_SHARED_LIBS "Build OTB with shared libraries." ON)
set(OTB_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
if(MSVC)
- option(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "Build OTB with shared libraries." ON)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF CACHE INTERNAL "" )
set(OTB_CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ${CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS})
else()
set(OTB_CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
diff --git a/Data/Baseline/OTB/Images/obTuWatershedSegmentationFilterLabelImage.1.tif b/Data/Baseline/OTB/Images/obTuWatershedSegmentationFilterLabelImage.1.tif
new file mode 100644
index 0000000000000000000000000000000000000000..51d4c7edcfb4f437a81b3b303ac52bcc201dff7c
--- /dev/null
+++ b/Data/Baseline/OTB/Images/obTuWatershedSegmentationFilterLabelImage.1.tif
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:49831ab756458243d99367e06884eab40737b9dd113ed09628bdc638a07705f2
+size 827613
diff --git a/Data/Input/ADS40RoiSmall.png.aux.xml b/Data/Input/ADS40RoiSmall.png.aux.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2ed238186380d66d34dd11447a9b4a9c74d552eb
--- /dev/null
+++ b/Data/Input/ADS40RoiSmall.png.aux.xml
@@ -0,0 +1,10 @@
+
+
+
+ 255
+ 120.1091003418
+ 23
+ 48.85195761071
+
+
+
diff --git a/Examples/BasicFilters/HillShadingExample.cxx b/Examples/BasicFilters/HillShadingExample.cxx
index 053767bcadd06682e64890f2fb3c2fdf8036963f..6ad5838e076cc84b458eea3a0007f35b2934985f 100644
--- a/Examples/BasicFilters/HillShadingExample.cxx
+++ b/Examples/BasicFilters/HillShadingExample.cxx
@@ -30,6 +30,7 @@
#include "otbDEMToImageGenerator.h"
#include "otbHillShadingFilter.h"
+#include "itkBinaryFunctorImageFilter.h"
#include "itkScalarToRGBColormapImageFilter.h"
#include "otbReliefColormapFunctor.h"
#include "itkMultiplyImageFilter.h"
diff --git a/Examples/DisparityMap/StereoReconstructionExample.cxx b/Examples/DisparityMap/StereoReconstructionExample.cxx
index d553c5e1071391d148addb916bd9964d5363ca31..4cd4963700d824cea574a9937ff85832264a80af 100644
--- a/Examples/DisparityMap/StereoReconstructionExample.cxx
+++ b/Examples/DisparityMap/StereoReconstructionExample.cxx
@@ -48,7 +48,13 @@
#include "otbImageFileWriter.h"
#include "otbBCOInterpolateImageFunction.h"
#include "itkUnaryFunctorImageFilter.h"
+
+#if ITK_VERSION_MAJOR < 5
#include "itkVectorCastImageFilter.h"
+#else
+#include "otbCastImageFilter.h"
+#endif
+
#include "otbImageList.h"
#include "otbImageListToVectorImageFilter.h"
#include "itkRescaleIntensityImageFilter.h"
@@ -93,7 +99,11 @@ int main(int argc, char* argv[])
using DisplacementType = itk::Vector;
using DisplacementFieldType = otb::Image;
+#if ITK_VERSION_MAJOR < 5
using DisplacementFieldCastFilterType = itk::VectorCastImageFilter;
+#else
+ using DisplacementFieldCastFilterType = otb::CastImageFilter;
+#endif
using WarpFilterType = otb::StreamingWarpImageFilter;
diff --git a/Examples/IO/DEMHandlerExample.cxx b/Examples/IO/DEMHandlerExample.cxx
index a133e2eff49e8bf0e3f3fe443dcafdf42027aa9d..4ce83de75a1e0f8e8061139c9593788233171e64 100644
--- a/Examples/IO/DEMHandlerExample.cxx
+++ b/Examples/IO/DEMHandlerExample.cxx
@@ -34,6 +34,9 @@
// library.
#include "otbDEMHandler.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
int main(int argc, char* argv[])
{
diff --git a/Examples/Iterators/ImageSliceIteratorWithIndex.cxx b/Examples/Iterators/ImageSliceIteratorWithIndex.cxx
index 66dbf8336aa4be5a8245bd9d3e4f3de64cfd692e..6bc8eace465ab2ae215f377d9a5494551d56bfc2 100644
--- a/Examples/Iterators/ImageSliceIteratorWithIndex.cxx
+++ b/Examples/Iterators/ImageSliceIteratorWithIndex.cxx
@@ -102,6 +102,10 @@
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
int main(int argc, char* argv[])
{
// Verify the number of parameters on the command line.
diff --git a/Modules/Adapters/OSSIMAdapters/test/otbDEMHandlerTest.cxx b/Modules/Adapters/OSSIMAdapters/test/otbDEMHandlerTest.cxx
index f72fd72c28f20681a917d23082eb26db5037be6d..6fd07e96b4f9bd2422ca6b43b6e50b71b8defd19 100644
--- a/Modules/Adapters/OSSIMAdapters/test/otbDEMHandlerTest.cxx
+++ b/Modules/Adapters/OSSIMAdapters/test/otbDEMHandlerTest.cxx
@@ -22,6 +22,10 @@
#include "itkMacro.h"
#include "otbDEMHandler.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
int otbDEMHandlerTest(int argc, char * argv[])
{
if(argc!=9)
diff --git a/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx b/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx
index af1a1d0402b965650d28747d95a3cb235903be37..9f4dafcf3921204260006b000db295c5a29bcaec 100644
--- a/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx
+++ b/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx
@@ -238,7 +238,7 @@ private:
// constant
case 1:
{
- std::vector parts = itksys::SystemTools::SplitString(this->GetParameterString("strategy.constant.nb"),' ');
+ auto parts = itksys::SystemTools::SplitString(this->GetParameterString("strategy.constant.nb"),' ');
std::vector countList;
for (unsigned int i=0 ; i parts = itksys::SystemTools::SplitString(this->GetParameterString("strategy.percent.p"),' ');
+ auto parts = itksys::SystemTools::SplitString(this->GetParameterString("strategy.percent.p"),' ');
std::vector percentList;
for (unsigned int i=0 ; i parts = itksys::SystemTools::SplitString(this->GetParameterString("strategy.total.v"),' ');
+ auto parts = itksys::SystemTools::SplitString(this->GetParameterString("strategy.total.v"),' ');
std::vector totalList;
for (unsigned int i=0 ; i words = itksys::SystemTools::SplitString(line,sep);
+ auto words = itksys::SystemTools::SplitString(line,sep);
if (nbCols == 0)
{
// detect separator and feature size
diff --git a/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx b/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx
index 3e2d3c361c11570cf22c45720e1f373247049b63..9c994f830a4462fb41d9e2fc7c6dff56d8fc4ccb 100644
--- a/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx
+++ b/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx
@@ -29,8 +29,12 @@
#include "otbConcatenateVectorImageFilter.h"
#include "otbMultiToMonoChannelExtractROI.h"
#include "otbImageToVectorImageCastFilter.h"
-#include "itkVectorCastImageFilter.h"
+#if ITK_VERSION_MAJOR < 5
+#include "itkVectorCastImageFilter.h"
+#else
+#include "otbCastImageFilter.h"
+#endif
namespace otb
{
@@ -56,10 +60,15 @@ public:
typedef itk::Vector DisplacementType;
typedef otb::Image DisplacementFieldType;
+#if ITK_VERSION_MAJOR < 5
typedef itk::VectorCastImageFilter
DisplacementFieldCastFilterType;
-
+#else
+ typedef otb::CastImageFilter
+ DisplacementFieldCastFilterType;
+#endif
typedef otb::StreamingWarpImageFilter
DisplacementType;
typedef otb::Image DisplacementFieldType;
+#if ITK_VERSION_MAJOR < 5
typedef itk::VectorCastImageFilter
- DisplacementFieldCastFilterType;
+ DisplacementFieldCastFilterType;
+#else
+ typedef otb::CastImageFilter
+ DisplacementFieldCastFilterType;
+#endif
typedef itk::InverseDisplacementFieldImageFilter
InverseDisplacementFieldFilterType;
diff --git a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx
index 5e6eee5bc6bdf2f5d73aaa1852edb187254a726d..98b718327c4a9ef189b958cfad3ea609a3630548 100644
--- a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx
+++ b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx
@@ -25,7 +25,13 @@
// Elevation handler
#include "otbWrapperElevationParametersHandler.h"
#include "itkInverseDisplacementFieldImageFilter.h"
+
+#if ITK_VERSION_MAJOR < 5
#include "itkVectorCastImageFilter.h"
+#else
+#include "otbCastImageFilter.h"
+#endif
+
#include "itkVectorIndexSelectionCastImageFilter.h"
#include "otbImageList.h"
#include "otbImageListToVectorImageFilter.h"
@@ -52,9 +58,15 @@ public:
typedef itk::Vector DisplacementType;
typedef otb::Image DisplacementFieldType;
+#if ITK_VERSION_MAJOR < 5
typedef itk::VectorCastImageFilter
DisplacementFieldCastFilterType;
+ DisplacementFieldType> DisplacementFieldCastFilterType;
+#else
+ typedef otb::CastImageFilter
+ DisplacementFieldCastFilterType;
+#endif
typedef itk::InverseDisplacementFieldImageFilter
InverseDisplacementFieldFilterType;
diff --git a/Modules/Core/Common/include/otbCastImageFilter.h b/Modules/Core/Common/include/otbCastImageFilter.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b3ad0d22912e80133f0c5422571deaf208fb783
--- /dev/null
+++ b/Modules/Core/Common/include/otbCastImageFilter.h
@@ -0,0 +1,115 @@
+/*=========================================================================
+ *
+ * Copyright Insight Software Consortium
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *=========================================================================*/
+#ifndef otbCastImageFilter_h
+#define otbCastImageFilter_h
+
+#if ITK_VERSION_MAJOR >= 5
+#include "itkUnaryFunctorImageFilter.h"
+#include "itkProgressReporter.h"
+
+#include
+
+namespace otb
+{
+
+/** \class CastImageFilter
+ *
+ * \brief Casts input pixels to output pixel type.
+ *
+ * This filter is templated over the input image type
+ * and the output image type.
+ *
+ * A typical use is to cast a
+ \code
+ itk::Image
+ \endcode
+ * to a
+ \code
+ itk::Image
+ \endcode
+ *
+ * This filter can also be used to cast a
+ \code
+ itk::VectorImage
+ \endcode
+ * to a
+ \code
+ itk::VectorImage
+ \endcode
+ *
+ * This class is copied from the itkCastImageFilter, but it doesn't have
+ * a static assertion requiring the input and output pixel dimension to match,
+ * thus this filter can be used to convert to and from variableLengthVector.
+ *
+ * If you need to perform a dimensionaly reduction, you may want
+ * to use the ExtractImageFilter instead of the CastImageFilter.
+ *
+ * \ingroup OTBCommon
+ */
+template< typename TInputImage, typename TOutputImage >
+class ITK_TEMPLATE_EXPORT CastImageFilter:
+ public itk::InPlaceImageFilter< TInputImage, TOutputImage >
+{
+public:
+ ITK_DISALLOW_COPY_AND_ASSIGN(CastImageFilter);
+
+ /** Standard class type aliases. */
+ using Self = CastImageFilter;
+
+ using Superclass = itk::InPlaceImageFilter< TInputImage, TOutputImage >;
+
+ using Pointer = itk::SmartPointer< Self >;
+ using ConstPointer = itk::SmartPointer< const Self >;
+
+
+ using OutputImageRegionType = typename Superclass::OutputImageRegionType;
+
+ using InputPixelType = typename TInputImage::PixelType;
+ using OutputPixelType = typename TOutputImage::PixelType;
+
+ /** Method for creation through the object factory. */
+ itkNewMacro(Self);
+
+ /** Run-time type information (and related methods). */
+ itkTypeMacro(CastImageFilter, InPlaceImageFilter);
+
+protected:
+ CastImageFilter();
+ virtual ~CastImageFilter() = default;
+
+ void GenerateOutputInformation() override;
+
+ void GenerateData() override;
+
+ void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
+
+ template
+ void DynamicThreadedGenerateDataDispatched(const OutputImageRegionType & outputRegionForThread, std::true_type isConvertible);
+
+ template
+ void DynamicThreadedGenerateDataDispatched(const OutputImageRegionType & outputRegionForThread, std::false_type isConvertible);
+};
+} // end namespace otb
+
+#endif
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbCastImageFilter.hxx"
+#endif
+
+#endif // ITK_VERSION_MAJOR
diff --git a/Modules/Core/Common/include/otbCastImageFilter.hxx b/Modules/Core/Common/include/otbCastImageFilter.hxx
new file mode 100644
index 0000000000000000000000000000000000000000..75c16faa695a89c82945cf98d1f31c14297807bd
--- /dev/null
+++ b/Modules/Core/Common/include/otbCastImageFilter.hxx
@@ -0,0 +1,178 @@
+/*=========================================================================
+ *
+ * Copyright Insight Software Consortium
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *=========================================================================*/
+#ifndef itkCastImageFilter_hxx
+#define itkCastImageFilter_hxx
+
+#if ITK_VERSION_MAJOR >= 5
+
+#include "otbCastImageFilter.h"
+#include "itkProgressReporter.h"
+#include "itkImageAlgorithm.h"
+
+namespace otb
+{
+
+
+template< typename TInputImage, typename TOutputImage >
+CastImageFilter< TInputImage, TOutputImage >
+::CastImageFilter()
+{
+ this->SetNumberOfRequiredInputs(1);
+ this->InPlaceOff();
+ this->DynamicMultiThreadingOn();
+}
+
+template< typename TInputImage, typename TOutputImage >
+void
+CastImageFilter< TInputImage, TOutputImage >
+::GenerateData()
+{
+ if ( this->GetInPlace() && this->CanRunInPlace() )
+ {
+ // nothing to do, so avoid iterating over all the pixels
+ // for nothing! Allocate the output, generate a fake progress and exit
+ this->AllocateOutputs();
+ itk::ProgressReporter progress(this, 0, 1);
+ return;
+ }
+ //else do normal Before+Threaded+After
+ Superclass::GenerateData();
+}
+
+
+template< typename TInputImage, typename TOutputImage >
+void
+CastImageFilter< TInputImage, TOutputImage >
+::GenerateOutputInformation()
+ {
+ // do not call the superclass' implementation of this method since
+ // this filter allows the input the output to be of different dimensions
+
+ // get pointers to the input and output
+ TOutputImage *outputPtr = this->GetOutput();
+ const TInputImage *inputPtr = this->GetInput();
+
+ if ( !outputPtr || !inputPtr )
+ {
+ return;
+ }
+
+ // Set the output image largest possible region. Use a RegionCopier
+ // so that the input and output images can have different dimensions.
+ OutputImageRegionType outputLargestPossibleRegion;
+ this->CallCopyInputRegionToOutputRegion( outputLargestPossibleRegion,
+ inputPtr->GetLargestPossibleRegion() );
+ outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion);
+
+ itk::ImageToImageFilterDetail::ImageInformationCopier
+ informationCopier;
+ informationCopier(outputPtr, inputPtr);
+
+ }
+
+
+template< typename TInputImage, typename TOutputImage >
+void
+CastImageFilter< TInputImage, TOutputImage >
+::DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread)
+{
+ DynamicThreadedGenerateDataDispatched(outputRegionForThread,
+ std::is_convertible());
+}
+
+template< typename TInputImage, typename TOutputImage >
+template
+void
+CastImageFilter< TInputImage, TOutputImage >
+::DynamicThreadedGenerateDataDispatched(const OutputImageRegionType & outputRegionForThread, std::true_type)
+{
+ const TInputImage *inputPtr = this->GetInput();
+ TOutputImage *outputPtr = this->GetOutput(0);
+
+ // Define the portion of the input to walk for this thread, using
+ // the CallCopyOutputRegionToInputRegion method allows for the input
+ // and output images to be different dimensions
+ typename TInputImage::RegionType inputRegionForThread;
+
+ this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
+
+ itk::ImageAlgorithm::Copy( inputPtr, outputPtr, inputRegionForThread, outputRegionForThread );
+}
+
+
+template< typename TInputImage, typename TOutputImage >
+template
+void
+CastImageFilter< TInputImage, TOutputImage >
+::DynamicThreadedGenerateDataDispatched(const OutputImageRegionType & outputRegionForThread, std::false_type)
+{
+ // Implementation for non-implicit convertible pixels which are
+ // itk-array-like.
+
+ //static_assert( OutputPixelType::Dimension == InputPixelType::Dimension, "Vector dimensions are required to match!" );
+ static_assert( std::is_convertible::value, "Component types are required to be convertible." );
+
+ const typename OutputImageRegionType::SizeType ®ionSize = outputRegionForThread.GetSize();
+
+ if( regionSize[0] == 0 )
+ {
+ return;
+ }
+ const TInputImage *inputPtr = this->GetInput();
+ TOutputImage *outputPtr = this->GetOutput(0);
+
+ // Define the portion of the input to walk for this thread, using
+ // the CallCopyOutputRegionToInputRegion method allows for the input
+ // and output images to be different dimensions
+ typename TInputImage::RegionType inputRegionForThread;
+
+ this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
+
+ // Define the iterators
+ itk::ImageScanlineConstIterator< TInputImage > inputIt(inputPtr, inputRegionForThread);
+ itk::ImageScanlineIterator< TOutputImage > outputIt(outputPtr, outputRegionForThread);
+
+ inputIt.GoToBegin();
+ outputIt.GoToBegin();
+ while ( !inputIt.IsAtEnd() )
+ {
+ while ( !inputIt.IsAtEndOfLine() )
+ {
+ const InputPixelType &inputPixel = inputIt.Get();
+ OutputPixelType value;
+ for ( unsigned int k = 0; k < OutputPixelType::Dimension; k++ )
+ {
+ value[k] = static_cast< typename OutputPixelType::ValueType >( inputPixel[k] );
+ }
+ outputIt.Set( value );
+
+ ++inputIt;
+ ++outputIt;
+ }
+ inputIt.NextLine();
+ outputIt.NextLine();
+ }
+
+}
+
+} // end namespace otb
+
+#endif
+
+#endif // ITK_VERSION_MAJOR
diff --git a/Modules/Core/Common/include/otbFunctionToImageFilter.hxx b/Modules/Core/Common/include/otbFunctionToImageFilter.hxx
index 7a35c8dd2f9ff97e1b5cd67afdaa7340f6771b35..5fa0e694aa38e9ae44b46828da81e129935d95e6 100644
--- a/Modules/Core/Common/include/otbFunctionToImageFilter.hxx
+++ b/Modules/Core/Common/include/otbFunctionToImageFilter.hxx
@@ -22,6 +22,7 @@
#ifndef otbFunctionToImageFilter_hxx
#define otbFunctionToImageFilter_hxx
+#include "otbMacro.h" // for OTB_DISABLE_DYNAMIC_MT;
#include "otbFunctionToImageFilter.h"
#include "itkImageRegionConstIterator.h"
#include "itkProgressReporter.h"
@@ -36,6 +37,7 @@ template
FunctionToImageFilter
::FunctionToImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->InPlaceOff();
m_PixelFunction = FunctionType::New();
}
diff --git a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h
index 047f6fe0927ba2eb66be9e57ad2586c059ef882f..2e8c18bdba841044c3fd03b2cb47054306808eb1 100644
--- a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h
+++ b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h
@@ -26,7 +26,13 @@
#include "itkImageRegionSplitter.h"
#include "itkIndex.h"
#include "itkSize.h"
+
+#if ITK_VERSION_MAJOR < 5
#include "itkFastMutexLock.h"
+#include "itkMutexLockHolder.h"
+#else
+#include
+#endif
namespace otb
{
@@ -176,7 +182,11 @@ private:
mutable bool m_IsUpToDate;
// Lock to ensure thread-safety
+#if ITK_VERSION_MAJOR < 5
itk::SimpleFastMutexLock m_Lock;
+#else
+ std::mutex m_Lock;
+#endif
};
} // end namespace otb
diff --git a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.hxx b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.hxx
index c29956a9d1cc2e96ed699341f9a4a4afe8fc3776..da1876ecc0e67172aedd4bd7de38f2d4f913ce6f 100644
--- a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.hxx
+++ b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.hxx
@@ -41,13 +41,16 @@ ImageRegionAdaptativeSplitter
this->SetRequestedNumberOfSplits(requestedNumber);
// Check if we need to compute split map agagin
- m_Lock.Lock();
+#if ITK_VERSION_MAJOR < 5
+ itk::MutexLockHolder mutexHolder(m_Lock);
+#else
+ std::lock_guard mutexHolder(m_Lock);
+#endif
if(!m_IsUpToDate)
{
// Do so if we need to
this->EstimateSplitMap();
}
- m_Lock.Unlock();
// Return the size of the split map
return m_StreamVector.size();
@@ -62,13 +65,16 @@ ImageRegionAdaptativeSplitter
this->SetImageRegion(region);
// Check if we need to compute split map agagin
- m_Lock.Lock();
+#if ITK_VERSION_MAJOR < 5
+ itk::MutexLockHolder mutexHolder(m_Lock);
+#else
+ std::lock_guard mutexHolder(m_Lock);
+#endif
if(!m_IsUpToDate)
{
// Do so if we need to
this->EstimateSplitMap();
}
- m_Lock.Unlock();
// Return the requested split
return m_StreamVector.at(i);
diff --git a/Modules/Core/Common/include/otbMacro.h b/Modules/Core/Common/include/otbMacro.h
index f83adbe0b6937d40ff5d358f7b46b894526c0444..a63b3b5a5811a0e9c11def915d16f9443ba625ed 100644
--- a/Modules/Core/Common/include/otbMacro.h
+++ b/Modules/Core/Common/include/otbMacro.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
+ * Copyright (C) 2018 CS Systemes d'Information (CS SI)
*
* This file is part of Orfeo Toolbox
*
@@ -30,6 +31,7 @@
#include "itkMacro.h"
#include "itkObject.h"
+#include "itkThreadSupport.h"
#include "otbConfigure.h"
#include "otbLogger.h"
@@ -42,7 +44,61 @@
namespace otb
{
} // end namespace otb - this is here for documentation purposes
+/* ITK 5.0 uses a different threading model compared to ITK 4.x.
+ * This has a significant impact on OTB as we make heavy use of itk filters.
+ * DynamicThreadedGenerateData() is the newer variant without threadId,
+ * and is the preferred signature, which is called by default. This
+ * variant can split the requested region into different number of
+ * pieces depending on current multi-processing load, which allows
+ * better load balancing. The non-dynamic (also known as classic)
+ * ThreadedGenerateData() signature has threadId, and number of pieces
+ * to be split into is known in advance. It is activated by calling
+ * this->DynamicMultiThreadingOff(); in derived class constructor.
+ *
+ * OTB uses ThreadedGenerateData() with threadId and thus required
+ * to call this->DynamicMultiThreadingOff(); in filter's constructor.
+ *
+ * OTB_DISABLE_DYNAMIC_MT is a simple macro that insert this
+ * function call *IF* itk version used is 5.0 or above.
+ * This macro expands to empty when OTB is built with ITK 4.x and
+ * this ease from ITK 4.x to ITK 5.x. Ideally ThreadedGenerateData() function
+ * everywhere in OTB must be replace with DynamicThreadedGenerateData().
+ * This for sure is not a glorified sed command. Usage of function parameter
+ * threadId (and progress reporter) must be removed as well.
+ *
+ * It also leads us into a situation that OTB will no longer work with ITK 4.x.
+ * We cannot break that until ITK 5.0 is available on all platforms and is well tested.
+ * As time of writing this patch ITK 5.0 is in alpha release.
+ * Eventually OTB can move up in direction where it is requires ITK 5.0 or.
+ * But until things are resolved this macro based compatibility must stay.
+ *
+ * Finally please note that OTB_DISABLE_DYNAMIC_MT does not disable multithreading.
+ * Method or macro name can sometimes cause confusion when reading code.
+ *
+ * sample run-time exception:
+ * =========================
+ * 2018-06-04 15:30:09 (DEBUG): Caught itk::ExceptionObject during application execution:
+ * 2018-06-04 15:30:09 (DEBUG): /usr/src/ports/itk/Modules/Core/Common/src/itkPoolMultiThreader.cxx:202:
+ * itk::ERROR: PoolMultiThreader(0xabad1dea): Exception occurred during SingleMethodExecute
+ * /home/rashad/local/include/ITK-5.0/itkImageSource.hxx:276:
+ * itk::ERROR: ShiftScaleImageFilter(0xabad1deaff): Subclass should override this method!!!
+ * If old behavior is desired invoke this->DynamicMultiThreadingOff(); before Update() is called. The best place is in class constructor.
+ */
+#if ITK_VERSION_MAJOR < 5
+#define OTB_DISABLE_DYNAMIC_MT
+#else
+#define OTB_DISABLE_DYNAMIC_MT this->DynamicMultiThreadingOff();
+#endif
+/*
+//ITK_THREAD_RETURN_TYPE and ITK_THREAD_RETURN_VALUE bas been changed in ITK5 (master)
+// we need to re-exposed to the global namespace to keep the
+// use of these items consistent.
+#if ITK_VERSION_MAJOR > 4
+#define ITK_THREAD_RETURN_TYPE itk::ITK_THREAD_RETURN_TYPE
+#define ITK_THREAD_RETURN_VALUE itk::ITK_THREAD_RETURN_DEFAULT_VALUE
+#endif
+*/
#define otbFileContext(x) \
<< "file " __FILE__ ", line " << __LINE__<<", " x
diff --git a/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.hxx b/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.hxx
index 1784ac381fdedc47cb36496508d7729f40fae3c9..acb8ccb19de3b0cbfee995a50097d25ac1198f11 100644
--- a/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.hxx
+++ b/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.hxx
@@ -22,6 +22,7 @@
#define otbUnaryFunctorNeighborhoodVectorImageFilter_hxx
#include "otbUnaryFunctorNeighborhoodVectorImageFilter.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "itkImageRegionIterator.h"
#include "itkNeighborhoodAlgorithm.h"
#include "itkProgressReporter.h"
@@ -36,6 +37,7 @@ template
UnaryFunctorNeighborhoodVectorImageFilter
::UnaryFunctorNeighborhoodVectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
this->InPlaceOff();
for ( unsigned int i = 0; i < InputImageDimension; ++i )
diff --git a/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.hxx b/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.hxx
index aee8a122564e0d486c0623ec00a3f5952503c407..2329b37500ab668653e70289e98e907e9464894e 100644
--- a/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.hxx
+++ b/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.hxx
@@ -24,6 +24,7 @@
#include "otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkProgressReporter.h"
+#include "otbMacro.h" // for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -34,6 +35,7 @@ template
UnaryFunctorWithIndexWithOutputSizeImageFilter
::UnaryFunctorWithIndexWithOutputSizeImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
}
template
diff --git a/Modules/Core/Common/src/otbConfigurationManager.cxx b/Modules/Core/Common/src/otbConfigurationManager.cxx
index 63d94a1540d4934bea54fa607633587c20ceb3c2..96e9c1c149a961b8ea79b760038337bfed462c10 100644
--- a/Modules/Core/Common/src/otbConfigurationManager.cxx
+++ b/Modules/Core/Common/src/otbConfigurationManager.cxx
@@ -23,7 +23,12 @@
#include "otbMacro.h"
#include "otbLogger.h"
+#if ITK_VERSION_MAJOR < 5
#include "itkMultiThreader.h"
+#else
+#include "itkMultiThreaderBase.h"
+#endif
+
#include "itksys/SystemTools.hxx"
#ifdef _OPENMP
@@ -110,9 +115,13 @@ int ConfigurationManager::InitOpenMPThreads()
{
int ret = 1;
#ifdef _OPENMP
+#if ITK_VERSION_MAJOR < 5
ret = itk::MultiThreader::GetGlobalDefaultNumberOfThreads();
+#else
+ ret = itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads();
+#endif //ITK_VERSION_MAJOR
omp_set_num_threads(ret);
-#endif
+#endif //_OPENMP
return ret;
}
diff --git a/Modules/Core/Common/src/otbLogger.cxx b/Modules/Core/Common/src/otbLogger.cxx
index 20685d1651d1bc4d249ab6d862acdc518fcde3e9..915d5d94ca6a62cfd57c9bda59dce5e87b6614f8 100644
--- a/Modules/Core/Common/src/otbLogger.cxx
+++ b/Modules/Core/Common/src/otbLogger.cxx
@@ -24,7 +24,12 @@
#include "itkStdStreamLogOutput.h"
#include
#include "gdal.h"
+
+#if ITK_VERSION_MAJOR < 5
#include "itkMultiThreader.h"
+#else
+#include "itkMultiThreaderBase.h"
+#endif
#include
#include
@@ -93,10 +98,17 @@ void Logger::LogSetupInformation()
this->Info(oss.str());
oss.str("");
oss.clear();
-
+
+#if ITK_VERSION_MAJOR < 5
oss<<"OTB will use at most "<<
itk::MultiThreader::GetGlobalDefaultNumberOfThreads()<<
" threads"<Info(oss.str());
oss.str("");
oss.clear();
diff --git a/Modules/Core/ImageBase/include/otbExtractROI.hxx b/Modules/Core/ImageBase/include/otbExtractROI.hxx
index 932ebe73ae7de73687331bd0c4f40fab5f55e47a..d117d1f04089da89b6005ac6f549384675b7880c 100644
--- a/Modules/Core/ImageBase/include/otbExtractROI.hxx
+++ b/Modules/Core/ImageBase/include/otbExtractROI.hxx
@@ -35,6 +35,7 @@ template
ExtractROI
::ExtractROI() //: ExtractROIBase< itk::Image , itk::Image >()
{
+ OTB_DISABLE_DYNAMIC_MT;
}
/**
diff --git a/Modules/Core/ImageBase/include/otbExtractROIBase.hxx b/Modules/Core/ImageBase/include/otbExtractROIBase.hxx
index 0f4395c1e925df4b15f427666851c8348a508281..2696be8a4d9510253d3ecf6b7433977be8595839 100644
--- a/Modules/Core/ImageBase/include/otbExtractROIBase.hxx
+++ b/Modules/Core/ImageBase/include/otbExtractROIBase.hxx
@@ -41,6 +41,7 @@ ExtractROIBase
m_SizeX(0),
m_SizeY(0)
{
+ OTB_DISABLE_DYNAMIC_MT;
}
/**
diff --git a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.hxx b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.hxx
index 5de4891097534ce12d7ec5e79ab807c38bacfed9..d2028c24a873406b08205848847cb0d0fa069431 100644
--- a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.hxx
+++ b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.hxx
@@ -42,6 +42,7 @@ MultiChannelExtractROI
m_LastChannel(0),
m_ChannelsKind(0)
{
+ OTB_DISABLE_DYNAMIC_MT;
ClearChannels();
}
diff --git a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.hxx b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.hxx
index 21f8b5b6692efae86810a06f81eb544a2832eb9f..5bdc52ae291e3898fd621db5bcbde7c75913a302 100644
--- a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.hxx
+++ b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.hxx
@@ -34,7 +34,7 @@ MultiToMonoChannelExtractROI
::MultiToMonoChannelExtractROI() : ExtractROIBase, Image >(),
m_Channel(1)
{
-
+ OTB_DISABLE_DYNAMIC_MT;
}
/**
diff --git a/Modules/Core/ImageBase/test/otbImagePCAShapeModelEstimatorTest.cxx b/Modules/Core/ImageBase/test/otbImagePCAShapeModelEstimatorTest.cxx
index c1cdff6be1ce9d9a0f83b87fe759364a0eb5dd89..4ffcec0d98e33979a35350db9f0921943084ccf3 100644
--- a/Modules/Core/ImageBase/test/otbImagePCAShapeModelEstimatorTest.cxx
+++ b/Modules/Core/ImageBase/test/otbImagePCAShapeModelEstimatorTest.cxx
@@ -33,6 +33,10 @@
#include "itkImagePCAShapeModelEstimator.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
//Data definitions
#define IMGWIDTH 2
#define IMGHEIGHT 2
diff --git a/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.hxx b/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.hxx
index 906a4fe69d43f57a0915ed083d1b9bb3100bd3d1..e8e4a045ee2e898cee6fdfcfc6db1f535f889fe3 100644
--- a/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.hxx
+++ b/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.hxx
@@ -22,6 +22,7 @@
#ifndef otbLabelImageToLabelMapWithAdjacencyFilter_hxx
#define otbLabelImageToLabelMapWithAdjacencyFilter_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbLabelImageToLabelMapWithAdjacencyFilter.h"
#include "itkNumericTraits.h"
#include "itkProgressReporter.h"
@@ -34,6 +35,7 @@ template
LabelImageToLabelMapWithAdjacencyFilter
::LabelImageToLabelMapWithAdjacencyFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_BackgroundValue = itk::NumericTraits::NonpositiveMin();
}
diff --git a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h
index 5040c40f7976726e8bb6c4ea0f16bf4f60f0a88b..abc544888c582cc6ba98a8ea0e6f72e4794c3897 100644
--- a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h
+++ b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h
@@ -22,6 +22,8 @@
#ifndef otbShapeAttributesLabelMapFilter_h
#define otbShapeAttributesLabelMapFilter_h
+#include "itkConfigure.h"
+
#include "otbLabelMapFeaturesFunctorImageFilter.h"
#include "otbImage.h"
#include "otbPolygon.h"
@@ -29,12 +31,39 @@
#include "otbFlusserPathFunction.h"
#include "otbSimplifyPathFunctor.h"
-
namespace otb
{
namespace Functor
{
+/** \class OffsetLexicographicCompare
+ * \brief Order Offset instances lexicographically.
+ *
+ * This is a comparison functor suitable for storing Offset instances
+ * in an STL container. The ordering is total and unique but has
+ * little geometric meaning.
+ * This class is copied from ITK 4.12.0 for compatability with ITK 4, 5( alpha2), ITK5 (master)
+ * \ingroup OTBLabelMap
+ */
+template< unsigned int VOffsetDimension >
+class OffsetLexicographicCompare
+{
+public:
+ bool operator()(itk::Offset< VOffsetDimension > const & l,
+ itk::Offset< VOffsetDimension > const & r) const
+ {
+ for ( unsigned int i = 0; i < VOffsetDimension; ++i ) {
+ if ( l[i] < r[i] ) {
+ return true;
+ }
+ else if ( l[i] > r[i] ) {
+ return false;
+ }
+ }
+ return false;
+ }
+};
+
/** \class ShapeAttributesLabelObjectFunctor
* \brief Functor to compute shape attributes of one LabelObject.
*
@@ -71,6 +100,7 @@ public:
itkStaticConstMacro(ImageDimension, unsigned int, TLabelObject::ImageDimension);
typedef itk::ImageRegion< TLabelObject::ImageDimension > RegionType;
typedef itk::Offset< TLabelObject::ImageDimension > OffsetType;
+ typedef otb::Functor::OffsetLexicographicCompare OffsetLexicographicCompare;
/** Constructor */
ShapeAttributesLabelObjectFunctor();
@@ -148,9 +178,10 @@ private:
typedef itk::Offset<3> Offset3Type;
typedef itk::Vector Spacing2Type;
typedef itk::Vector Spacing3Type;
- typedef std::map MapIntercept2Type;
- typedef std::map MapIntercept3Type;
-
+ typedef otb::Functor::OffsetLexicographicCompare<2> OffsetLexicographicCompare2;
+ typedef otb::Functor::OffsetLexicographicCompare<3> OffsetLexicographicCompare3;
+ typedef std::map MapIntercept2Type;
+ typedef std::map MapIntercept3Type;
template double PerimeterFromInterceptCount( TMapIntercept & intercepts, const TSpacing & spacing );
#if ! defined(ITK_DO_NOT_USE_PERIMETER_SPECIALIZATION)
diff --git a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.hxx b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.hxx
index 085c130b1fe4309500145476d29716adfd788f06..80e0209631bed913847056d6b76f49984dd6f2c1 100644
--- a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.hxx
+++ b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.hxx
@@ -36,6 +36,10 @@
#include "otbMacro.h"
#include
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
namespace otb {
namespace Functor {
@@ -735,7 +739,7 @@ ShapeAttributesLabelObjectFunctor
}
// a data structure to store the number of intercepts on each direction
- typedef typename std::map MapInterceptType;
+ typedef typename std::map MapInterceptType;
MapInterceptType intercepts;
// int nbOfDirections = (int)std::pow( 2.0, (int)ImageDimension ) - 1;
// intecepts.resize(nbOfDirections + 1); // code begins at position 1
diff --git a/Modules/Core/Metadata/include/otbNoDataHelper.h b/Modules/Core/Metadata/include/otbNoDataHelper.h
index 98cfc7caf166c43f3fffdfe2205c8ca5ff24153a..29d2257a985813cd6bb1b1e649fb13c24f513c47 100644
--- a/Modules/Core/Metadata/include/otbNoDataHelper.h
+++ b/Modules/Core/Metadata/include/otbNoDataHelper.h
@@ -26,6 +26,10 @@
#include
#include "OTBMetadataExport.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
namespace itk
{
class MetaDataDictionary;
diff --git a/Modules/Core/Metadata/src/otbImageMetadataInterfaceFactory.cxx b/Modules/Core/Metadata/src/otbImageMetadataInterfaceFactory.cxx
index 6d4f47301a330df7b44676a988aa97beae2c3085..7d4a9a0687c2ab61268de7247751fde1979bd2fb 100644
--- a/Modules/Core/Metadata/src/otbImageMetadataInterfaceFactory.cxx
+++ b/Modules/Core/Metadata/src/otbImageMetadataInterfaceFactory.cxx
@@ -39,8 +39,12 @@
#include "otbCosmoImageMetadataInterfaceFactory.h"
#include "otbRadarsat2ImageMetadataInterfaceFactory.h"
+#if ITK_VERSION_MAJOR < 5
#include "itkMutexLock.h"
#include "itkMutexLockHolder.h"
+#else
+#include
+#endif
#include
#include
@@ -100,12 +104,20 @@ ImageMetadataInterfaceFactory
::RegisterBuiltInFactories()
{
static bool firstTime = true;
-
+
+ #if ITK_VERSION_MAJOR < 5
static itk::SimpleMutexLock mutex;
+ #else
+ static std::mutex mutex;
+ #endif
{
// This helper class makes sure the Mutex is unlocked
// in the event an exception is thrown.
+ #if ITK_VERSION_MAJOR < 5
itk::MutexLockHolder mutexHolder(mutex);
+ #else
+ std::lock_guard mutexHolder(mutex);
+ #endif
if (firstTime)
{
itk::ObjectFactoryBase::RegisterFactory(IkonosImageMetadataInterfaceFactory::New());
diff --git a/Modules/Core/Metadata/src/otbOpticalImageMetadataInterfaceFactory.cxx b/Modules/Core/Metadata/src/otbOpticalImageMetadataInterfaceFactory.cxx
index abda05f537648c0eec3d37fb15dc3b6a81f8e0c3..2a0a48c72ca8efe30df17030789c5fe36e13b585 100644
--- a/Modules/Core/Metadata/src/otbOpticalImageMetadataInterfaceFactory.cxx
+++ b/Modules/Core/Metadata/src/otbOpticalImageMetadataInterfaceFactory.cxx
@@ -32,8 +32,12 @@
#include "otbPleiadesImageMetadataInterfaceFactory.h"
#include "otbSpot6ImageMetadataInterfaceFactory.h"
+#if ITK_VERSION_MAJOR < 5
#include "itkMutexLock.h"
#include "itkMutexLockHolder.h"
+#else
+#include
+#endif
namespace otb
{
@@ -80,11 +84,19 @@ OpticalImageMetadataInterfaceFactory
{
static bool firstTime = true;
+ #if ITK_VERSION_MAJOR < 5
static itk::SimpleMutexLock mutex;
+ #else
+ static std::mutex mutex;
+ #endif
{
// This helper class makes sure the Mutex is unlocked
// in the event an exception is thrown.
+ #if ITK_VERSION_MAJOR < 5
itk::MutexLockHolder mutexHolder(mutex);
+ #else
+ std::lock_guard mutexHolder(mutex);
+ #endif
if (firstTime)
{
itk::ObjectFactoryBase::RegisterFactory(IkonosImageMetadataInterfaceFactory::New());
diff --git a/Modules/Core/Metadata/src/otbSarImageMetadataInterfaceFactory.cxx b/Modules/Core/Metadata/src/otbSarImageMetadataInterfaceFactory.cxx
index 8ddf2b79c71b09ecfea1ff7abbb8dd29819700c1..65540719c47c638aba06a6a341a798aaf60f1e70 100644
--- a/Modules/Core/Metadata/src/otbSarImageMetadataInterfaceFactory.cxx
+++ b/Modules/Core/Metadata/src/otbSarImageMetadataInterfaceFactory.cxx
@@ -29,8 +29,12 @@
#include "otbCosmoImageMetadataInterfaceFactory.h"
#include "otbRadarsat2ImageMetadataInterfaceFactory.h"
+#if ITK_VERSION_MAJOR < 5
#include "itkMutexLock.h"
#include "itkMutexLockHolder.h"
+#else
+#include
+#endif
namespace otb
{
@@ -77,11 +81,19 @@ SarImageMetadataInterfaceFactory
{
static bool firstTime = true;
+ #if ITK_VERSION_MAJOR < 5
static itk::SimpleMutexLock mutex;
+ #else
+ static std::mutex mutex;
+ #endif
{
// This helper class makes sure the Mutex is unlocked
// in the event an exception is thrown.
+ #if ITK_VERSION_MAJOR < 5
itk::MutexLockHolder mutexHolder(mutex);
+ #else
+ std::lock_guard mutexHolder(mutex);
+ #endif
if (firstTime)
{
itk::ObjectFactoryBase::RegisterFactory(TerraSarImageMetadataInterfaceFactory::New());
diff --git a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h
index dc3a5bb291e530a022d26c2e924d43dd16e21666..7ad69e0d8fb63f52d019c7404fea4a825c5a6723 100644
--- a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h
+++ b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h
@@ -22,6 +22,13 @@
#define otbObjectListToObjectListFilter_h
#include "otbObjectListSource.h"
+#include "otbMacro.h" //for ITK_THREAD_RETURN_TYPE in ITK5
+
+#if ITK_VERSION_MAJOR < 5
+#include "itkMultiThreader.h"
+#else
+#include "itkMultiThreaderBase.h"
+#endif
namespace otb
{
@@ -101,7 +108,11 @@ protected:
/** Static function used as a "callback" by the MultiThreader. The threading
* library will call this routine for each thread, which will delegate the
* control to ThreadedGenerateData(). */
+#if ITK_VERSION_MAJOR >= 5
+ static itk::ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
+#else
static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
+#endif
/** Internal structure used for passing image data into the threading library */
struct ThreadStruct
diff --git a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.hxx b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.hxx
index a61230303c598eb0b9bc111703ed7d89ba185870..19d29155a969210c7446215adfe992a4271c9cca 100644
--- a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.hxx
+++ b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.hxx
@@ -146,7 +146,11 @@ ObjectListToObjectListFilter
}
template
+#if ITK_VERSION_MAJOR >= 5
+itk::ITK_THREAD_RETURN_TYPE
+#else
ITK_THREAD_RETURN_TYPE
+#endif
ObjectListToObjectListFilter
::ThreaderCallback(void *arg)
{
@@ -155,9 +159,15 @@ ObjectListToObjectListFilter
unsigned int total, start, stop;
unsigned int requestedElements;
+#if ITK_VERSION_MAJOR < 5
threadId = ((itk::MultiThreader::ThreadInfoStruct *) (arg))->ThreadID;
threadCount = ((itk::MultiThreader::ThreadInfoStruct *) (arg))->NumberOfThreads;
str = (ThreadStruct *) (((itk::MultiThreader::ThreadInfoStruct *) (arg))->UserData);
+#else
+ threadId = ((itk::MultiThreaderBase::ThreadInfoStruct *) (arg))->ThreadID;
+ threadCount = ((itk::MultiThreaderBase::ThreadInfoStruct *) (arg))->NumberOfThreads;
+ str = (ThreadStruct *) (((itk::MultiThreaderBase::ThreadInfoStruct *) (arg))->UserData);
+#endif
requestedElements = str->Filter->GetInput()->Size();
total = str->Filter->SplitRequestedRegion(threadId, threadCount, requestedElements, start, stop);
@@ -179,7 +189,11 @@ ObjectListToObjectListFilter
// few threads idle.
// }
+#if ITK_VERSION_MAJOR >= 5
+ return itk::ITK_THREAD_RETURN_DEFAULT_VALUE;
+#else
return ITK_THREAD_RETURN_VALUE;
+#endif
}
/**
diff --git a/Modules/Core/PointSet/include/otbImageToPointSetFilter.h b/Modules/Core/PointSet/include/otbImageToPointSetFilter.h
index 9e00f51e765c646be14a5ad3dd589f393dda2917..deb213af8091a911e8514d36151dbf4cdf0bc556 100644
--- a/Modules/Core/PointSet/include/otbImageToPointSetFilter.h
+++ b/Modules/Core/PointSet/include/otbImageToPointSetFilter.h
@@ -104,7 +104,11 @@ protected:
/** Static function used as a "callback" by the MultiThreader. The threading
* library will call this routine for each thread, which will delegate the
* control to ThreadedGenerateData(). */
+ #if ITK_VERSION_MAJOR >= 5
+ static itk::ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
+ #else
static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
+ #endif
/** Internal structure used for passing image data into the threading library */
struct ThreadStruct
diff --git a/Modules/Core/PointSet/include/otbImageToPointSetFilter.hxx b/Modules/Core/PointSet/include/otbImageToPointSetFilter.hxx
index 2b8e32ae45afd3b82d7ec7bd69fe736f14840299..3704afe0c082999473d85dfc64b6143bfb98823b 100644
--- a/Modules/Core/PointSet/include/otbImageToPointSetFilter.hxx
+++ b/Modules/Core/PointSet/include/otbImageToPointSetFilter.hxx
@@ -22,7 +22,13 @@
#define otbImageToPointSetFilter_hxx
#include "otbImageToPointSetFilter.h"
+//#include "itkMultiThreader.h" //itk5 - itk4 compat
+#if ITK_VERSION_MAJOR < 5
+#include "itkMultiThreader.h"
+#else
+#include "itkMultiThreaderBase.h"
+#endif
namespace otb
{
@@ -271,7 +277,11 @@ ImageToPointSetFilter
}
template
+#if ITK_VERSION_MAJOR >= 5
+itk::ITK_THREAD_RETURN_TYPE
+#else
ITK_THREAD_RETURN_TYPE
+#endif
ImageToPointSetFilter
::ThreaderCallback(void *arg)
{
@@ -279,9 +289,15 @@ ImageToPointSetFilter
unsigned int total, threadCount;
itk::ThreadIdType threadId;
+#if ITK_VERSION_MAJOR < 5
threadId = ((itk::MultiThreader::ThreadInfoStruct *) (arg))->ThreadID;
threadCount = ((itk::MultiThreader::ThreadInfoStruct *) (arg))->NumberOfThreads;
str = (ThreadStruct *) (((itk::MultiThreader::ThreadInfoStruct *) (arg))->UserData);
+#else
+ threadId = ((itk::MultiThreaderBase::ThreadInfoStruct *) (arg))->ThreadID;
+ threadCount = ((itk::MultiThreaderBase::ThreadInfoStruct *) (arg))->NumberOfThreads;
+ str = (ThreadStruct *) (((itk::MultiThreaderBase::ThreadInfoStruct *) (arg))->UserData);
+#endif
// execute the actual method with appropriate output region
// first find out how many pieces extent can be split into.
@@ -300,7 +316,11 @@ ImageToPointSetFilter
// few threads idle.
// }
+#if ITK_VERSION_MAJOR >= 5
+ return itk::ITK_THREAD_RETURN_DEFAULT_VALUE;
+#else
return ITK_THREAD_RETURN_VALUE;
+#endif
}
template
diff --git a/Modules/Core/PointSet/include/otbPointSetFunction.h b/Modules/Core/PointSet/include/otbPointSetFunction.h
index 818a3ce98163bcb965660788206e304a0d12a068..cf892398f59787b4ef5d56cfc0cf94f07854d547 100644
--- a/Modules/Core/PointSet/include/otbPointSetFunction.h
+++ b/Modules/Core/PointSet/include/otbPointSetFunction.h
@@ -49,22 +49,22 @@ public:
itkTypeMacro(PointSetFunction, itk::SpatialFunction);
/** PointSet Type typedef Support*/
- typedef TPointSet PointSetType;
- typedef typename PointSetType::ConstPointer PointSetPointerType;
-
- /** TOutput typedef suppoty*/
+ typedef TPointSet PointSetType;
+ typedef typename PointSetType::Pointer PointSetPointer;
+ typedef typename PointSetType::ConstPointer PointSetConstPointer;
+ /** TOutput typedef support*/
typedef TOutput OutputType;
/** Set the input image (reimplemented since we need to set the detector input) */
itkGetConstObjectMacro(PointSet, PointSetType);
- void SetPointSet(PointSetType * PointSet)
+ void SetPointSet(PointSetPointer PointSet)
{
m_PointSet = PointSet;
}
/** SetPointSet() to maintain the const correctness of the pointset*/
- void SetPointSet(PointSetPointerType PointSet)
+ void SetPointSet(PointSetConstPointer PointSet)
{
m_PointSet = PointSet;
}
@@ -79,7 +79,7 @@ private:
PointSetFunction(const Self &) = delete;
void operator =(const Self&) = delete;
- PointSetPointerType m_PointSet;
+ PointSetConstPointer m_PointSet;
};
diff --git a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h
index c26c96044720c3843813d1dce06c158c2c3ceaf8..90f76e742a1bb44e303c6a9ddab381942ce71bd7 100644
--- a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h
+++ b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h
@@ -24,7 +24,13 @@
#include "itkMacro.h"
#include "itkImageToImageFilter.h"
#include "otbStreamingManager.h"
+
+#if ITK_VERSION_MAJOR < 5
#include "itkFastMutexLock.h"
+#include "itkMutexLockHolder.h"
+#else
+#include
+#endif
namespace otb
{
@@ -194,7 +200,11 @@ private:
unsigned long m_ObserverID;
/** Lock to ensure thread-safety (added for the AbortGenerateData flag) */
- itk::SimpleFastMutexLock m_Lock;
+#if ITK_VERSION_MAJOR < 5
+ mutable itk::SimpleFastMutexLock m_Lock;
+#else
+ mutable std::mutex m_Lock;
+#endif
};
} // end namespace otb
diff --git a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.hxx b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.hxx
index cdcee4f18e9891a68b3b060d6c4a275b85b3482e..8850082892f6120080421f2ed2649cecb81729a8 100644
--- a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.hxx
+++ b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.hxx
@@ -300,9 +300,12 @@ const bool &
StreamingImageVirtualWriter
::GetAbortGenerateData() const
{
- m_Lock.Lock();
+#if ITK_VERSION_MAJOR < 5
+ itk::MutexLockHolder mutexHolder(m_Lock);
+#else
+ std::lock_guard mutexHolder(m_Lock);
+#endif
bool ret = Superclass::GetAbortGenerateData();
- m_Lock.Unlock();
if (ret) return otb::Utils::TrueConstant;
return otb::Utils::FalseConstant;
}
@@ -312,9 +315,12 @@ void
StreamingImageVirtualWriter
::SetAbortGenerateData(bool val)
{
- m_Lock.Lock();
+#if ITK_VERSION_MAJOR < 5
+ itk::MutexLockHolder mutexHolder(m_Lock);
+#else
+ std::lock_guard mutexHolder(m_Lock);
+#endif
Superclass::SetAbortGenerateData(val);
- m_Lock.Unlock();
}
} // end namespace otb
diff --git a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.hxx b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.hxx
index fd5f6c99fb5b4fc9e343caf741d9eff772adcc92..fa3b445d9a0a593d3f2d33cfb499e94b71338cbe 100644
--- a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.hxx
+++ b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.hxx
@@ -24,7 +24,7 @@
#include "otbPointSetToDensityImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkProgressReporter.h"
-
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
/**---------------------------------------------------------
@@ -34,6 +34,7 @@ template
PointSetToDensityImageFilter
::PointSetToDensityImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Radius = 1;
}
diff --git a/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h b/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h
index 92bd29716175e0f25dfaf0bb3ca891f52b281e64..1c7e5f14d991b6046a4578822ed9f2fb90cc8545 100644
--- a/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h
+++ b/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h
@@ -88,6 +88,7 @@ public:
protected:
HorizontalSobelVectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
typename Superclass::RadiusType radius = {{1, 1}};
this->SetRadius( radius );
}
diff --git a/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.hxx b/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.hxx
index 8e325a93c988653e07d737f11d628e4b6ad24db6..d453eba8b60c0f6c6fb0bb870306ab34d15bc359 100644
--- a/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.hxx
+++ b/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.hxx
@@ -41,6 +41,7 @@ template
::LineCorrelationDetectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->m_Radius.Fill(1);
this->m_LengthLine = 1;
this->m_WidthLine = 0;
diff --git a/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.hxx b/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.hxx
index fa70430f64426718877a38b69cd97dc8c8fb6bde..0c99cd954a9807c5669c84c31bab89d7bf13b9d3 100644
--- a/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.hxx
+++ b/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.hxx
@@ -42,6 +42,7 @@ template
::LineRatioDetectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->m_Radius.Fill(1);
this->m_LengthLine = 1;
this->m_WidthLine = 0;
diff --git a/Modules/Feature/Edge/include/otbLineSegmentDetector.hxx b/Modules/Feature/Edge/include/otbLineSegmentDetector.hxx
index 5ddfa10103d7a8cf50e98b7430cdf27b4c29347d..a29d25e238c4f6fc4d6abfbcde26041b3ce89b51 100644
--- a/Modules/Feature/Edge/include/otbLineSegmentDetector.hxx
+++ b/Modules/Feature/Edge/include/otbLineSegmentDetector.hxx
@@ -37,6 +37,10 @@
#include "itkMatrix.h"
#include "itkSymmetricEigenAnalysis.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
extern "C" double dlngam_(double *x);
extern "C" double dbetai_(double *x, double *a, double *b);
diff --git a/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.hxx b/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.hxx
index a91f9a4b0f57a20482c4899de81e5353fbd3a27e..725010a535af77808f26ca36f7ff6d9b0913fdf3 100644
--- a/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.hxx
+++ b/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.hxx
@@ -58,14 +58,22 @@ PersistentVectorizationImageFilter
{
// Compute the min max and handle mini-pipeline
m_MinMaxFilter->SetInput(this->GetInput());
+#if ITK_VERSION_MAJOR < 5
m_MinMaxFilter->GraftOutput(this->GetOutput());
m_MinMaxFilter->Update();
this->GraftOutput(m_MinMaxFilter->GetOutput());
+#else // MinMaxFilter does not produce an output in ITK5
+ m_MinMaxFilter->Update();
+#endif
for (PixelType label = m_MinMaxFilter->GetMinimum() + 1; label <= m_MinMaxFilter->GetMaximum(); ++label)
{
ImageToEdgePathFilterPointerType edgeFilter = ImageToEdgePathFilterType::New();
+#if ITK_VERSION_MAJOR < 5
edgeFilter->SetInput(m_MinMaxFilter->GetOutput());
+#else // MinMaxFilter does not produce an output in ITK5
+ edgeFilter->SetInput(this->GetInput());
+#endif
edgeFilter->SetForegroundValue(label);
edgeFilter->Update();
m_PathList->PushBack(edgeFilter->GetOutput());
diff --git a/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.hxx b/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.hxx
index e468505fec46d3d332ffd01184c5346817db22ba..b519c9083d7b7efc9b2830498fe86191330009c4 100644
--- a/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.hxx
+++ b/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.hxx
@@ -21,6 +21,7 @@
#ifndef otbPixelSuppressionByDirectionImageFilter_hxx
#define otbPixelSuppressionByDirectionImageFilter_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbPixelSuppressionByDirectionImageFilter.h"
#include "itkDataObject.h"
@@ -42,7 +43,7 @@ namespace otb
template
PixelSuppressionByDirectionImageFilter::PixelSuppressionByDirectionImageFilter()
{
-
+OTB_DISABLE_DYNAMIC_MT;
m_Radius.Fill(1);
m_AngularBeam = static_cast(0.);
diff --git a/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h b/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h
index 94a31c6fb7a4fb658077d5f2febc80a36013d712..d44347366fd780cb916e2d41136df0aa5203555d 100644
--- a/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h
+++ b/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h
@@ -97,6 +97,7 @@ public:
protected:
SobelVectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
typename Superclass::RadiusType radius = {{1, 1}};
this->SetRadius( radius );
}
diff --git a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.hxx b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.hxx
index 77f930626b1f7cf0155c741448340213c7dddc63..4bbf74f0714b51eb3080b3beb5211cfaf57b17c4 100644
--- a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.hxx
+++ b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.hxx
@@ -41,6 +41,7 @@ namespace otb
template
TouziEdgeDetectorImageFilter::TouziEdgeDetectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Radius.Fill(1);
}
diff --git a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.hxx b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.hxx
index 64027caab9eb281236da1a9c64a431da1c2856df..46cc283e9f363ae9069e7fb90fbd45e0e39c3df5 100644
--- a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.hxx
+++ b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.hxx
@@ -37,6 +37,7 @@ template
RadiometricMomentsImageFilter
::RadiometricMomentsImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
m_Radius.Fill(1);
}
diff --git a/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.hxx b/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.hxx
index 91270169145685ff3658f67e58a57853f1474234..04e4101ffe3db645a9f949461e0e807e4e53cdba 100644
--- a/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.hxx
+++ b/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.hxx
@@ -27,7 +27,7 @@
#include "itkImageRegionIterator.h"
#include "itkNeighborhoodAlgorithm.h"
#include "otbMath.h"
-
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -35,6 +35,7 @@ template
SFSTexturesImageFilter
::SFSTexturesImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredOutputs(6);
diff --git a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.hxx b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.hxx
index 52d68d939babbc230859ccfef1786dafc14b9694..51753ef89568f066b16494042e6955f6a60a2b59 100644
--- a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.hxx
+++ b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.hxx
@@ -28,7 +28,7 @@
#include "itkProgressReporter.h"
#include "itkNumericTraits.h"
#include
-
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
template
@@ -43,6 +43,7 @@ ScalarImageToAdvancedTexturesFilter
, m_SubsampleFactor()
, m_SubsampleOffset()
{
+ OTB_DISABLE_DYNAMIC_MT;
// There are 10 outputs corresponding to the 9 textures indices
this->SetNumberOfRequiredOutputs(10);
diff --git a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.hxx b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.hxx
index 9c842f44b3c6e781acecfe559a64adcc12b4a2b9..abd11d8bc15272ea2912c3ac2f9f15de2e3edc91 100644
--- a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.hxx
+++ b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.hxx
@@ -21,6 +21,7 @@
#ifndef otbScalarImageToHigherOrderTexturesFilter_hxx
#define otbScalarImageToHigherOrderTexturesFilter_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbScalarImageToHigherOrderTexturesFilter.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkImageRegionIterator.h"
@@ -40,9 +41,10 @@ ScalarImageToHigherOrderTexturesFilter
m_SubsampleOffset()
{
// There are 10 outputs corresponding to the 8 textures indices
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredOutputs(10);
- // Create the 11 outputs
+ // Create the 10 outputs
this->SetNthOutput(0, OutputImageType::New());
this->SetNthOutput(1, OutputImageType::New());
this->SetNthOutput(2, OutputImageType::New());
diff --git a/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.hxx b/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.hxx
index ce6aba7c14ade35db426d287401e9601ae0e62ef..6c7d692cc28d02c6d6b14bf51ade39fc6af67d2d 100644
--- a/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.hxx
+++ b/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.hxx
@@ -27,6 +27,7 @@
#include "itkImageRegionIterator.h"
#include "itkProgressReporter.h"
#include "itkNumericTraits.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -37,6 +38,7 @@ ScalarImageToPanTexTextureFilter
m_InputImageMinimum(0),
m_InputImageMaximum(255)
{
+ OTB_DISABLE_DYNAMIC_MT;
// There are 1 output corresponding to the Pan Tex texture indice
this->SetNumberOfRequiredOutputs(1);
diff --git a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.hxx b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.hxx
index 3ff20537907398eeea656b0563204ed3a657ab8d..c6439e892bd8cc3426ee84bcd768d02a49d9adcc 100644
--- a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.hxx
+++ b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.hxx
@@ -30,6 +30,7 @@
#include "itkNumericTraits.h"
#include
#include
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -45,6 +46,7 @@ ScalarImageToTexturesFilter
, m_SubsampleFactor()
, m_SubsampleOffset()
{
+ OTB_DISABLE_DYNAMIC_MT;
// There are 8 outputs corresponding to the 8 textures indices
this->SetNumberOfRequiredOutputs(8);
diff --git a/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h b/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h
index 8faf7c6bd786277f85264fd3720698398a94ed99..24582dee91d7cf2f9b0d80256bc5fa1dbf62a38b 100644
--- a/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h
+++ b/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h
@@ -83,7 +83,7 @@ public:
itkTypeMacro(CBAMIChangeDetector, SuperClass);
protected:
- CBAMIChangeDetector() {}
+ CBAMIChangeDetector() {OTB_DISABLE_DYNAMIC_MT;}
~CBAMIChangeDetector() override {}
private:
diff --git a/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h b/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h
index e39ba7a48215595cde566879a27cb65622bb20fc..eb98b0532f1837bfdad8ff6af0d73ca50707c215 100644
--- a/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h
+++ b/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h
@@ -82,7 +82,7 @@ public:
itkTypeMacro(CorrelationChangeDetector, SuperClass);
protected:
- CorrelationChangeDetector() {}
+ CorrelationChangeDetector() {OTB_DISABLE_DYNAMIC_MT;}
~CorrelationChangeDetector() override {}
private:
diff --git a/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h
index 3b60293e6d75d83fcdc45d4e5564e194298c3abb..b507b8cb913f99b6172a027e914746455f9aad72 100644
--- a/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h
+++ b/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h
@@ -23,6 +23,7 @@
#include "otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h"
#include "otbJoinHistogramMI.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -83,7 +84,10 @@ public:
itkTypeMacro(JoinHistogramMIImageFilter, SuperClass);
protected:
- JoinHistogramMIImageFilter() {}
+ JoinHistogramMIImageFilter()
+ {
+ OTB_DISABLE_DYNAMIC_MT;
+ }
~JoinHistogramMIImageFilter() override {}
private:
diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.hxx b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.hxx
index df648c556126dfcefb7fa6a4de781ed36564d7fa..7590da8353dd6fb848a7f6b601d6e7208f7a56c4 100644
--- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.hxx
+++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.hxx
@@ -27,6 +27,10 @@
#include "otbKullbackLeiblerProfileImageFilter.h"
#include "otbMath.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
namespace otb
{
diff --git a/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h
index 5bc8d44f4e2b591be883c1130c45ffa6959175e2..b99a6d5ea41cdad4f6ec4a3aeb7043bf3f1f7b37 100644
--- a/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h
+++ b/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h
@@ -81,7 +81,7 @@ public:
itkTypeMacro(MeanDifferenceImageFilter, SuperClass);
protected:
- MeanDifferenceImageFilter() {}
+ MeanDifferenceImageFilter() {OTB_DISABLE_DYNAMIC_MT;}
~MeanDifferenceImageFilter() override {}
private:
diff --git a/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.hxx b/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.hxx
index 73fe6bde5d5525aca9815814dc44113b5550f331..9d5ec1b9ff8e39e4468aa64d5db1b28964e6ed59 100644
--- a/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.hxx
+++ b/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.hxx
@@ -36,6 +36,7 @@ template
MultivariateAlterationDetectorImageFilter
::MultivariateAlterationDetectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(2);
m_CovarianceEstimator = CovarianceEstimatorType::New();
}
diff --git a/Modules/Filtering/Contrast/include/otbApplyGainFilter.hxx b/Modules/Filtering/Contrast/include/otbApplyGainFilter.hxx
index 4912bfa2057d230bd8cd710a49b90510ef30ff95..e39cd6984519a521837d61fc514ba1af099947cf 100644
--- a/Modules/Filtering/Contrast/include/otbApplyGainFilter.hxx
+++ b/Modules/Filtering/Contrast/include/otbApplyGainFilter.hxx
@@ -25,6 +25,7 @@
#include "itkImageRegionIterator.h"
#include "itkImageRegionConstIteratorWithIndex.h"
#include "itkContinuousIndex.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include
@@ -34,6 +35,7 @@ template
ApplyGainFilter < TInputImage , TLut , TOutputImage >
::ApplyGainFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(2);
m_Min = std::numeric_limits< InputPixelType >::quiet_NaN();
m_Max = std::numeric_limits< InputPixelType >::quiet_NaN();
diff --git a/Modules/Filtering/Contrast/include/otbCLHistogramEqualizationFilter.hxx b/Modules/Filtering/Contrast/include/otbCLHistogramEqualizationFilter.hxx
index 356df1b960ede8692a97f43c77df6ac9f99b968c..fd0f1ebd672cd69ef31a1ef3b78d240d76929b2e 100644
--- a/Modules/Filtering/Contrast/include/otbCLHistogramEqualizationFilter.hxx
+++ b/Modules/Filtering/Contrast/include/otbCLHistogramEqualizationFilter.hxx
@@ -37,6 +37,7 @@ m_ApplyGainFilter ( ApplyGainFilter::New() ) ,
m_StreamingImageFilter ( StreamingImageFilter::New() ) ,
m_BufferFilter ( BufferFilter::New() )
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Min = std::numeric_limits< InputPixelType >::quiet_NaN();
m_Max = std::numeric_limits< InputPixelType >::quiet_NaN();
m_NbBin = 256;
diff --git a/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.hxx b/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.hxx
index 3dbe3798779e70d1b553b5586a7e34f6e3c80f1d..76c1cb7ab1c26d6ed3b1ab481f0db01baa9f28d8 100644
--- a/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.hxx
+++ b/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.hxx
@@ -23,7 +23,7 @@
#include "otbComputeGainLutFilter.h"
#include "itkImageRegionIterator.h"
-
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include
#include
@@ -34,6 +34,7 @@ template < class TInputImage, class TOutputImage >
ComputeGainLutFilter < TInputImage , TOutputImage >
::ComputeGainLutFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_NbBin = 256;
m_NbPixel = 0;
m_Min = std::numeric_limits< double >::quiet_NaN();
diff --git a/Modules/Filtering/Contrast/include/otbComputeHistoFilter.hxx b/Modules/Filtering/Contrast/include/otbComputeHistoFilter.hxx
index a5ad85c009f99621a80c499f7c22805d2b0135ad..ed48ea1002a9ed1a4660010e081556442f96224e 100644
--- a/Modules/Filtering/Contrast/include/otbComputeHistoFilter.hxx
+++ b/Modules/Filtering/Contrast/include/otbComputeHistoFilter.hxx
@@ -22,9 +22,9 @@
#define otbComputeHistoFilter_hxx
#include "otbComputeHistoFilter.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include
-
namespace otb
{
@@ -32,6 +32,7 @@ template
ComputeHistoFilter < TInputImage , TOutputImage >
::ComputeHistoFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredOutputs(2);
this->SetNthOutput( 0, this->MakeOutput(0) );
this->SetNthOutput( 1, this->MakeOutput(1) );
diff --git a/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.hxx b/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.hxx
index 302b1a054335fc8d40f20455bd3587e16f6ac669..1be48ea140e650ab2afdca022a3fc36093da8d67 100644
--- a/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.hxx
+++ b/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.hxx
@@ -38,6 +38,7 @@ template
::ConvolutionImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Radius.Fill(1);
m_Filter.SetSize(3 * 3);
m_Filter.Fill(1);
diff --git a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.hxx b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.hxx
index 867632e82b1a04e213cfd4597fdc3b17f8dc65da..e6271cf38e8c02d6f9b75aeaa74cee1272715a22 100644
--- a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.hxx
+++ b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.hxx
@@ -25,6 +25,10 @@
#include "otbMacro.h"
#include "itkProgressReporter.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
namespace otb
{
@@ -32,6 +36,7 @@ template
DEMToImageGenerator
::DEMToImageGenerator()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_DEMHandler = DEMHandlerType::Instance();
m_OutputSpacing[0] = 0.0001;
m_OutputSpacing[1] = -0.0001;
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.hxx b/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.hxx
index 7f9d5d39f51012af6e1f83b6261571cb9a467ea1..e98b32b9a1a00e968fdb353cf3f54fedc4ebd878 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.hxx
+++ b/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.hxx
@@ -21,6 +21,7 @@
#ifndef otbEstimateInnerProductPCAImageFilter_hxx
#define otbEstimateInnerProductPCAImageFilter_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbEstimateInnerProductPCAImageFilter.h"
#include
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h
index 2ba6e47035f7db5ce2a26028aa8dc18390b0dae1..76684fa322095fab8dfc2b8b9a282f77e6d668ad 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h
+++ b/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h
@@ -108,7 +108,7 @@ public:
itkTypeMacro(LocalActivityVectorImageFilter, ImageToImageFilter);
protected:
- LocalActivityVectorImageFilter() { }
+ LocalActivityVectorImageFilter() { OTB_DISABLE_DYNAMIC_MT; }
~LocalActivityVectorImageFilter() override { }
private:
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.hxx b/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.hxx
index 2cc202cdbd5338c36b589bec0f74d998669f6fdb..306df488419b98c7dc785d77ae30b3fa4a35d500 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.hxx
+++ b/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.hxx
@@ -39,6 +39,7 @@ template
MaximumAutocorrelationFactorImageFilter
::MaximumAutocorrelationFactorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_CovarianceEstimator = CovarianceEstimatorType::New();
m_CovarianceEstimatorH = CovarianceEstimatorType::New();
m_CovarianceEstimatorV = CovarianceEstimatorType::New();
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.hxx b/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.hxx
index 699f09e3f1f00a38ff04b36bf8c16ff3959780ef..c90e1452bfc870ad3ada0a0ffa4a1cd3f5d350c1 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.hxx
+++ b/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.hxx
@@ -36,6 +36,7 @@ template
NormalizeInnerProductPCAImageFilter
::NormalizeInnerProductPCAImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredOutputs(1);
this->InPlaceOff();
diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.hxx
index b6e7fc40442e4e35ac9d4c34aa2faf9cc4508b4e..f97c9af451ab69cc8e4639cf4c172a3f71bce598 100644
--- a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.hxx
@@ -25,7 +25,7 @@
#include "itkImageRegionIterator.h"
#include "itkNeighborhoodAlgorithm.h"
#include "itkProgressReporter.h"
-
+#include "otbMacro.h"
namespace otb
{
@@ -37,6 +37,7 @@ template
::BinaryFunctorNeighborhoodImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(2);
m_Radius.Fill(3);
}
diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.hxx
index ac4d49dc4ffa94a9706a6f24ace5874bf1cf00a5..c3aab5f5144c27190fd956c1f19549ce6bf69f43 100644
--- a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.hxx
@@ -21,6 +21,8 @@
#ifndef otbBinaryFunctorNeighborhoodVectorImageFilter_hxx
#define otbBinaryFunctorNeighborhoodVectorImageFilter_hxx
+#include "otbMath.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbBinaryFunctorNeighborhoodVectorImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkNeighborhoodAlgorithm.h"
@@ -37,6 +39,7 @@ template
::BinaryFunctorNeighborhoodVectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(2);
this->InPlaceOff();
m_Radius = 3;
diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.hxx
index c6cc7a66253b40af09a9dd667b202b89b84cc4b1..5b119e3ec84176b5ef20de8c4bef55012a2a137e 100644
--- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.hxx
@@ -36,6 +36,7 @@ template
BinaryImageToDensityImageFilter
::BinaryImageToDensityImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_NeighborhoodRadius.Fill(1);
m_CountFunction = CountFunctionType::New();
}
diff --git a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.hxx
index 9b5da23ba1f5d8f1877f0f8a3f4e748adc55add6..7c3935de3b1d47b69e08adde4ff373295b11e8f2 100644
--- a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.hxx
@@ -24,7 +24,7 @@
#include
#include
-
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "itkConstNeighborhoodIterator.h"
#include "itkImageRegionIterator.h"
#include "itkNeighborhoodAlgorithm.h"
@@ -39,6 +39,7 @@ template
BoxAndWhiskerImageFilter
::BoxAndWhiskerImageFilter ()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredOutputs(1);
this->InPlaceOn();
diff --git a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.hxx
index b3d8f1ca317216c52c6f656a1087527741012a62..7834378f064373a87c08a8f0d03e26bdb61baaf8 100644
--- a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.hxx
@@ -23,6 +23,7 @@
#define otbClampImageFilter_hxx
#include "otbClampImageFilter.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "itkImageRegionIterator.h"
#include "itkNumericTraits.h"
#include
@@ -39,6 +40,7 @@ template
ClampImageFilter
::ClampImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Lower = std::numeric_limits < OutputPixelValueType >::lowest();
m_Upper = std::numeric_limits < OutputPixelValueType >::max();
}
diff --git a/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.hxx
index 073ba588d1fb0c135b859402241627b92cce6507..52f95dd1eb5012b0311bc92be1354dd340afe13c 100644
--- a/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.hxx
@@ -22,6 +22,7 @@
#define otbConcatenateVectorImageFilter_hxx
#include "otbConcatenateVectorImageFilter.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "itkImageRegionIterator.h"
#include "itkProgressReporter.h"
@@ -35,6 +36,7 @@ ConcatenateVectorImageFilter
::ConcatenateVectorImageFilter()
{
this->SetNumberOfRequiredInputs(2);
+ OTB_DISABLE_DYNAMIC_MT;
}
/**
* Destructor.
diff --git a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.hxx b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.hxx
index 37cfd2dc5fa6e5ce180eec0f3c525e6c29248744..d101f5b7c5b91395afe0fc3807fd503a8f5275d1 100644
--- a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.hxx
@@ -26,6 +26,10 @@
#include "otbEuclideanDistanceMetricWithMissingValuePow2.h"
#include "itkMeasurementVectorTraits.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
namespace otb {
namespace Statistics {
diff --git a/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.hxx
index 9fc4bd2113d794b23e6c77ae1c754bf45c8544e3..c04aed753ca11094b2f47869833be74829e78dd9 100644
--- a/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.hxx
@@ -35,6 +35,7 @@ template
FunctionWithNeighborhoodToImageFilter
::FunctionWithNeighborhoodToImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->InPlaceOff();
this->SetNumberOfRequiredInputs(1);
m_Radius.Fill(1);
diff --git a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.hxx
index a954d9854c037de296f241447effe8331f72fa67..c4069692daa3948074bbabb91c392dd3c8be8d24 100644
--- a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.hxx
@@ -47,6 +47,7 @@ GridResampleImageFilter
m_Interpolator(),
m_ReachableOutputRegion()
{
+ OTB_DISABLE_DYNAMIC_MT;
// Set linear interpolator as default
m_Interpolator = dynamic_cast(DefaultInterpolatorType::New().GetPointer());
diff --git a/Modules/Filtering/ImageManipulation/include/otbInPlacePassFilter.h b/Modules/Filtering/ImageManipulation/include/otbInPlacePassFilter.h
index 153a728bb33b0fb90b0f61a13e5e5e4b4dc831b0..1f01a7286d0c24be7e7dfa83474693c3d122f159 100644
--- a/Modules/Filtering/ImageManipulation/include/otbInPlacePassFilter.h
+++ b/Modules/Filtering/ImageManipulation/include/otbInPlacePassFilter.h
@@ -63,6 +63,7 @@ public:
protected:
InPlacePassFilter() {
+ OTB_DISABLE_DYNAMIC_MT;
this->InPlaceOn();
}
diff --git a/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.hxx
index ff54cc6607e10a858a3be33d5c74bd4663dd677e..13b03f292f6fd1b7f6623e53aaed16d9e994b02d 100644
--- a/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.hxx
@@ -21,6 +21,7 @@
#ifndef otbMatrixImageFilter_hxx
#define otbMatrixImageFilter_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbMatrixImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkProgressReporter.h"
@@ -34,6 +35,7 @@ namespace otb
template
MatrixImageFilter::MatrixImageFilter() : m_MatrixByVector(false)
{
+ OTB_DISABLE_DYNAMIC_MT;
}
template
diff --git a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.hxx b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.hxx
index cff87ef48c6bea8a12e7a4abb78c2e76d5f0002d..ca596c08a58cb4a939b81a80618018b2ca2fd39c 100644
--- a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.hxx
@@ -21,6 +21,7 @@
#ifndef otbNRIBandImagesToOneNComplexBandsImage_hxx
#define otbNRIBandImagesToOneNComplexBandsImage_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbNRIBandImagesToOneNComplexBandsImage.h"
#include "itkImageRegionIterator.h"
@@ -28,9 +29,6 @@
#include "itkProgressReporter.h"
#include "itkVariableLengthVector.h"
-
-
-
namespace otb
{
@@ -41,6 +39,7 @@ template
NRIBandImagesToOneNComplexBandsImage::NRIBandImagesToOneNComplexBandsImage()
{
//this->SetNumberOfThreads(1);
+ OTB_DISABLE_DYNAMIC_MT;
}
/**
diff --git a/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h
index 30f85bb57096b6abf40d6aec4fca60ac83adf669..95772783b2b073acc7209d5c05b0680421d573b0 100644
--- a/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h
+++ b/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h
@@ -119,7 +119,7 @@ protected:
**/
template >
-class ITK_EXPORT PrintableImageFilter :
+class PrintableImageFilter :
public itk::ImageToImageFilter >
{
public:
diff --git a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.hxx
index fa99a2aea0b768ba791be57bd738f7116945fc17..10269baa5fd86710cd12f1fb42388ef40307c625 100644
--- a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.hxx
@@ -36,6 +36,7 @@ template
SpectralAngleDistanceImageFilter
::SpectralAngleDistanceImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_ReferencePixel = 0;
}
diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.hxx
index a6950f65096b65d1ce005f49abed7415d78dee2b..eceb8a9e580c3d7fce59e43c2c4c546864393cf6 100644
--- a/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.hxx
@@ -36,6 +36,7 @@ template
PersistentInnerProductVectorImageFilter
::PersistentInnerProductVectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
// first output is a copy of the image, DataObject created by
// superclass
//
diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.hxx
index f6719ab12e8ae6e41d5e374c0d45aa9c2b93f7f2..3012201250c6cac291053b9584dfc8f1b27b1985 100644
--- a/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.hxx
@@ -35,6 +35,7 @@ template
PersistentMatrixTransposeMatrixImageFilter
::PersistentMatrixTransposeMatrixImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(2);
// first output is a copy of the image, DataObject created by
diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h
index 01710c3a0b44adc8499d5e323525b83c69097787..76189ac4179f83ab35615d8580d5a2946aa4e35f 100644
--- a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h
+++ b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h
@@ -21,17 +21,16 @@
#ifndef otbStreamingShrinkImageFilter_h
#define otbStreamingShrinkImageFilter_h
-
#include "otbPersistentImageFilter.h"
#include "otbPersistentFilterStreamingDecorator.h"
-
+#include "OTBImageManipulationExport.h"
#include "otbStreamingManager.h"
#include "otbMacro.h"
namespace otb
{
-class ITK_EXPORT StreamingShrinkImageRegionSplitter : public itk::ImageRegionSplitter<2>
+class OTBImageManipulation_EXPORT StreamingShrinkImageRegionSplitter : public itk::ImageRegionSplitter<2>
{
public:
/** Standard class typedefs. */
diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.hxx
index 0da76af598d870d2697e632d769af261ca31fe6a..af2ca4ee73786e0dc25103e72c603938d9088631 100644
--- a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.hxx
@@ -64,6 +64,7 @@ PersistentShrinkImageFilter
::PersistentShrinkImageFilter()
: m_ShrinkFactor(10)
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredOutputs(1);
}
diff --git a/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.hxx
index 88146169b03b189da140cd6772aa263973c22802..c444821a8e4a0329a74f8caba58960f0901f2785 100644
--- a/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.hxx
@@ -22,6 +22,7 @@
#ifndef otbThresholdVectorImageFilter_hxx
#define otbThresholdVectorImageFilter_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbThresholdVectorImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkNumericTraits.h"
@@ -38,6 +39,7 @@ template
ThresholdVectorImageFilter
::ThresholdVectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_OutsideValue = itk::NumericTraits::Zero;
m_Lower = itk::NumericTraits::NonpositiveMin();
m_Upper = itk::NumericTraits::max();
diff --git a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.hxx
index 6257269507d214f300af75dae45bf53ebefd887e..834d50ee2b52f7fdfece1d3abbc43fd1f4f44a66 100644
--- a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.hxx
@@ -23,13 +23,16 @@
#include "otbTileImageFilter.h"
#include "itkImageRegionIterator.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
template
TileImageFilter
::TileImageFilter()
-{}
+{
+ OTB_DISABLE_DYNAMIC_MT;
+}
template
TileImageFilter
diff --git a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.hxx b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.hxx
index ce4281b448e0b2f027eb971a626319f9ff3d715d..fbe290f0b4ce67f399bb94514814b66edc80b332 100644
--- a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.hxx
@@ -21,6 +21,7 @@
#ifndef otbTwoNRIBandsImageToNComplexBandsImage_hxx
#define otbTwoNRIBandsImageToNComplexBandsImage_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbTwoNRIBandsImageToNComplexBandsImage.h"
#include "itkImageRegionIterator.h"
@@ -40,6 +41,7 @@ namespace otb
template
TwoNRIBandsImageToNComplexBandsImage::TwoNRIBandsImageToNComplexBandsImage()
{
+ OTB_DISABLE_DYNAMIC_MT;
//this->SetNumberOfThreads(1);
}
diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.hxx
index 273a267e7e9d673eb20b9d18e64a8f264c886628..fd7246c43b0ebc571cc5cfde900a3ffec1771868 100644
--- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.hxx
@@ -27,7 +27,7 @@
#include "itkProgressReporter.h"
#include "itkZeroFluxNeumannBoundaryCondition.h"
#include "itkNeighborhoodAlgorithm.h"
-
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
/**
@@ -37,6 +37,7 @@ template
UnaryFunctorNeighborhoodImageFilter
::UnaryFunctorNeighborhoodImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
m_Radius.Fill(1);
}
diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.hxx
index 20ae4caf80ce36e47f1b9e1ef8b287310b789aa0..69040bf10e893bf93599645f7d9edffef119b367 100644
--- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.hxx
@@ -21,6 +21,7 @@
#ifndef otbUnaryFunctorNeighborhoodWithOffsetImageFilter_hxx
#define otbUnaryFunctorNeighborhoodWithOffsetImageFilter_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkNeighborhoodAlgorithm.h"
@@ -37,6 +38,7 @@ template
UnaryFunctorNeighborhoodWithOffsetImageFilter
::UnaryFunctorNeighborhoodWithOffsetImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
m_Radius.Fill(1);
m_Offset.Fill(1);
diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.hxx
index c125b284f6ae7174fd64070f165ddb632465960d..9fc82fbd3752af4ff6273ba6e0e2ccbb96f5d2c4 100644
--- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.hxx
@@ -24,6 +24,7 @@
#include "otbUnaryFunctorWithIndexImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkProgressReporter.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -34,6 +35,7 @@ template
UnaryFunctorWithIndexImageFilter
::UnaryFunctorWithIndexImageFilter()
{
+OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
}
template
diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.hxx
index f38dbb9f745aeaf23a55c61f62bf776ae69ca6fe..b7b87986fdc5d8bbe6f95972bd56fe8cdb00dd30 100644
--- a/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.hxx
@@ -22,6 +22,7 @@
#define otbUnaryImageFunctorWithVectorImageFilter_hxx
#include "otbUnaryImageFunctorWithVectorImageFilter.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "itkImageRegionIterator.h"
#include "itkProgressReporter.h"
@@ -35,6 +36,7 @@ template
UnaryImageFunctorWithVectorImageFilter
::UnaryImageFunctorWithVectorImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
this->InPlaceOff();
}
diff --git a/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.hxx b/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.hxx
index 3481e47f130adc46b8b2c30fff6b893c56056c38..1eebac82586d6a9a8c666c8416c9713ec3c7b2ce 100644
--- a/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.hxx
+++ b/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.hxx
@@ -21,6 +21,7 @@
#ifndef otbVectorImageTo3DScalarImageFilter_hxx
#define otbVectorImageTo3DScalarImageFilter_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbVectorImageTo3DScalarImageFilter.h"
#include "itkImageRegionConstIterator.h"
#include "itkImageSliceIteratorWithIndex.h"
@@ -33,7 +34,9 @@ namespace otb
template
VectorImageTo3DScalarImageFilter
::VectorImageTo3DScalarImageFilter()
-{}
+{
+ OTB_DISABLE_DYNAMIC_MT;
+}
/** Generate output information */
template
void
diff --git a/Modules/Filtering/ImageManipulation/otb-module.cmake b/Modules/Filtering/ImageManipulation/otb-module.cmake
index 8d908064ec2b99150f2f24dff3ed21691076b348..577800116de253b72023445b2be5241a4356682e 100644
--- a/Modules/Filtering/ImageManipulation/otb-module.cmake
+++ b/Modules/Filtering/ImageManipulation/otb-module.cmake
@@ -26,6 +26,7 @@ band, evaluating a ImageFunction onto a source image, generating an image from D
data.")
otb_module(OTBImageManipulation
+ENABLE_SHARED
DEPENDS
OTBBoostAdapters
OTBCommon
diff --git a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.hxx b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.hxx
index f372ad59f92ffd2a8f1139560c2e53b2a7e34dbd..97f73331bf867746bd20346007885e400f417507 100644
--- a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.hxx
+++ b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.hxx
@@ -30,7 +30,7 @@
#include "itkNeighborhoodAlgorithm.h"
#include "itkOffset.h"
#include "itkProgressReporter.h"
-
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -40,6 +40,7 @@ namespace otb
template
FrostImageFilter::FrostImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Radius.Fill(1);
m_Deramp = 2;
}
diff --git a/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.hxx b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.hxx
index 2d4b0d663ecababaf6eba2a46bf9f0440a356b43..6dca5adb37dfd982ed49b24570ac62fefcd52d89 100644
--- a/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.hxx
+++ b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.hxx
@@ -30,7 +30,7 @@
#include "itkNeighborhoodAlgorithm.h"
#include "itkOffset.h"
#include "itkProgressReporter.h"
-
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -40,6 +40,7 @@ namespace otb
template
GammaMAPImageFilter::GammaMAPImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Radius.Fill(1);
SetNbLooks(1.0);
}
diff --git a/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.hxx b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.hxx
index 68eaf1006210d9120ca45cb3eeadf86b8bbf76c9..522d9d1395fdc0971490f934aadd51d2e08fb0d9 100644
--- a/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.hxx
+++ b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.hxx
@@ -30,7 +30,7 @@
#include "itkNeighborhoodAlgorithm.h"
#include "itkOffset.h"
#include "itkProgressReporter.h"
-
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -40,6 +40,7 @@ namespace otb
template
KuanImageFilter::KuanImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Radius.Fill(1);
SetNbLooks(1.0);
}
diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.hxx b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.hxx
index 1c4fbadf5e6fda0202f4f6748b8ab1dec7cafa8c..86f2526c2767a65a2e1c05d869ed89e3edd1bdfb 100644
--- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.hxx
+++ b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.hxx
@@ -23,6 +23,7 @@
#include "otbLeeImageFilter.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "itkDataObject.h"
#include "itkConstNeighborhoodIterator.h"
#include "itkNeighborhoodInnerProduct.h"
@@ -40,6 +41,7 @@ namespace otb
template
LeeImageFilter::LeeImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Radius.Fill(1);
SetNbLooks(1.0);
}
diff --git a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.hxx b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.hxx
index 8ac27050327da7d5287ae93287df6d47eb9b774d..3d9ed9a79f8528a2cb5324b9d82faa8465a286f3 100644
--- a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.hxx
+++ b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.hxx
@@ -42,6 +42,7 @@ BandMathImageFilter
{
//This number will be incremented each time an image
//is added over the one minimumrequired
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs( 1 );
this->InPlaceOff();
diff --git a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.hxx b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.hxx
index 5c0e60b3a32606bed9d4c4a792b80f81e21a58e8..ca0047fef3ea210de916596d778606e37dcb379a 100644
--- a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.hxx
+++ b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.hxx
@@ -35,6 +35,7 @@ namespace otb
template
MaskMuParserFilter::MaskMuParserFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_UnderflowCount = 0;
m_OverflowCount = 0;
m_ThreadUnderflow.SetSize(1);
diff --git a/Modules/Filtering/MathParser/include/otbParser.h b/Modules/Filtering/MathParser/include/otbParser.h
index 96038c266c8cd5386728620ffa03f12ab607a70a..aa03751f9d2149dc814deedb4b9ed6d8e19b396f 100644
--- a/Modules/Filtering/MathParser/include/otbParser.h
+++ b/Modules/Filtering/MathParser/include/otbParser.h
@@ -25,6 +25,7 @@
#include "itkObjectFactory.h"
#include "otb_muparser.h"
+#include "OTBMathParserExport.h"
namespace otb
{
@@ -41,7 +42,7 @@ class ParserImpl;
*
* \ingroup OTBMathParser
*/
-class ITK_EXPORT Parser : public itk::LightObject
+class OTBMathParser_EXPORT Parser : public itk::LightObject
{
public:
/** Standard class typedefs. */
diff --git a/Modules/Filtering/MathParser/otb-module.cmake b/Modules/Filtering/MathParser/otb-module.cmake
index bc4f899c0e62a043cbe795fba2efc6f3278ff0b6..b1acb5cc315843ae9a9b626e24f3eb2106e995e5 100644
--- a/Modules/Filtering/MathParser/otb-module.cmake
+++ b/Modules/Filtering/MathParser/otb-module.cmake
@@ -23,6 +23,7 @@ expression to the pixels of an image. Note that classes based on MuParserX have
better capabilities than the ones based on MuParser.")
otb_module(OTBMathParser
+ENABLE_SHARED
DEPENDS
OTBCommon
OTBITK
diff --git a/Modules/Filtering/MathParser/test/otbBandMathImageFilter.cxx b/Modules/Filtering/MathParser/test/otbBandMathImageFilter.cxx
index 26c714c100eb76f3ca66ede72befd489d2b9b2c7..2719b6f56218b0bcabcdea38a843d11c6cd89bd0 100644
--- a/Modules/Filtering/MathParser/test/otbBandMathImageFilter.cxx
+++ b/Modules/Filtering/MathParser/test/otbBandMathImageFilter.cxx
@@ -29,6 +29,9 @@
#include "otbBandMathImageFilter.h"
#include "otbImageFileWriter.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
int otbBandMathImageFilter( int itkNotUsed(argc), char* itkNotUsed(argv) [])
{
diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx
index 6092926c7d22d861d0a88a811de26f9f537d016c..081544d013a9a9234cd479f951d2cd7333727269 100644
--- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx
+++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx
@@ -48,7 +48,7 @@ BandMathXImageFilter
//This number will be incremented each time an image
//is added over the one minimumrequired
this->SetNumberOfRequiredInputs( 1 );
-
+ OTB_DISABLE_DYNAMIC_MT;
m_UnderflowCount = 0;
m_OverflowCount = 0;
m_ThreadUnderflow.SetSize(1);
diff --git a/Modules/Filtering/MathParserX/include/otbParserX.h b/Modules/Filtering/MathParserX/include/otbParserX.h
index 8530f76b8ccf394a72d49d5e8bbd7376655c076c..d47730be472c9b05293941fe7d2cb1ae8849968c 100644
--- a/Modules/Filtering/MathParserX/include/otbParserX.h
+++ b/Modules/Filtering/MathParserX/include/otbParserX.h
@@ -40,6 +40,7 @@
#else
#include "mpParser.h"
#endif
+#include "OTBMathParserXExport.h"
namespace otb
{
@@ -56,7 +57,7 @@ class ParserXImpl;
*
* \ingroup OTBMathParserX
*/
-class ITK_EXPORT ParserX : public itk::LightObject
+class OTBMathParserX_EXPORT ParserX : public itk::LightObject
{
public:
/** Standard class typedefs. */
diff --git a/Modules/Filtering/MathParserX/otb-module.cmake b/Modules/Filtering/MathParserX/otb-module.cmake
index 4a601e111e0b5cc09410525869b86b80563c3d08..a49a2862643c468f3bfddfd2400a1f0366766d96 100644
--- a/Modules/Filtering/MathParserX/otb-module.cmake
+++ b/Modules/Filtering/MathParserX/otb-module.cmake
@@ -21,6 +21,7 @@
set(DOCUMENTATION "TODO")
otb_module(OTBMathParserX
+ENABLE_SHARED
DEPENDS
OTBCommon
OTBITK
diff --git a/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx b/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx
index 161c812d97868ba85373ebcad5636ccbb2ca8f64..1be3767f89baf610ed1c084cb530ea0102076fd5 100644
--- a/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx
+++ b/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx
@@ -31,7 +31,9 @@
#include "itkImageRegionIteratorWithIndex.h"
-
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
int otbBandMathXImageFilter( int itkNotUsed(argc), char* itkNotUsed(argv) [])
{
diff --git a/Modules/Filtering/Path/include/otbCompacityPathFunction.hxx b/Modules/Filtering/Path/include/otbCompacityPathFunction.hxx
index 3360698d5ba7a523cca4adc4b6c38cc040a709e2..7994ca8a053dadfff3ad1eb5787bf5e665bcb72d 100644
--- a/Modules/Filtering/Path/include/otbCompacityPathFunction.hxx
+++ b/Modules/Filtering/Path/include/otbCompacityPathFunction.hxx
@@ -45,7 +45,6 @@ CompacityPathFunction
{
VertexListPointer vertexList;
VertexType cindex;
- VertexType IndexOut;
int nbPath;
RealType Surface = 0.0;
RealType Perimeter = 0.0;
diff --git a/Modules/Filtering/Path/include/otbOrientationPathFunction.hxx b/Modules/Filtering/Path/include/otbOrientationPathFunction.hxx
index cb604d60ef9150f03e2af85b8a2ca8e1205a666a..ff4eac938c5bdc3f8ea2f798fad7f9b8e0c65432 100644
--- a/Modules/Filtering/Path/include/otbOrientationPathFunction.hxx
+++ b/Modules/Filtering/Path/include/otbOrientationPathFunction.hxx
@@ -46,7 +46,6 @@ OrientationPathFunction
{
VertexListPointer vertexList;
VertexType cindex;
- VertexType IndexOut;
int nbPath;
RealType Theta;
diff --git a/Modules/Filtering/Path/test/otbImageToEdgePathFilter.cxx b/Modules/Filtering/Path/test/otbImageToEdgePathFilter.cxx
index 688bd0fca736b92ca78a9acc4f90c4d90550df8b..d49188156f3a41d611406920f52dcef1ba550e86 100644
--- a/Modules/Filtering/Path/test/otbImageToEdgePathFilter.cxx
+++ b/Modules/Filtering/Path/test/otbImageToEdgePathFilter.cxx
@@ -59,12 +59,10 @@ int otbImageToEdgePathFilter(int itkNotUsed(argc), char * argv[])
PathType * outputPath = pathFilter->GetOutput();
- typedef PathType::VertexType VertexType;
typedef PathType::VertexListType VertexListType;
typedef VertexListType::ConstPointer VertexListTypePointer;
VertexListTypePointer vertexList;
- VertexType cindex;
VertexListTypePointer ptrVertexList = outputPath->GetVertexList();
diff --git a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.hxx b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.hxx
index d3e1d6e60a9685044e04bbd321b059cf4f79901c..e5d3eacbc4fd867a389488edc96499ce321edf37 100644
--- a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.hxx
+++ b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.hxx
@@ -27,6 +27,7 @@
#include "itkImageRegionIterator.h"
#include "itkProgressReporter.h"
#include "otbMath.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
namespace otb
{
@@ -46,6 +47,7 @@ MultiChannelsPolarimetricSynthesisFilter
m_EmissionH(false),
m_EmissionV(false)
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
this->InPlaceOff();
m_ArchitectureType = PolarimetricData::New();
diff --git a/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h b/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h
index 549375d5cd25d48f5cea3f436cc92d3e0266b84e..d93b00964a20bef245185c8001240a98155d6560 100644
--- a/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h
+++ b/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h
@@ -23,6 +23,7 @@
#include "itkDataObject.h"
#include "itkObjectFactory.h"
+#include "OTBPolarimetryExport.h"
namespace otb
{
@@ -51,7 +52,7 @@ typedef enum
* \ingroup OTBPolarimetry
*/
-class ITK_EXPORT PolarimetricData : public itk::DataObject
+class OTBPolarimetry_EXPORT PolarimetricData : public itk::DataObject
{
public:
diff --git a/Modules/Filtering/Polarimetry/otb-module.cmake b/Modules/Filtering/Polarimetry/otb-module.cmake
index 036edbb60f9253a61e11a60a63a1b2ba50ff835b..6d67952659c5cb187a67dfc4383c115888f14903 100644
--- a/Modules/Filtering/Polarimetry/otb-module.cmake
+++ b/Modules/Filtering/Polarimetry/otb-module.cmake
@@ -26,6 +26,7 @@ representations of a polarisation state, to perform polarimetry synthesis, and s
on.")
otb_module(OTBPolarimetry
+ENABLE_SHARED
DEPENDS
OTBCommon
OTBITK
diff --git a/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.hxx b/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.hxx
index 22ffe1ad8d2acc41b601c7d5f5736deab2f797d9..2de1e47fe4c56f7135edd05a9c6d45903fb48a75 100644
--- a/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.hxx
+++ b/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.hxx
@@ -248,7 +248,6 @@ GCPsToRPCSensorModelImageFilter
rsTransform->SetInputKeywordList(m_Keywordlist);
rsTransform->InstantiateTransform();
- ContinuousIndexType idFix, idOut;
Continuous3DIndexType idOut3D, idTrans3D;
Point2DType sensorPoint;
@@ -274,10 +273,6 @@ GCPsToRPCSensorModelImageFilter
groundPointTemp = rsTransform->TransformPoint(sensorPointTemp);
- // Compute Euclidian distance
- idFix[0] = sensorPoint[0];
- idFix[1] = sensorPoint[1];
-
idOut3D[0] = groundPoint[0];
idOut3D[1] = groundPoint[1];
idOut3D[2] = groundPoint[2];
diff --git a/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.hxx b/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.hxx
index 67704d57afab90778056ffff297446a67d428da2..972e90fcf97387f87c9e71da7d1fc6ebf2c75c1e 100644
--- a/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.hxx
+++ b/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.hxx
@@ -26,6 +26,10 @@
#include
#include "otbStopwatch.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
namespace otb
{
diff --git a/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterCheckRpcModel.cxx b/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterCheckRpcModel.cxx
index a7f96117e0790366160dace88340ecdc6e7fb131..3dc4058c842d1b6c51e4343e960e581c60e0b654 100644
--- a/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterCheckRpcModel.cxx
+++ b/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterCheckRpcModel.cxx
@@ -26,6 +26,10 @@
#include "otbMacro.h"
#include
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
int otbGCPsToRPCSensorModelImageFilterCheckRpcModel(int argc, char * argv[])
{
// Look for tolerance value
diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.hxx b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.hxx
index 8a64b7c86048b21e50c3bd6b5bf9e3c6b47c23b6..5d9c3d405cfb1ea15b7d750a4eaf6be1f2c94350 100644
--- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.hxx
+++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.hxx
@@ -47,6 +47,7 @@ MeanShiftSmoothingImageFilterSetNumberOfRequiredOutputs(4);
this->SetNthOutput(0, OutputImageType::New());
this->SetNthOutput(1, OutputSpatialImageType::New());
diff --git a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.hxx b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.hxx
index 188d892c8945c1212303f5761c21b1b5865353fa..f3ec171f4688244b0ecf82cf0a02474cb26a57d2 100644
--- a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.hxx
@@ -29,6 +29,7 @@ template < class TInputImage, class TOutputImage >
NormalizeVectorImageFilter< TInputImage, TOutputImage >
::NormalizeVectorImageFilter ()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_IsGivenMean = false;
m_IsGivenStdDev = false;
diff --git a/Modules/Filtering/Statistics/include/otbPatternSampler.h b/Modules/Filtering/Statistics/include/otbPatternSampler.h
index 45daa2f5094203ebf80d155a6481e743442cf5cf..ab847cee5923153809c9bceca89a589870c17f61 100644
--- a/Modules/Filtering/Statistics/include/otbPatternSampler.h
+++ b/Modules/Filtering/Statistics/include/otbPatternSampler.h
@@ -22,6 +22,7 @@
#define otbPatternSampler_h
#include "otbSamplerBase.h"
+#include "OTBStatisticsExport.h"
#include
namespace otb
@@ -36,7 +37,7 @@ namespace otb
*
* \ingroup OTBStatistics
*/
-class ITK_EXPORT PatternSampler : public SamplerBase
+class OTBStatistics_EXPORT PatternSampler : public SamplerBase
{
public:
typedef PatternSampler Self;
diff --git a/Modules/Filtering/Statistics/include/otbPeriodicSampler.h b/Modules/Filtering/Statistics/include/otbPeriodicSampler.h
index f70a019f2f5f52e1df30ea996e2b55728f1b9e71..79a2e6b2cd5b9efa0b88919a4a075cd5873f0e5a 100644
--- a/Modules/Filtering/Statistics/include/otbPeriodicSampler.h
+++ b/Modules/Filtering/Statistics/include/otbPeriodicSampler.h
@@ -22,6 +22,7 @@
#define otbPeriodicSampler_h
#include "otbSamplerBase.h"
+#include "OTBStatisticsExport.h"
namespace otb
{
@@ -35,7 +36,7 @@ namespace otb
*
* \ingroup OTBStatistics
*/
-class ITK_EXPORT PeriodicSampler : public SamplerBase
+class OTBStatistics_EXPORT PeriodicSampler : public SamplerBase
{
public:
typedef PeriodicSampler Self;
diff --git a/Modules/Filtering/Statistics/include/otbRandomSampler.h b/Modules/Filtering/Statistics/include/otbRandomSampler.h
index 6d0a8411a31d6ff831c0768b87c2928fdfa7a626..1355b80f423378ea8bf049afa444415f48fcc004 100644
--- a/Modules/Filtering/Statistics/include/otbRandomSampler.h
+++ b/Modules/Filtering/Statistics/include/otbRandomSampler.h
@@ -22,6 +22,7 @@
#define otbRandomSampler_h
#include "otbSamplerBase.h"
+#include "OTBStatisticsExport.h"
namespace otb
{
@@ -36,7 +37,7 @@ namespace otb
*
* \ingroup OTBStatistics
*/
-class ITK_EXPORT RandomSampler : public SamplerBase
+class OTBStatistics_EXPORT RandomSampler : public SamplerBase
{
public:
typedef RandomSampler Self;
diff --git a/Modules/Filtering/Statistics/include/otbSamplerBase.h b/Modules/Filtering/Statistics/include/otbSamplerBase.h
index 1dc0f328da30d576a78c1c439e5cc0c1bf88af00..2bdd0fa6e5b6a45670bfff91bd60c46abe587610 100644
--- a/Modules/Filtering/Statistics/include/otbSamplerBase.h
+++ b/Modules/Filtering/Statistics/include/otbSamplerBase.h
@@ -23,6 +23,7 @@
#include "itkObject.h"
#include "itkObjectFactory.h"
+#include "OTBStatisticsExport.h"
namespace otb
{
@@ -34,7 +35,7 @@ namespace otb
*
* \ingroup OTBStatistics
*/
-class ITK_EXPORT SamplerBase : public itk::Object
+class OTBStatistics_EXPORT SamplerBase : public itk::Object
{
public:
typedef SamplerBase Self;
diff --git a/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.hxx b/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.hxx
index fc9d29ac02c5e86b6328e1f05ee6525b641d9372..5d123624cf408006293f4086aa95255a86aaffa7 100644
--- a/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.hxx
@@ -35,6 +35,7 @@ PersistentCompareImageFilter
::PersistentCompareImageFilter() : m_SquareOfDifferences(1), m_AbsoluteValueOfDifferences(1),
m_ThreadMinRef(1), m_ThreadMaxRef(1), m_Count(1), m_DiffCount(1), m_PhysicalSpaceCheck(true)
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs( 2 );
// first output is a copy of the image, DataObject created by
// superclass
diff --git a/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.hxx b/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.hxx
index 7faf8fe79552fd323fc194e80b314254e76e1d73..f3aead936a76661c3126b4c04d0813c698c143bd 100644
--- a/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.hxx
@@ -47,9 +47,8 @@ PersistentHistogramVectorImageFilter
//
// allocate the data objects for the outputs which are
// just decorators around pixel types and histogram list
-
+ OTB_DISABLE_DYNAMIC_MT;
m_Size.Fill(255);
-
HistogramListPointerType output = static_cast(this->MakeOutput(1).GetPointer());
this->itk::ProcessObject::SetNthOutput(1, output.GetPointer());
}
diff --git a/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.hxx b/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.hxx
index a3f5fde6741caff765f03d6ce173ed69519a5cad..0e4c8e5fead75421c2acb71a361b9719db9b58ed 100644
--- a/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.hxx
@@ -35,6 +35,7 @@ template
PersistentMinMaxImageFilter
::PersistentMinMaxImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
// TODO : SetNumberOfRequiredOutputs
// first output is a copy of the image, DataObject created by
diff --git a/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.hxx b/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.hxx
index 311b01e316aecc6f704606e96547d381ad8299bb..81a9d90b4f396a150308a69685aa0c6a09d09889 100644
--- a/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.hxx
@@ -38,6 +38,7 @@ PersistentMinMaxVectorImageFilter
: m_NoDataFlag(false),
m_NoDataValue(itk::NumericTraits::Zero)
{
+ OTB_DISABLE_DYNAMIC_MT;
// first output is a copy of the image, DataObject created by
// superclass
//
diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.hxx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.hxx
index 1ea91025fc08cf0924e5c23e0c15dc080e6b7f88..fad7a7dd58c3d83a8ff726befc6ce7e0b4960cda 100644
--- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.hxx
@@ -27,6 +27,10 @@
#include "itkProgressReporter.h"
#include "otbMacro.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
namespace otb
{
@@ -40,7 +44,8 @@ PersistentStatisticsImageFilter
m_ThreadMax(1),
m_IgnoreInfiniteValues(true),
m_IgnoreUserDefinedValue(false)
- {
+{
+ OTB_DISABLE_DYNAMIC_MT;
// first output is a copy of the image, DataObject created by
// superclass
//
diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.hxx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.hxx
index 7a0ecf30e80eaedea6c10e81622acb62b6f78ea7..592c17c66f50d8fd0960b17c84294052be0f3cc8 100644
--- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.hxx
@@ -42,6 +42,7 @@ PersistentStreamingStatisticsMapFromLabelImageFilter(this->MakeOutput(1).GetPointer());
this->itk::ProcessObject::SetNthOutput(1, output.GetPointer());
diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.hxx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.hxx
index cf1d13ff7502f4860176619e9334b45659b70037..144ef641d6e4c13fa23c5fa1f758ba849ff58d52 100644
--- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.hxx
@@ -27,6 +27,10 @@
#include "itkProgressReporter.h"
#include "otbMacro.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
namespace otb
{
@@ -41,6 +45,7 @@ PersistentStreamingStatisticsVectorImageFilter
m_IgnoreUserDefinedValue(false),
m_UserIgnoredValue(itk::NumericTraits::Zero)
{
+ OTB_DISABLE_DYNAMIC_MT;
// first output is a copy of the image, DataObject created by
// superclass
diff --git a/Modules/Filtering/Statistics/include/otbVarianceImageFilter.hxx b/Modules/Filtering/Statistics/include/otbVarianceImageFilter.hxx
index 4a36287a0b878b608c5a125581dc330e61119a37..2ea6eaeb0080b28b54be7a597e7167cbd785b675 100644
--- a/Modules/Filtering/Statistics/include/otbVarianceImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbVarianceImageFilter.hxx
@@ -21,6 +21,7 @@
#ifndef otbVarianceImageFilter_hxx
#define otbVarianceImageFilter_hxx
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
#include "otbVarianceImageFilter.h"
#include "itkConstNeighborhoodIterator.h"
@@ -37,6 +38,7 @@ template
VarianceImageFilter
::VarianceImageFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_Radius.Fill(1);
}
diff --git a/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.hxx b/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.hxx
index 9b411cdfeebf9f40ca215837c5dc2ca205f69f8f..7a28b2335637864d109094438037d934a61c12b7 100644
--- a/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.hxx
@@ -36,7 +36,7 @@ template
VectorImageToIntensityImageFilter
::VectorImageToIntensityImageFilter()
{
-
+ OTB_DISABLE_DYNAMIC_MT;
}
template
diff --git a/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.hxx b/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.hxx
index c92ea88fe76846b9807ee62647f2fc9ad3d1e237..34a781d83d6ba18e4afc09f28d0e3b396ca50e3f 100644
--- a/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.hxx
@@ -35,6 +35,7 @@ template
PersistentVectorImageToMatrixFilter
::PersistentVectorImageToMatrixFilter()
{
+ OTB_DISABLE_DYNAMIC_MT;
// first output is a copy of the image, DataObject created by
// superclass
//
diff --git a/Modules/Filtering/Statistics/otb-module.cmake b/Modules/Filtering/Statistics/otb-module.cmake
index 855eb0b37dfcba94ccdc0ecf071849612d7c16af..934b57c10bc936c370ea3622003aa0b3c660f84d 100644
--- a/Modules/Filtering/Statistics/otb-module.cmake
+++ b/Modules/Filtering/Statistics/otb-module.cmake
@@ -26,6 +26,7 @@ of the input sample list, and so on. The other part works on images and labelMap
and allows the calculation of classical statistics (min max mean histogram).")
otb_module(OTBStatistics
+ENABLE_SHARED
DEPENDS
OTBCommon
OTBITK
diff --git a/Modules/Filtering/VectorDataManipulation/include/otbPolygonCompacityFunctor.h b/Modules/Filtering/VectorDataManipulation/include/otbPolygonCompacityFunctor.h
index 8bf3100e00364007507c2f7384d555a20a8fd792..ad4355f049fcbcfde609bf0f05f2d6a4567d302d 100644
--- a/Modules/Filtering/VectorDataManipulation/include/otbPolygonCompacityFunctor.h
+++ b/Modules/Filtering/VectorDataManipulation/include/otbPolygonCompacityFunctor.h
@@ -23,6 +23,10 @@
#include "otbMath.h"
+#if ITK_VERSION_MAJOR >= 5
+#include "vcl_legacy_aliases.h" // ITK v5 compatibility
+#endif
+
namespace otb
{
diff --git a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h
index 6fe5288153396f8db77d8d053c17470b590c1a3c..e0da51af594bb4a48eaf807ae71c9efb5e87cded 100644
--- a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h
+++ b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h
@@ -25,6 +25,7 @@
#include "itkImageToImageFilter.h"
#include "itkImage.h"
+#include "otbMacro.h" //for OTB_DISABLE_DYNAMIC_MT;
//Just to get the forward/inverse definitions
#include "otbWaveletOperatorBase.h"
@@ -103,6 +104,7 @@ public:
protected:
SubsampleImageFilter ()
{
+ OTB_DISABLE_DYNAMIC_MT;
m_SubsampleFactor.Fill(1);
}
~SubsampleImageFilter() override {}
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.hxx b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.hxx
index 62c13ef8629f95ce7420364888a16123f5426c6d..b764bfbd068e07d38c24b3efdfab4b8eeff350ee 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.hxx
+++ b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.hxx
@@ -39,6 +39,7 @@ template
WaveletFilterBank
::WaveletFilterBank ()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredInputs(1);
@@ -608,6 +609,7 @@ template
WaveletFilterBank
::WaveletFilterBank ()
{
+ OTB_DISABLE_DYNAMIC_MT;
this->SetNumberOfRequiredInputs(1 << InputImageDimension);
m_UpSampleFilterFactor = 0;
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h b/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h
index 1c4e492afb9502144c27a6d042a0bb6ec255f81a..2528f5656eccdc69cc8bf728ef21ffe258d2e765 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h
@@ -26,6 +26,7 @@
#include
#include "itkLightObject.h"
#include "itkObjectFactory.h"
+#include "OTBWaveletExport.h"
namespace otb
{
@@ -61,7 +62,7 @@ enum Wavelet {
* \ingroup OTBWavelet
*/
template
-class ITK_EXPORT WaveletGenerator
+class OTBWavelet_EXPORT WaveletGenerator
: public itk::LightObject
{
public:
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletsBandsListToWaveletsSynopsisImageFilter.hxx b/Modules/Filtering/Wavelet/include/otbWaveletsBandsListToWaveletsSynopsisImageFilter.hxx
index 3925a187f945352135de8be2533ee6e9d0b0ddc2..3400df31d0489a4cb8ecb6e0c54bc43ecdeddf24 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletsBandsListToWaveletsSynopsisImageFilter.hxx
+++ b/Modules/Filtering/Wavelet/include/otbWaveletsBandsListToWaveletsSynopsisImageFilter.hxx
@@ -33,7 +33,9 @@ namespace otb
template
WaveletsBandsListToWaveletsSynopsisImageFilter
::WaveletsBandsListToWaveletsSynopsisImageFilter() : m_DecimationRatio(2)
-{}
+{
+OTB_DISABLE_DYNAMIC_MT;
+}
/** Destructor */
template
diff --git a/Modules/Filtering/Wavelet/otb-module.cmake b/Modules/Filtering/Wavelet/otb-module.cmake
index 405672597ae8fe5cfbfb8daa94189bd733cbc515..6e881c5df52ea980f59929797446b72643d0dfbe 100644
--- a/Modules/Filtering/Wavelet/otb-module.cmake
+++ b/Modules/Filtering/Wavelet/otb-module.cmake
@@ -21,6 +21,7 @@
set(DOCUMENTATION "This module contains classes for wavelet analysis.")
otb_module(OTBWavelet
+ENABLE_SHARED
DEPENDS
OTBCommon
OTBITK
diff --git a/Modules/Filtering/Wavelet/test/otbWaveletTransform.cxx b/Modules/Filtering/Wavelet/test/otbWaveletTransform.cxx
index 2c7c3a071d7c78d2d1be97a33e764d418b53e0bb..41a4e691f69b05ad13cc87523c6e373fc324a425 100644
--- a/Modules/Filtering/Wavelet/test/otbWaveletTransform.cxx
+++ b/Modules/Filtering/Wavelet/test/otbWaveletTransform.cxx
@@ -42,8 +42,12 @@ int otbWaveletTransform_generic(int argc, char * argv[])
if (argc == 7)
{
- unsigned int NbOfThreads = atoi(argv[6]);
- itk::MultiThreader::SetGlobalDefaultNumberOfThreads(NbOfThreads);
+ unsigned int NbOfThreads = atoi(argv[6]);
+#if ITK_VERSION_MAJOR < 5
+ itk::MultiThreader::SetGlobalDefaultNumberOfThreads(NbOfThreads);
+#else
+ itk::MultiThreaderBase::SetGlobalDefaultNumberOfThreads(NbOfThreads);
+#endif
}
diff --git a/Modules/Fusion/Fuzzy/include/otbFuzzyDescriptorsModelManager.h b/Modules/Fusion/Fuzzy/include/otbFuzzyDescriptorsModelManager.h
index d4eac61f52f45c90ba74f4b4a636c594656de180..a6746eecb0dd6347cfb36ad02494f54434496987 100644
--- a/Modules/Fusion/Fuzzy/include/otbFuzzyDescriptorsModelManager.h
+++ b/Modules/Fusion/Fuzzy/include/otbFuzzyDescriptorsModelManager.h
@@ -24,7 +24,7 @@
#include
#include
#include
-
+#include "OTBFuzzyExport.h"
namespace otb {
@@ -39,7 +39,7 @@ namespace otb {
*
* \ingroup OTBFuzzy
*/
- class FuzzyDescriptorsModelManager
+class OTBFuzzy_EXPORT FuzzyDescriptorsModelManager
{
public:
/** Standard class typedefs */
diff --git a/Modules/Fusion/Fuzzy/otb-module.cmake b/Modules/Fusion/Fuzzy/otb-module.cmake
index b0db872c24065b7cc0d647984cc08093df735c2e..7358164bfc4a09eb2aa3c92ffedc94b16c4c7b31 100644
--- a/Modules/Fusion/Fuzzy/otb-module.cmake
+++ b/Modules/Fusion/Fuzzy/otb-module.cmake
@@ -25,6 +25,7 @@ membership value for each one of the qualitative values. it also contains classe
to handle xml files where are stored several statistics.")
otb_module(OTBFuzzy
+ENABLE_SHARED
DEPENDS
OTBCommon
OTBTinyXML
diff --git a/Modules/IO/Carto/include/otbCoordinateToName.h b/Modules/IO/Carto/include/otbCoordinateToName.h
index f440ae084cce6e731a1e0e71d9020bce4228862b..e3b982670b6206870ef461b2026569c09e5789de 100644
--- a/Modules/IO/Carto/include/otbCoordinateToName.h
+++ b/Modules/IO/Carto/include/otbCoordinateToName.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
+ * Copyright (C) 2018 CS Systemes d'Information (CS SI)
*
* This file is part of Orfeo Toolbox
*
@@ -22,9 +23,17 @@
#define otbCoordinateToName_h
#include "itkPoint.h"
+
+#if ITK_VERSION_MAJOR < 5
#include "itkMultiThreader.h"
+#else
+#include "itkPlatformMultiThreader.h"
+#endif
+
+#include "itkConfigure.h"
#include "otbCurlHelperInterface.h"
#include "OTBCartoExport.h"
+#include "otbMacro.h" //for ITK_THREAD_RETURN_TYPE in ITK5
#include