Commit a5ec67b7 authored by Guillaume Pasero's avatar Guillaume Pasero

Synchronization : merge branch 'develop' into sampling_polygon_analysis

parents 2122e15c 68c43d05
......@@ -16,15 +16,12 @@ before_script:
- export MAKE_CMD=/tmp/ninja
- export CMAKE_GEN='Ninja'
- cd /tmp
-
- wget https://cmake.org/files/v3.4/cmake-3.4.1-Linux-x86_64.tar.gz --no-check-certificate
- wget https://raw.githubusercontent.com/rkanavath/otb_cmake_scripts/master/rashad-cm.cmake --no-check-certificate
- tar -xzf cmake-3.4.1-Linux-x86_64.tar.gz
- wget https://github.com/martine/ninja/releases/download/v1.6.0/ninja-linux.zip --no-check-certificate
- unzip ninja-linux.zip
- wget https://www.orfeo-toolbox.org/packages/xdk/OTB-5.2/OTB-5.2.0-xdk-Linux64.run --no-check-certificate
- wget https://www.orfeo-toolbox.org/packages/xdk/OTB-5.2/OTB-5.2.0-xdk-Linux64.run --no-check-certificate
- chmod +x /tmp/OTB-5.2.0-xdk-Linux64.run
- /tmp/OTB-5.2.0-xdk-Linux64.run
script: /tmp/cmake-3.4.1-Linux-x86_64/bin/ctest -VV -S /tmp/rashad-cm.cmake
script: /tmp/cmake-3.4.1-Linux-x86_64/bin/ctest -VV -S /home/travis/build/orfeotoolbox/OTB/Utilities/Maintenance/TravisBuild.cmake
......@@ -31,6 +31,10 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE
# Exclude files from the Examples directories
#".*/Examples/.*"
# Exclude files from the Testing directories
".*/test/.*"
".*/Testing/.*"
# Exclude files from the ThirdParty Utilities directories
".*/Modules/ThirdParty/.*"
".*/Utilities/.*"
......
# Courtesy of: https://raw.github.com/progschj/OpenGL-Examples/
#
# Try to find GLEW library and include path.
# Once done this will define
#
# GLEW_FOUND
# GLEW_INCLUDE_PATH
# GLEW_LIBRARY
#
IF (WIN32)
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
$ENV{PROGRAMFILES}/GLEW/include
${GLEW_ROOT_DIR}/include
DOC "The directory where GL/glew.h resides")
FIND_LIBRARY( GLEW_LIBRARY
NAMES glew GLEW glew32 glew32s
PATHS
$ENV{PROGRAMFILES}/GLEW/lib
${GLEW_ROOT_DIR}/lib
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
DOC "The GLEW library")
ELSE (WIN32)
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${GLEW_ROOT_DIR}/include
DOC "The directory where GL/glew.h resides")
# Prefer the static library.
FIND_LIBRARY( GLEW_LIBRARY
NAMES libGLEW.so GLEW
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${GLEW_ROOT_DIR}/lib
DOC "The GLEW library")
ENDIF (WIN32)
SET(GLEW_FOUND "NO")
IF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
SET(GLEW_LIBRARIES ${GLEW_LIBRARY})
SET(GLEW_FOUND "YES")
ENDIF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG GLEW_LIBRARY)
# Locate the glfw library
# This module defines the following variables:
# GLFW_LIBRARY, the name of the library;
# GLFW_INCLUDE_DIR, where to find glfw include files.
# GLFW_FOUND, true if both the GLFW_LIBRARY and GLFW_INCLUDE_DIR have been found.
#
# To help locate the library and include file, you could define an environment variable called
# GLFW_ROOT which points to the root of the glfw library installation. This is pretty useful
# on a Windows platform.
#
#
# Usage example to compile an "executable" target to the glfw library:
#
# FIND_PACKAGE (glfw REQUIRED)
# INCLUDE_DIRECTORIES (${GLFW_INCLUDE_DIR})
# ADD_EXECUTABLE (executable ${EXECUTABLE_SRCS})
# TARGET_LINK_LIBRARIES (executable ${GLFW_LIBRARY})
#
# TODO:
# Allow the user to select to link to a shared library or to a static library.
#Search for the include file...
FIND_PATH(GLFW_INCLUDE_DIR GLFW/glfw3.h DOC "Path to GLFW include directory."
HINTS
$ENV{GLFW_ROOT}
PATH_SUFFIX
include # For finding the include file under the root of the glfw expanded archive, typically on Windows.
)
FIND_LIBRARY(GLFW_LIBRARY DOC "Absolute path to GLFW library."
NAMES glfw glfw3dll glfw3
HINTS
$ENV{GLFW_ROOT}
PATH_SUFFIXES
lib # For finding the library file under the root of the glfw expanded archive, typically on Windows.
)
IF(GLFW_INCLUDE_DIR AND EXISTS "${GLFW_INCLUDE_DIR}/GLFW/glfw3.h")
FILE(STRINGS "${GLFW_INCLUDE_DIR}/GLFW/glfw3.h" glfw_version_str
REGEX "^#[\t ]*define[\t ]+GLFW_VERSION_(MAJOR|MINOR|REVISION)[\t ]+[0-9]+$")
UNSET(GLFW_VERSION_STRING)
FOREACH(VPART MAJOR MINOR REVISION)
FOREACH(VLINE ${glfw_version_str})
IF(VLINE MATCHES "^#[\t ]*define[\t ]+GLFW_VERSION_${VPART}")
STRING(REGEX REPLACE "^#[\t ]*define[\t ]+GLFW_VERSION_${VPART}[\t ]+([0-9]+)$" "\\1"
GLFW_VERSION_PART "${VLINE}")
IF(GLFW_VERSION_STRING)
SET(GLFW_VERSION_STRING "${GLFW_VERSION_STRING}.${GLFW_VERSION_PART}")
ELSE()
SET(GLFW_VERSION_STRING "${GLFW_VERSION_PART}")
ENDIF()
UNSET(GLFW_VERSION_PART)
ENDIF()
ENDFOREACH()
ENDFOREACH()
ENDIF()
INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW
REQUIRED_VARS GLFW_LIBRARY GLFW_INCLUDE_DIR
VERSION_VAR GLFW_VERSION_STRING)
\ No newline at end of file
......@@ -16,6 +16,7 @@ set(group_list
Remote
Segmentation
ThirdParty
Visualization
Wrappers
)
......@@ -34,8 +35,10 @@ set(Radiometry_documentation "This group contains algorithms related to the proc
set(Registration_documentation "This group contains algorithms related to registration of images")
set(Segmentation_documentation "This group contains algorithms related to image segmentaiton")
set(ThirdParty_documentation "This group contains all Orfeo ToolBox third parties")
set(Visualization_documentation "This group contains Ice (visualization framework) and IceViewer (visualization tool)")
set(Wrappers_documentation "This group contains the application framework and the wrappers to use it")
set(Remote_documentation "This group of modules is for OTB based code that have
additional third-party dependencies not bundled with the toolkit,
new algorithms or implementations seeking greater exposure and adoption,
......
......@@ -213,7 +213,14 @@ private:
goesOn2 = feature2.addr() != 0;
count++;
}
layer2.ogr().CommitTransaction();
const OGRErr err = layer2.ogr().CommitTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << layer2.ogr().GetName() << ".");
}
source2->SyncToDisk();
clock_t toc = clock();
......
......@@ -335,7 +335,12 @@ private:
firstFeature=nextFeature;
}
layer.ogr().CommitTransaction();
const OGRErr err = layer.ogr().CommitTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << layer.ogr().GetName() << ".");
}
if(extension==".shp"){
sqloss.str("");
......
......@@ -48,7 +48,7 @@ otb_test_application(NAME apTvDmStereoFramework
#----------- StereoRectificationGridGenerator TESTS ----------------
otb_test_application(NAME apTuDmStereoRectificationGridGeneratorTest
otb_test_application(NAME apTvDmStereoRectificationGridGeneratorTest
APP StereoRectificationGridGenerator
OPTIONS -io.inleft ${EXAMPLEDATA}/sensor_stereo_left.tif
......
......@@ -18,7 +18,13 @@
#ifndef _otbConfigurationManager_h
#define _otbConfigurationManager_h
#include "itkVersion.h"
#if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 8)
#include "itksys/FundamentalType.h"
#else
#include "itk_kwiml.h"
#endif
#include <string>
#include <boost/cstdint.hpp>
......@@ -38,7 +44,11 @@ namespace otb
class ConfigurationManager
{
public:
#if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 8)
typedef ::itksysFundamentalType_UInt64 RAMValueType;
#else
typedef KWIML_INT_uint64_t RAMValueType;
#endif
/**
* DEMDirectory is a directory were DEM tiles are stored.
......
......@@ -316,7 +316,7 @@ SubsampledImageRegionConstIterator<TImage>
{
// Get the index of the first pixel on the span (row)
IndexType ind = this->m_Image->ComputeIndex(static_cast<IndexValueType>(this->m_Offset));
IndexType& startIndex = this->m_Region.GetIndex();
const IndexType& startIndex = this->m_Region.GetIndex();
// Deccrement along a row, then wrap at the beginning of the region row.
bool done;
......
......@@ -90,7 +90,7 @@ otb_add_test(NAME coTvExtractROI2 COMMAND otbImageBaseTestDriver
26 97 209 100 )
otb_add_test(NAME bfTuComplexToVectorImageCastFilterTest COMMAND otbImageBaseTestDriver
otb_add_test(NAME bfTvComplexToVectorImageCastFilterTest COMMAND otbImageBaseTestDriver
--compare-n-images ${NOTOL} 2
${BASELINE}/bfTvComplexToVectorImageCastFilterTest.tif
${TEMP}/bfTvComplexToVectorImageCastFilterTest.tif
......
......@@ -40,7 +40,7 @@ otb_add_test(NAME bfTuImageToPointSetFilterTest COMMAND otbPointSetTestDriver
otb_add_test(NAME bfTvTransformPointSetFilter COMMAND otbPointSetTestDriver
otbTransformPointSetFilterTest)
otb_add_test(NAME feTuThresholdImageToPointSet1 COMMAND otbPointSetTestDriver
otb_add_test(NAME feTvThresholdImageToPointSet1 COMMAND otbPointSetTestDriver
--compare-ascii ${EPSILON_3} ${BASELINE_FILES}/feThresholdImageToPointSet_Threshold_0To255.txt
${TEMP}/feThresholdImageToPointSet_Threshold_0To255.txt
otbThresholdImageToPointSetTest
......@@ -48,7 +48,7 @@ otb_add_test(NAME feTuThresholdImageToPointSet1 COMMAND otbPointSetTestDriver
${TEMP}/feThresholdImageToPointSet_Threshold_0To255.txt
0 255 )
otb_add_test(NAME feTuThresholdImageToPointSet2 COMMAND otbPointSetTestDriver
otb_add_test(NAME feTvThresholdImageToPointSet2 COMMAND otbPointSetTestDriver
--compare-ascii ${EPSILON_3} ${BASELINE_FILES}/feThresholdImageToPointSet_Threshold_0To0.txt
${TEMP}/feThresholdImageToPointSet_Threshold_0To0.txt
otbThresholdImageToPointSetTest
......@@ -56,7 +56,7 @@ otb_add_test(NAME feTuThresholdImageToPointSet2 COMMAND otbPointSetTestDriver
${TEMP}/feThresholdImageToPointSet_Threshold_0To0.txt
0 0 )
otb_add_test(NAME feTuThresholdImageToPointSet3 COMMAND otbPointSetTestDriver
otb_add_test(NAME feTvThresholdImageToPointSet3 COMMAND otbPointSetTestDriver
--compare-ascii ${EPSILON_3} ${BASELINE_FILES}/feThresholdImageToPointSet_Threshold_255To255.txt
${TEMP}/feThresholdImageToPointSet_Threshold_255To255.txt
otbThresholdImageToPointSetTest
......@@ -64,7 +64,7 @@ otb_add_test(NAME feTuThresholdImageToPointSet3 COMMAND otbPointSetTestDriver
${TEMP}/feThresholdImageToPointSet_Threshold_255To255.txt
255 255 )
otb_add_test(NAME feTuThresholdImageToPointSet4 COMMAND otbPointSetTestDriver
otb_add_test(NAME feTvThresholdImageToPointSet4 COMMAND otbPointSetTestDriver
--compare-ascii ${EPSILON_3} ${BASELINE_FILES}/feThresholdImageToPointSet_Threshold_1To200.txt
${TEMP}/feThresholdImageToPointSet_Threshold_1To200.txt
otbThresholdImageToPointSetTest
......
......@@ -19,7 +19,11 @@
#define __otbPipelineMemoryPrintCalculator_h
#include "itkProcessObject.h"
#if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 8)
#include "itksys/FundamentalType.h"
#else
#include "itk_kwiml.h"
#endif
#include <set>
namespace otb
......@@ -75,7 +79,11 @@ public:
typedef ProcessObjectType::Pointer ProcessObjectPointerType;
typedef itk::DataObject DataObjectType;
typedef DataObjectType::Pointer DataObjectPointerType;
#if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 8)
typedef ::itksysFundamentalType_UInt64 MemoryPrintType;
#else
typedef KWIML_INT_uint64_t MemoryPrintType;
#endif
typedef std::set<const ProcessObjectType *> ProcessObjectPointerSetType;
/** Run-time type information (and related methods). */
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef otbMaskedIteratorDecorator_h
#define otbMaskedIteratorDecorator_h
#include "itkMacro.h"
namespace otb
{
/** \class MaskedIteratorDecorator
* \brief Decorate an iterator to ignore masked pixels
*
* An iterator that dispatches its operations on both an image and a mask using
* two iterators of the same type. It skips over pixels where the value of the
* mask is zero. There is a limitation that the image and the mask must both be
* of the same type.
*
* \ingroup ImageIterator
* \ingroup OTBCommon
*/
template <typename TIteratorType,typename TMaskIteratorType = TIteratorType>
class MaskedIteratorDecorator
{
public:
typedef MaskedIteratorDecorator
<TIteratorType,TMaskIteratorType> Self;
typedef typename TMaskIteratorType::ImageType MaskType;
typedef typename TIteratorType::ImageType ImageType;
typedef typename ImageType::IndexType IndexType;
typedef typename ImageType::RegionType RegionType;
typedef typename ImageType::PixelType PixelType;
typedef typename MaskType::PixelType MaskPixelType;
// Run-time type information
itkTypeMacroNoParent(MaskedIteratorDecorator);
/** Constructors forward arguments to both iterators
* Beware that the iterator is in a undefinite state after construction
* GoToBegin() or GoToEnd() should be called */
MaskedIteratorDecorator(MaskType* mask,
ImageType* image,
const RegionType& region);
/** Current iterator index. Wraps the underlying iterator GetIndex() */
IndexType GetIndex() const;
/** Move to the first valid iteration position. Note that this is different
* from the underlying iterators GoToBegin because their first pixels might be
* masked */
void GoToBegin();
/** Move one pixel past the last valid iteration index */
void GoToEnd();
/** True if the iterator is at the beginning */
bool IsAtBegin() const;
/** True if the iterator is at the end */
bool IsAtEnd() const;
/** Advance to the next valid iteration position. That is the next non masked
* position of the image iterator */
Self& operator++();
/** Move to the previous valid iteration position. That is the previous non
* masked position of the image iterator */
Self & operator--();
/** Set the image pixel value */
//void Set(const PixelType& value) const;
/** Get the image pixel value */
const PixelType& Value(void) const;
// Can't wrap all methods because iterator interface is open ended
// So provide access to inner iterators:
/** Underlying mask iterator accessor */
TMaskIteratorType& GetMaskIterator();
/** Underlying mask iterator const accessor */
const TMaskIteratorType& GetMaskIterator() const;
/** Underlying image iterator accessor */
TIteratorType& GetImageIterator();
/** Underlying image iterator const accessor */
const TIteratorType& GetImageIterator() const;
const bool& HasMask() const;
private:
/** Private method to compute the begin iterator position taking into account
the mask. Called by the constructor. */
void ComputeMaskedBegin();
private:
// Inner iterators on the image and mask
TMaskIteratorType m_ItMask;
TIteratorType m_ItImage;
// flag to check if mask is present
bool m_UseMask;
// Unmasked bounds
TMaskIteratorType m_StartMask;
TIteratorType m_StartImage;
};
}
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbMaskedIteratorDecorator.txx"
#endif
#endif
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef otbMaskedIteratorDecorator_hxx
#define otbMaskedIteratorDecorator_hxx
#include "otbMaskedIteratorDecorator.h"
#include "itkMacro.h"
namespace otb
{
template <typename TIteratorType, typename TMaskIteratorType>
MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>
::MaskedIteratorDecorator( MaskType* mask,
ImageType* image,
const RegionType& region)
{
m_ItImage = TIteratorType(image,region);
if (mask == NULL)
{
m_UseMask = false;
}
else
{
if (image->GetLargestPossibleRegion() != mask->GetLargestPossibleRegion())
{
itkGenericExceptionMacro("Input image and mask have different largest regions : mask is discarded!");
}
else
{
m_UseMask = true;
m_ItMask = TMaskIteratorType(mask,region);
m_StartMask = TMaskIteratorType(mask,region);
m_StartImage = TIteratorType(image,region);
}
}
}
template <typename TIteratorType, typename TMaskIteratorType>
typename MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>::IndexType
MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>
::GetIndex() const
{
return m_ItImage.GetIndex();
}
template <typename TIteratorType, typename TMaskIteratorType>
void
MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>
::GoToBegin()
{
if (m_UseMask)
{
this->ComputeMaskedBegin();
}
else
{
m_ItImage.GoToBegin();
}
}
template <typename TIteratorType, typename TMaskIteratorType>
void
MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>
::GoToEnd()
{
if (m_UseMask)
{
// make sure masked begin is computed as next calls might be operator--()
// and IsAtBegin() (for a reverse iteration)
this->ComputeMaskedBegin();
m_ItMask.GoToEnd();
}
m_ItImage.GoToEnd();
}
template <typename TIteratorType, typename TMaskIteratorType>
bool
MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>
::IsAtBegin() const
{
if (m_UseMask)
{
return m_ItMask == m_StartMask || m_ItImage == m_StartImage;
}
return m_ItImage.IsAtBegin();
}
template <typename TIteratorType, typename TMaskIteratorType>
bool
MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>
::IsAtEnd() const
{
if (m_UseMask)
{
return m_ItMask.IsAtEnd() || m_ItImage.IsAtEnd();
}
return m_ItImage.IsAtEnd();
}
// Wrap the underlying iterators to skip masked pixels
template <typename TIteratorType, typename TMaskIteratorType>
MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>&
MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>
::operator++()
{
if (m_UseMask)
{
do
{
++m_ItMask;
++m_ItImage;
} while (m_ItMask.Value() == 0 && !this->IsAtEnd());
}
else
{
++m_ItImage;
}
return *this;
}