diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index 397e16f84115433f65f838e67366269f2c1af6c9..bd74cab4684e5da66237c2974af569af4599bce9 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -63,6 +63,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION # other warning expression: "[0-9,]+ warnings? generated." ".*include.opencv2.*warning.*" + ".*include.opencv2.*note.*" ".*include.kml.*warning.*" ".*include.ogr_feature.*warning.*" ".*itksys.SharedForward.h.*warning.*" @@ -71,6 +72,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION ".*include.ITK-4.*warning.*" ".*include.curl.curl.h.*warning.*" ".*include.ossim.*warning.*" + ".*include.ossim.*note.*" ".*include.ogr_core.h.*warning.*" ".*include.ogr_srs_api.h.*warning.*" ".*include.ogrsf_frmts.h.*warning.*" @@ -79,4 +81,5 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION ".*include.cpl_error.h.*warning.*" ".*vnl.vnl_numeric_traits.h.*warning.*" ".*vcl_config_compiler.h.*warning.*" + ".*boost.move.unique_ptr.hpp:.*" ) diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx index 19748640c6bdf6e338a699bb8cfa727ea581bc0e..f2200ddd2950c0cf057120dc06c14d8f81d68530 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx +++ b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx @@ -143,11 +143,9 @@ inline void otb::ogr::Feature::SetGeometryDirectly(UniqueGeometryPtr geometry) { CheckInvariants(); - #if !defined(NDEBUG) OGRGeometry * g = geometry.get(); - itkAssertOrThrowMacro((m_Feature->GetGeometryRef() == g), "The new geometry hasn't been set as expected"); - #endif UncheckedSetGeometryDirectly(otb::move(geometry)); + itkAssertOrThrowMacro((m_Feature->GetGeometryRef() == g), "The new geometry hasn't been set as expected"); itkAssertOrThrowMacro(!geometry, "UniqueGeometryPtr hasn't released its pointer"); } diff --git a/Modules/Adapters/OSSIMAdapters/include/otbRPCProjectionAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbRPCProjectionAdapter.h deleted file mode 100644 index 084fc51a217ba5c5b830851b8a7b454ae6508165..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/include/otbRPCProjectionAdapter.h +++ /dev/null @@ -1,93 +0,0 @@ -/*========================================================================= - - 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 __otbRPCProjectionAdapter_h -#define __otbRPCProjectionAdapter_h - -#include "vcl_deprecated_header.h" - -#include <vector> - -#include "itkObject.h" -#include "itkObjectFactory.h" - -#include "itkPoint.h" -#include "itkSize.h" - - -class ossimRpcProjection; - -namespace otb { - -class ImageKeywordlist; - -/** \class RPCProjectionAdapter - * \brief Wrapper class for the ossim Rpc projection - * - * This class is used inside the GCPsToRPCSensorModelImageFilter and should not - * be used directly outside. - * - * \deprecated Please use the RpcSolverAdapter class static methods instead - * - * \sa GCPsToRPCSensorModelImageFilter - * - * \ingroup OTBOSSIMAdapters - **/ - -class RPCProjectionAdapter: public itk::Object -{ -public: - /** Standard class typedefs. */ - typedef RPCProjectionAdapter Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - typedef itk::Point<double, 2> Point2DType; - typedef itk::Point<double, 3> Point3DType; - typedef std::pair<Point2DType, Point3DType> GCPType; - typedef std::vector<GCPType> GCPsContainerType; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(RPCProjectionAdapter, itk::Object); - - void Solve(const GCPsContainerType& gcpContainer, - double& rmsError, ImageKeywordlist& otb_kwl); - void TransformPoint(double x, double y, double z, - double& lon, double& lat, double& h) const; - - void AddGroundRect( ImageKeywordlist& otb_kwl, - itk::Point<double, 2> orig, itk::Size<2> size); - -protected: - RPCProjectionAdapter(); - virtual ~RPCProjectionAdapter(); - -private: - RPCProjectionAdapter(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented - - /** RPC Projection */ - ossimRpcProjection* m_RpcProjection; -}; - -} // namespace otb - -#endif diff --git a/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt b/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt index b7942a9ed5e5cc63945de5b49964990bb00e6b02..257cc6352ea0cbfec69a5bc7feed4e6d09b59fe9 100644 --- a/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt +++ b/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt @@ -6,7 +6,6 @@ set(OTBOSSIMAdapters_SRC otbPlatformPositionAdapter.cxx otbDEMConvertAdapter.cxx otbRPCSolverAdapter.cxx - otbRPCProjectionAdapter.cxx otbDateTimeAdapter.cxx otbMapProjectionAdapter.cxx otbFilterFunctionValues.cxx @@ -15,7 +14,7 @@ set(OTBOSSIMAdapters_SRC ) add_library(OTBOSSIMAdapters ${OTBOSSIMAdapters_SRC}) -target_link_libraries(OTBOSSIMAdapters +target_link_libraries(OTBOSSIMAdapters ${OTBGDAL_LIBRARIES} ${OTBCommon_LIBRARIES} ${OTBOssim_LIBRARIES} diff --git a/Modules/Adapters/OSSIMAdapters/src/otbRPCProjectionAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbRPCProjectionAdapter.cxx deleted file mode 100644 index 61950e8db35ca6caa89009ad9fbfd2bb0d9e206f..0000000000000000000000000000000000000000 --- a/Modules/Adapters/OSSIMAdapters/src/otbRPCProjectionAdapter.cxx +++ /dev/null @@ -1,161 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#include "otbRPCProjectionAdapter.h" -#include "otbImageKeywordlist.h" - -#include "ossim/projection/ossimRpcProjection.h" -#include "ossim/projection/ossimProjection.h" -#include "ossim/projection/ossimRpcSolver.h" -#include "ossim/imaging/ossimImageGeometry.h" - -namespace otb -{ - -RPCProjectionAdapter::RPCProjectionAdapter() -{ - // Create projection - m_RpcProjection = new ossimRpcProjection(); -} - -RPCProjectionAdapter::~RPCProjectionAdapter() -{ - if (m_RpcProjection != NULL) - { - delete m_RpcProjection; - } -} - -void -RPCProjectionAdapter::TransformPoint(double x, double y, double z, - double& lon, double& lat, double& h) const -{ - if (m_RpcProjection == NULL) - { - lon = 0.0; - lat = 0.0; - h = 0.0; - return; - } - ossimDpt spoint( internal::ConvertToOSSIMFrame(x), - internal::ConvertToOSSIMFrame(y)); - ossimGpt gpoint; - gpoint.hgt = z; - - m_RpcProjection->lineSampleToWorld(spoint, gpoint); - lon = gpoint.lon; - lat = gpoint.lat; - h = gpoint.hgt; -} - -void -RPCProjectionAdapter::Solve(const GCPsContainerType& gcpContainer, - double& rmsError, ImageKeywordlist& otb_kwl) -{ - // TODO: for now, this is a simple transfer of what was done in the - // GCPsToRPCSensorModelImageFilter. We might find some way to improve that. - - // The vector where geo and sensor points are stored - std::vector<ossimDpt> sensorPoints; - std::vector<ossimGpt> geoPoints; - - // Temporary points variable - ossimDpt sensorPoint; - ossimGpt geoPoint; - - // Retrieve the additional GCPs - GCPsContainerType::const_iterator gcpIt; - for (gcpIt = gcpContainer.begin(); gcpIt != gcpContainer.end(); ++gcpIt) - { - // Fill sensor point - sensorPoint = ossimDpt( internal::ConvertToOSSIMFrame(gcpIt->first[0]), - internal::ConvertToOSSIMFrame(gcpIt->first[1])); - - // Fill geo point (lat, lon, elev) - geoPoint = ossimGpt(gcpIt->second[1], gcpIt->second[0], gcpIt->second[2]); - - // Add the sensor point to the list - sensorPoints.push_back(sensorPoint); - - // Add the geo point to the list - geoPoints.push_back(geoPoint); - } - - // Build the ossim rpc solver - ossimRefPtr<ossimRpcSolver> rpcSolver = new ossimRpcSolver(true, false); - - // Call the solve method - rpcSolver->solveCoefficients(sensorPoints, geoPoints); - - rmsError = rpcSolver->getRmsError(); - - // Retrieve the output RPC projection - ossimRefPtr<ossimRpcModel> rpcModel = dynamic_cast<ossimRpcModel*>(rpcSolver->createRpcModel()->getProjection()); - - // Compute projection - m_RpcProjection = dynamic_cast<ossimRpcProjection*>( - rpcSolver->createRpcProjection()->getProjection()); - - // Add spacings - rpcModel->setMetersPerPixel( m_RpcProjection->getMetersPerPixel() ); - - // Export the sensor model in an ossimKeywordlist - ossimKeywordlist geom_kwl; - rpcModel->saveState(geom_kwl); - - ossimKeywordlist kwl; - m_RpcProjection->saveState(kwl); - - // Build an otb::ImageKeywordList - otb_kwl.SetKeywordlist(geom_kwl); -} - - -void -RPCProjectionAdapter -::AddGroundRect( ImageKeywordlist& otb_kwl, - itk::Point<double, 2> orig, itk::Size<2> size) -{ - ossimGpt ul, ll, ur, lr; - // Upper left - ossimDpt imagePoint( internal::ConvertToOSSIMFrame(orig[0]), - internal::ConvertToOSSIMFrame(orig[1])); - m_RpcProjection->lineSampleToWorld(imagePoint, ul); - // Upper right - imagePoint.x += static_cast<double>(size[0]) - 1.0; - m_RpcProjection->lineSampleToWorld(imagePoint, ur); - // Lower right - imagePoint.y += static_cast<double>(size[0]) - 1.0; - m_RpcProjection->lineSampleToWorld(imagePoint, lr); - // Lower left - imagePoint.x += - static_cast<double>(size[0]) + 1.0; - m_RpcProjection->lineSampleToWorld(imagePoint, ll); - - - ossimKeywordlist geom_kwl; - otb_kwl.convertToOSSIMKeywordlist(geom_kwl); - - ossimRefPtr<ossimRpcModel> rpcModel = new ossimRpcModel; - rpcModel->loadState( geom_kwl ); - rpcModel->setGroundRect(ul, ur, lr, ll); - rpcModel->saveState(geom_kwl); - otb_kwl.SetKeywordlist(geom_kwl); -} - - -} // namespace otb diff --git a/Modules/Core/Common/include/otbDecimateImageFilter.txx b/Modules/Core/Common/include/otbDecimateImageFilter.txx index 554c2c6a900fa9d3d5bba9e22d671425a7921d56..cfe08abf4ec68f40576326d962fa572511d6d7ef 100644 --- a/Modules/Core/Common/include/otbDecimateImageFilter.txx +++ b/Modules/Core/Common/include/otbDecimateImageFilter.txx @@ -113,7 +113,7 @@ template <class TInputImage, class TOutputImage> void DecimateImageFilter<TInputImage, TOutputImage> ::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) + itk::ThreadIdType itkNotUsed(threadId)) { InputImageRegionType inputRegionForThread; this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread); diff --git a/Modules/Core/Common/include/otbDotProductImageFilter.h b/Modules/Core/Common/include/otbDotProductImageFilter.h index ac78b385a93e59c4c484d4f9e5eeb501e6fc2095..34effe45e5c1105f3c29e8c2bf2ebef5aceb23af 100644 --- a/Modules/Core/Common/include/otbDotProductImageFilter.h +++ b/Modules/Core/Common/include/otbDotProductImageFilter.h @@ -43,7 +43,7 @@ public: DotProductFunctor() {} virtual ~DotProductFunctor() {} - bool operator !=(const DotProductFunctor& other) const + bool operator !=(const DotProductFunctor& itkNotUsed(other)) const { return false; } diff --git a/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h b/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h index e4145bea2486a9a68b93f7260b6180df75cc2a89..33c81ef6a8981a5428758032bf8c758cfa796402 100644 --- a/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h +++ b/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h @@ -69,7 +69,7 @@ public: virtual void ConnectToDB(){} - virtual void PerformTransaction(const TransactorType& theTransaction) const {} + virtual void PerformTransaction(const TransactorType& itkNotUsed(theTransaction)) const {} protected: /** Constructor */ diff --git a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h deleted file mode 100644 index aeafe075f4f6b873b9bcfde999ad215fc871d059..0000000000000000000000000000000000000000 --- a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h +++ /dev/null @@ -1,164 +0,0 @@ -/*========================================================================= - - 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 __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_h -#define __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_h - -#include "vcl_deprecated_header.h" - -#include "itkHistogram.h" -#include "itkMacro.h" - -namespace otb { - -/** \class GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator - * \brief This class computes texture feature coefficients from a grey level - * co-occurrence matrix. - * - * This class computes features that summarize image texture, given a grey level - * co-occurrence matrix (generated by a ScalarImageToGreyLevelCooccurrenceMatrixGenerator - * or related class). - * - * The features calculated are as follows (where \f$ g(i, j) \f$ is the element in - * cell i, j of a a normalized GLCM): - * - * "Mean" \f$ = \sum_{i, j}i g(i, j) \f$ - * - * "Sum of squares: Variance" \f$ = f_4 = \sum_{i, j}(i - \mu)^2 g(i, j) \f$ - * - * "Sum average" \f$ = f_6 = -\sum_{i}i g_{x+y}(i) - * - * "Sum Variance" \f$ = f_7 = \sum_{i}(i - f_8)^2 g_{x+y}(i) \f$ - * - * "Sum Entropy" \f$= f_8 = -\sum_{i}g_{x+y}(i) log (g_{x+y}(i)) \f$ - * - * "Difference variance" \f$ = f_10 = variance of g_{x-y}(i) - * - * "Difference entropy" \f$ = f_11 = -\sum_{i}g_{x-y}(i) log (g_{x-y}(i)) \f$ - * - * "Information Measures of Correlation IC1" \f$ = f_12 = \frac{f_9 - HXY1}{H} \f$ - * - * "Information Measures of Correlation IC2" \f$ = f_13 = \sqrt{1 - \exp{-2}|HXY2 - f_9|} \f$ - * - * Above, \f$ \mu = \f$ (weighted pixel average) \f$ = \sum_{i, j}i \cdot g(i, j) = - * \sum_{i, j}j \cdot g(i, j) \f$ (due to matrix summetry), and - * - * \f$ \g_{x+y}(k) = \sum_{i}\sum_{j}g(i)\f$ where \f$ i+j=k \f$ and \f$ k = 2, 3, .., 2N_[g} \f$ and - * - * \f$ \g_{x-y}(k) = \sum_{i}\sum_{j}g(i)\f$ where \f$ i-j=k \f$ and \f$ k = 0, 1, .., N_[g}-1 \f$ - * - * NOTA BENE: The input histogram will be forcably normalized! - * This algorithm takes three passes through the input - * histogram if the histogram was already normalized, and four if not. - * - * Web references: - * - * http://www.cssip.uq.edu.au/meastex/www/algs/algs/algs.html - * http://www.ucalgary.ca/~mhallbey/texture/texture_tutorial.html - * - * Print references: - * - * Haralick, R.M., K. Shanmugam and I. Dinstein. 1973. Textural Features for - * Image Classification. IEEE Transactions on Systems, Man and Cybernetics. - * SMC-3(6):610-620. - * - * Haralick, R.M. 1979. Statistical and Structural Approaches to Texture. - * Proceedings of the IEEE, 67:786-804. - * - * R.W. Conners and C.A. Harlow. A Theoretical Comaprison of Texture Algorithms. - * IEEE Transactions on Pattern Analysis and Machine Intelligence, 2:204-222, 1980. - * - * R.W. Conners, M.M. Trivedi, and C.A. Harlow. Segmentation of a High-Resolution - * Urban Scene using Texture Operators. Computer Vision, Graphics and Image - * Processing, 25:273-310, 1984. - * - * \sa ScalarImageToGreyLevelCooccurrenceMatrixGenerator - * \sa GreyLevelCooccurrenceMatrixTextureCoefficientsCalculator - * \sa ScalarImageTextureCalculator - * - * - * \ingroup OTBTextures - */ - -template <typename THistogram> -class ITK_EXPORT GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator : - public itk::Object -{ -public: - /** Standard typedefs */ - typedef GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Run-time type information (and related methods). */ - itkTypeMacro(GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator, itk::Object); - - /** standard New() method support */ - itkNewMacro(Self); - - typedef THistogram HistogramType; - typedef typename HistogramType::Pointer HistogramPointer; - typedef typename HistogramType::ConstPointer HistogramConstPointer; - typedef typename HistogramType::MeasurementType MeasurementType; - typedef typename HistogramType::RelativeFrequencyType RelativeFrequencyType; - typedef typename HistogramType::MeasurementVectorType MeasurementVectorType; - typedef typename HistogramType::IndexType IndexType; - typedef typename HistogramType::AbsoluteFrequencyType FrequencyType; //FIXME several type in the new stat framework - - /** Connects the GLCM histogram over which the features are going to be computed */ - itkSetObjectMacro(Histogram, HistogramType); - itkGetObjectMacro(Histogram, HistogramType); - - itkGetMacro(Mean, double); - itkGetMacro(Variance, double); - itkGetMacro(SumAverage, double); - itkGetMacro(SumVariance, double); - itkGetMacro(SumEntropy, double); - itkGetMacro(DifferenceEntropy, double); - itkGetMacro(DifferenceVariance, double); - itkGetMacro(IC1, double); - itkGetMacro(IC2, double); - - /** Triggers the Computation of the histogram */ - void Compute(void); - -protected: - GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator() {}; - virtual ~GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented - - HistogramPointer m_Histogram; - - void ComputeMean(); - double m_Mean, m_Variance, m_SumAverage, m_SumVariance, m_SumEntropy, m_DifferenceEntropy, - m_DifferenceVariance, m_IC1, m_IC2; - - double ComputePS(long unsigned int k); - double ComputePD(long unsigned int k); -}; -} // end of namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx" -#endif - -#endif diff --git a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx deleted file mode 100644 index 823d848bb1a433a694264f9dc288b20b7c701291..0000000000000000000000000000000000000000 --- a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx +++ /dev/null @@ -1,196 +0,0 @@ -/*========================================================================= - - 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 __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_txx -#define __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_txx - -#include "itkNumericTraits.h" -#include "vnl/vnl_math.h" -#include <algorithm> - -namespace otb { - -template<class THistogram> -void -GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>:: -ComputeMean() -{ - // Initialize everything - m_Mean = 0.; - - // Ok, now do the first pass through the histogram to get the marginal sums - // and compute the pixel mean - typename HistogramType::Iterator itr = m_Histogram->Begin(); - typename HistogramType::Iterator end = m_Histogram->End(); - while( itr != end ) - { - RelativeFrequencyType frequency = static_cast<RelativeFrequencyType>(itr.GetFrequency()) / - static_cast<RelativeFrequencyType>(m_Histogram->GetTotalFrequency()); - - IndexType index = m_Histogram->GetIndex(itr.GetInstanceIdentifier()); - m_Mean += static_cast<double>(index[0]) * static_cast<double>(frequency); - ++itr; - } -} - -template<class THistogram> -void -GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>:: -Compute() -{ - typedef typename HistogramType::Iterator HistogramIterator; - - // Now get the pixel mean. - this->ComputeMean(); - - m_SumAverage = 0; - m_SumEntropy = 0; - m_SumVariance = 0; - double PSSquareCumul = 0; - double log2 = vcl_log(2.); - - // First pass to compute SumAverage, SumVariance - for (long unsigned int i = 0; i < m_Histogram->GetSize()[0] + m_Histogram->GetSize()[1]; ++i) - { - double psTmp = ComputePS (i); - - m_SumAverage += i * psTmp; - m_SumEntropy -= (psTmp > 0.0001) ? psTmp * vcl_log(psTmp) / log2 : 0; - PSSquareCumul += i * i * psTmp; - } - m_SumVariance = PSSquareCumul - m_SumAverage * m_SumAverage; - - double minSizeHist = std::min (m_Histogram->GetSize()[0], m_Histogram->GetSize()[1]); - - m_DifferenceEntropy = 0; - m_DifferenceVariance = 0; - - double PDSquareCumul = 0; - double PDCumul = 0; - - // Second pass to compute DifferenceVariance and DifferenceEntropy - for (long unsigned int i = 0; i < minSizeHist; ++i) - { - double pdTmp = ComputePD (i); - - PDCumul += i * pdTmp; - m_DifferenceEntropy -= (pdTmp > 0.0001) ? pdTmp * vcl_log(pdTmp) / log2 : 0; - PDSquareCumul += i * i * pdTmp; - } - m_DifferenceVariance = PDSquareCumul - PDCumul * PDCumul; - - typedef typename HistogramType::Iterator HistogramIterator; - - double hx = 0; - double hy = 0; - - // Compute hx and hy need to compute f12 and f13 texture coefficients - for (long unsigned int i = 0; i < m_Histogram->GetSize()[0]; ++i) - { - double marginalfreq = static_cast<double>(m_Histogram->GetFrequency (i, 0))/static_cast<double>(m_Histogram->GetTotalFrequency()); - hx += (marginalfreq > 0.0001) ? vcl_log (marginalfreq) * marginalfreq : 0; - } - - for (long unsigned int j = 0; j < m_Histogram->GetSize()[1]; ++j) - { - double marginalfreq = static_cast<double>(m_Histogram->GetFrequency (j, 1))/static_cast<double>(m_Histogram->GetTotalFrequency()); - hy += (marginalfreq > 0.0001) ? vcl_log (marginalfreq) * marginalfreq : 0; - } - - double hxy1 = 0; - double hxy2 = 0; - - m_Variance = 0; - double Entropy = 0; - - // Third pass over the histogram to compute Sum of squares (variance), entropy (needed for f12) - for (HistogramIterator hit = m_Histogram->Begin(); - hit != m_Histogram->End(); ++hit) - { - double frequency = static_cast<double>(hit.GetFrequency()) - / static_cast<double>(m_Histogram->GetTotalFrequency()); - - IndexType index = m_Histogram->GetIndex(hit.GetInstanceIdentifier()); - - m_Variance += ((static_cast<double>(index[0]) - m_Mean) * (static_cast<double>(index[0]) - m_Mean)) * frequency; - Entropy -= (frequency > 0.0001) ? frequency * vcl_log(frequency) / log2 : 0.; - - double pipj = - static_cast<double>(m_Histogram->GetFrequency (index[0], 0))/ static_cast<double>(m_Histogram->GetTotalFrequency()) - * static_cast<double>(m_Histogram->GetFrequency (index[1], 1))/ static_cast<double>(m_Histogram->GetTotalFrequency()); - - hxy1 -= (pipj > 0.0001) ? frequency * vcl_log(pipj) : 0.; - hxy2 -= (pipj > 0.0001) ? pipj * vcl_log(pipj) : 0.; - } - - //Finally get f12 and f13 - m_IC1 = (vcl_abs(std::max (hx, hy)) > 0.0001) ? (Entropy - hxy1) / (std::max (hx, hy)) : 0; - - m_IC2 = 1 - vcl_exp (-2. * vcl_abs (hxy2 - Entropy)); - m_IC2 = (m_IC2 >= 0) ? vcl_sqrt (m_IC2) : 0; -} - -//TODO check this!! -template<class THistogram> -double -GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>:: -ComputePS(long unsigned int k) -{ - double result = 0; - IndexType index(m_Histogram->GetMeasurementVectorSize()); - long unsigned int start = std::max (static_cast <long unsigned int> (0), k - m_Histogram->GetSize()[1]); - long unsigned int end = std::min (k, m_Histogram->GetSize()[0]); - for (long unsigned int i = start; i < end; ++i) - { - index[0] = i; - index[1] = k - i; - result += static_cast<double>(m_Histogram->GetFrequency (index)) - /static_cast<double>(m_Histogram->GetTotalFrequency()); - } - return result; -} - -//TODO check this!! -template<class THistogram> -double -GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>:: -ComputePD(long unsigned int k) -{ - double result = 0; - IndexType index(m_Histogram->GetMeasurementVectorSize()); - long unsigned int end = std::min (m_Histogram->GetSize()[0] - k, m_Histogram->GetSize()[1]); - for (long unsigned int j = 0; j < end; ++j) - { - index[0] = j + k; - index[1] = j; - result += static_cast<double>(m_Histogram->GetFrequency (index)) - /static_cast<double>(m_Histogram->GetTotalFrequency()); - } - return result; -} - -template<class THistogram> -void -GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>:: -PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - -} // end of namespace otb - -#endif diff --git a/Modules/Feature/Textures/test/CMakeLists.txt b/Modules/Feature/Textures/test/CMakeLists.txt index 781e300db646bf8fb293bc93a43857b0c8636874..547be6eb0a3174da6ec575eccb69714a1a558f36 100644 --- a/Modules/Feature/Textures/test/CMakeLists.txt +++ b/Modules/Feature/Textures/test/CMakeLists.txt @@ -2,7 +2,6 @@ otb_module_test() set(OTBTexturesTests otbTexturesTestDriver.cxx -#otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx otbScalarImageToHigherOrderTexturesFilter.cxx otbHaralickTexturesImageFunction.cxx otbGreyLevelCooccurrenceIndexedList.cxx @@ -15,19 +14,12 @@ otbScalarImageToAdvancedTexturesFilterNew.cxx otbGreyLevelCooccurrenceIndexedListNew.cxx otbScalarImageToAdvancedTexturesFilter.cxx otbScalarImageToPanTexTextureFilter.cxx -#otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx ) add_executable(otbTexturesTestDriver ${OTBTexturesTests}) target_link_libraries(otbTexturesTestDriver ${OTBTextures-Test_LIBRARIES}) otb_module_target_label(otbTexturesTestDriver) -# Tests Declaration - -# otb_add_test(NAME feTuotbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator COMMAND otbTexturesTestDriver -# otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator -# ) - otb_add_test(NAME feTuScalarImageToHigherOrderTexturesFilterNew COMMAND otbTexturesTestDriver otbScalarImageToHigherOrderTexturesFilterNew ) @@ -158,7 +150,3 @@ otb_add_test(NAME feTvScalarImageToPanTexTextureFilter COMMAND otbTexturesTestDr ${INPUTDATA}/Mire_Cosinus.png ${TEMP}/feTvScalarImageToPanTexTextureFilterOutput 8 5) - -# otb_add_test(NAME feTuotbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew COMMAND otbTexturesTestDriver -# otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew -# ) diff --git a/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx b/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx deleted file mode 100644 index 1a41476c25821f36ee07f44f5360030ff2ab4ea8..0000000000000000000000000000000000000000 --- a/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx +++ /dev/null @@ -1,196 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#include "vnl/vnl_math.h" - -#include "otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h" - -int otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator(int itkNotUsed(argc), char * itkNotUsed(argv) []) -{ - - try // the rest of the function is in the try block... - - { //Data definitions - const unsigned int HISTOGRAM_AXIS_LEN = 25; - - //------------------------------------------------------ - // Create a simple test histogram. The histogram must be - // symmetric and normalized. - //------------------------------------------------------ - const unsigned int Dimension = 2; - typedef float MeasurementType; - typedef itk::Statistics::Histogram<MeasurementType> HistogramType; - HistogramType::Pointer histogram = HistogramType::New(); - HistogramType::SizeType size(Dimension); - size.Fill(HISTOGRAM_AXIS_LEN); - HistogramType::MeasurementVectorType lowerBound(Dimension); - HistogramType::MeasurementVectorType upperBound(Dimension); - lowerBound[0] = 0; - lowerBound[1] = 0; - upperBound[0] = HISTOGRAM_AXIS_LEN + 1; - upperBound[1] = HISTOGRAM_AXIS_LEN + 1; - histogram->SetMeasurementVectorSize(Dimension); - histogram->Initialize(size, lowerBound, upperBound); - histogram->SetToZero(); - - HistogramType::IndexType index(Dimension); - index[0] = 0; - index[1] = 0; - histogram->SetFrequencyOfIndex(index, 10); - index[0] = 3; - index[1] = 3; - histogram->SetFrequencyOfIndex(index, 50); - index[0] = 2; - index[1] = 1; - histogram->SetFrequencyOfIndex(index, 5); - index[0] = 1; - index[1] = 2; - histogram->SetFrequencyOfIndex(index, 5); - index[0] = 7; - index[1] = 6; - histogram->SetFrequencyOfIndex(index, 10); - index[0] = 6; - index[1] = 7; - histogram->SetFrequencyOfIndex(index, 10); - index[0] = 10; - index[1] = 10; - histogram->SetFrequencyOfIndex(index, 10); - - typedef otb::GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator< - HistogramType> GLCMCalcType; - GLCMCalcType::Pointer glcmCalc = GLCMCalcType::New(); - - glcmCalc->SetHistogram(histogram); - glcmCalc->Compute(); - - double trueVariance = 7.6475; - double trueMean = 3.95; - double trueSumAverage = 0; - double trueSumVariance = 0; - double trueSumEntropy = 0; - double trueDifferenceEntropy = 0.770746; - double trueDifferenceVariance = 0.1275; - double trueIC1 = 0.557305; - double trueIC2 = 0.908663; - - double variance = glcmCalc->GetVariance(); - double mean = glcmCalc->GetMean(); - double sumAverage = glcmCalc->GetSumAverage(); - double sumVariance = glcmCalc->GetSumVariance(); - double sumEntropy = glcmCalc->GetSumEntropy(); - double differenceEntropy = glcmCalc->GetDifferenceEntropy(); - double differenceVariance = glcmCalc->GetDifferenceVariance(); - double ic1 = glcmCalc->GetIC1(); - double ic2 = glcmCalc->GetIC2(); - - bool passed = true; - - if (vnl_math_abs(variance - trueVariance) > 0.001) - { - std::cerr << "Error:" << std::endl; - std::cerr << "Variance calculated wrong. Expected: " << trueVariance << ", got: " - << variance << std::endl; - passed = false; - } - - if (vnl_math_abs(mean - trueMean) > 0.001) - { - std::cerr << "Error:" << std::endl; - std::cerr << "Mean calculated wrong. Expected: " << trueMean << ", got: " - << mean << std::endl; - passed = false; - } - - if (vnl_math_abs(sumAverage - trueSumAverage) > 0.001) - { - std::cerr << "Error:" << std::endl; - std::cerr << "Sum average calculated wrong. Expected: " << trueSumAverage << ", got: " - << sumAverage << std::endl; - passed = false; - } - - if (vnl_math_abs(sumVariance - trueSumVariance) > 0.001) - { - std::cerr << "Error:" << std::endl; - std::cerr << "Sum variance calculated wrong. Expected: " << trueSumVariance << - ", got: " << sumVariance << std::endl; - passed = false; - } - - if (vnl_math_abs(sumEntropy - trueSumEntropy) > 0.001) - { - std::cerr << "Error:" << std::endl; - std::cerr << "Sum entropy calculated wrong. Expected: " << - trueSumEntropy << ", got: " << sumEntropy << std::endl; - passed = false; - } - - if (vnl_math_abs(differenceEntropy - trueDifferenceEntropy) > 0.001) - { - std::cerr << "Error:" << std::endl; - std::cerr << "Difference entropy calculated wrong. Expected: " << trueDifferenceEntropy << ", got: " - << differenceEntropy << std::endl; - passed = false; - } - - if (vnl_math_abs(differenceVariance - trueDifferenceVariance) > 0.001) - { - std::cerr << "Error:" << std::endl; - std::cerr << "Difference variance calculated wrong. Expected: " << trueDifferenceVariance << - ", got: " << differenceVariance << std::endl; - passed = false; - } - - if (vnl_math_abs(ic1 - trueIC1) > 0.001) - { - std::cerr << "Error:" << std::endl; - std::cerr << "IC1 calculated wrong. Expected: " - << trueIC1 << ", got: " << ic1 << std::endl; - passed = false; - } - - if (vnl_math_abs(ic2 - trueIC2) > 0.001) - { - std::cerr << "Error:" << std::endl; - std::cerr << "IC2 calculated wrong. Expected: " - << trueIC2 << ", got: " << ic2 << std::endl; - passed = false; - } - - if (!passed) - { - std::cerr << "Test failed" << std::endl; - return EXIT_FAILURE; - } - else - { - std::cerr << "Test succeeded" << std::endl; - return EXIT_SUCCESS; - } - - } - catch (itk::ExceptionObject& err) - { - std::cerr << "ExceptionObject caught !" << std::endl; - std::cerr << err << std::endl; - std::cerr << "Test failed" << std::endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} diff --git a/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx b/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx deleted file mode 100644 index 6ce2347643fa614b5d03b51f7839d308070f533e..0000000000000000000000000000000000000000 --- a/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#include "otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h" - -int otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) -{ - typedef float MeasurementType; - typedef itk::Statistics::Histogram<MeasurementType> HistogramType; - typedef otb::GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator< - HistogramType> FilterType; - - FilterType::Pointer filter = FilterType::New(); - - std::cout << filter << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Modules/Feature/Textures/test/otbTexturesTestDriver.cxx b/Modules/Feature/Textures/test/otbTexturesTestDriver.cxx index dd28c743d1f6a854012770d42a90fc8f898eeaf7..a6d716360222df687511490779e57708f68bd8b8 100644 --- a/Modules/Feature/Textures/test/otbTexturesTestDriver.cxx +++ b/Modules/Feature/Textures/test/otbTexturesTestDriver.cxx @@ -1,7 +1,6 @@ #include "otbTestMain.h" void RegisterTests() { -/*DEPRECATED REGISTER_TEST(otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator); */ REGISTER_TEST(otbScalarImageToHigherOrderTexturesFilterNew); REGISTER_TEST(otbScalarImageToHigherOrderTexturesFilter); REGISTER_TEST(otbHaralickTexturesImageFunctionNew); @@ -16,5 +15,4 @@ void RegisterTests() REGISTER_TEST(otbGreyLevelCooccurrenceIndexedListNew); REGISTER_TEST(otbScalarImageToAdvancedTexturesFilter); REGISTER_TEST(otbScalarImageToPanTexTextureFilter); -/*DEPRECATED REGISTER_TEST(otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew); */ } diff --git a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h index 1c205000babf75ece3361b59632365486b7e11ce..a4866f222cdb4ca64c80bf8286bba85467245de8 100644 --- a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h @@ -55,7 +55,7 @@ public: m_ScalarValue = p; } - bool operator !=(const ConcatenateScalarValueFunctor& other) const + bool operator !=(const ConcatenateScalarValueFunctor& itkNotUsed(other)) const { return false; } diff --git a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h index d9fcbddb9370ea4b996c7fe00b9327f11faef904..eb8a373b9f26ee8afaeaf442701d1b7a62658ae1 100644 --- a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h +++ b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h @@ -86,7 +86,7 @@ public: virtual OutputType Evaluate( const DataNodeType& node ) const; - std::string GetExpression(std::string expression) const + std::string GetExpression() const { return m_ParserConditionFunctor->GetExpression(); } diff --git a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h index d022c8adedeecfb93ffb9f28a3d94aa66b32d31d..feaa3e60afe56849d7cdcdbcda07160798500c0d 100644 --- a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h +++ b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h @@ -60,7 +60,7 @@ public: m_OutputSize = m_ProjectionDirection.Size(); } - bool operator !=(const ProjectiveProjectionFunctor& other) const + bool operator !=(const ProjectiveProjectionFunctor& itkNotUsed(other)) const { return false; } diff --git a/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx b/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx index 9de9df6d6520844cf78db9a6a217897dcf8382e6..a70046adc7aac287129532d65c873113f170f642 100644 --- a/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx +++ b/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx @@ -45,7 +45,7 @@ WaveletGenerator<TMotherWaveletOperator> template <Wavelet::Wavelet TMotherWaveletOperator> void WaveletGenerator<TMotherWaveletOperator> -::GetLowPassCoefficientVector(CoefficientVector& coeff) const +::GetLowPassCoefficientVector(CoefficientVector& itkNotUsed(coeff)) const { std::ostringstream msg; msg << "The mother wavelet ID " << TMotherWaveletOperator; @@ -56,7 +56,7 @@ WaveletGenerator<TMotherWaveletOperator> template <Wavelet::Wavelet TMotherWaveletOperator> void WaveletGenerator<TMotherWaveletOperator> -::GetHighPassCoefficientVector(CoefficientVector& coeff) const +::GetHighPassCoefficientVector(CoefficientVector& itkNotUsed(coeff)) const { std::ostringstream msg; msg << "The mother wavelet ID " << TMotherWaveletOperator; diff --git a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx index 4b1bb48a1cb172578263af6d454c24bac1d4cbbd..a8e71af5ccf32605cbeeaa63551adc5d6c8c5ffc 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx +++ b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx @@ -52,7 +52,7 @@ ISRAUnmixingFunctor<TInput, TOutput, TPrecision> template <class TInput, class TOutput, class TPrecision> bool ISRAUnmixingFunctor<TInput, TOutput, TPrecision> -::operator != (const Self& other) const +::operator != (const Self& itkNotUsed(other)) const { return true; } @@ -60,7 +60,7 @@ ISRAUnmixingFunctor<TInput, TOutput, TPrecision> template <class TInput, class TOutput, class TPrecision> bool ISRAUnmixingFunctor<TInput, TOutput, TPrecision> -::operator == (const Self& other) const +::operator == (const Self& itkNotUsed(other)) const { return false; } diff --git a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx index 719e33826844945f77565d3c003691c82d4cd3f4..7c7a2019147d69201dcef01f5b3811c7ad71b3cb 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx +++ b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx @@ -52,7 +52,7 @@ NCLSUnmixingFunctor<TInput, TOutput, TPrecision> template <class TInput, class TOutput, class TPrecision> bool NCLSUnmixingFunctor<TInput, TOutput, TPrecision> -::operator != (const Self& other) const +::operator != (const Self& itkNotUsed(other)) const { return true; } @@ -60,7 +60,7 @@ NCLSUnmixingFunctor<TInput, TOutput, TPrecision> template <class TInput, class TOutput, class TPrecision> bool NCLSUnmixingFunctor<TInput, TOutput, TPrecision> -::operator == (const Self& other) const +::operator == (const Self& itkNotUsed(other)) const { return false; } diff --git a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h index 74c678e4b109c8931078f61690714c38df1f0a66..4a869df0037c44de2f401e989f74fd42157ac63a 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h @@ -54,7 +54,7 @@ public: return m_OutputSize; } - bool operator != (const UnConstrainedLeastSquareFunctor& other) const + bool operator != (const UnConstrainedLeastSquareFunctor& itkNotUsed(other)) const { return true; } diff --git a/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx b/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx index a12b633ba84ba886c32a89bc4aac6a5d43c12db1..7ac218c33b3dde7341661cb4ff75d4323d138a08 100644 --- a/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx +++ b/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx @@ -704,26 +704,26 @@ void MSTARImageIO::PrintSelf(std::ostream& os, itk::Indent indent) const float MSTARImageIO::byteswap_SR_IR(unsigned char *pointer) { float * temp; - unsigned char iarray[4], *charptr; - + unsigned char iarray[4]; + void *vptr; iarray[0] = *(pointer + 3); iarray[1] = *(pointer + 2); iarray[2] = *(pointer + 1); iarray[3] = *(pointer); - charptr = iarray; - temp = (float *) charptr; + vptr = static_cast<void*>(iarray); + temp = static_cast<float*>(vptr); return *(temp); } unsigned short MSTARImageIO::byteswap_SUS_IUS(unsigned char *pointer) { unsigned short *temp; - unsigned char iarray[2], *charptr; - + unsigned char iarray[2]; + void *vptr; iarray[0] = *(pointer + 1); iarray[1] = *(pointer); - charptr = iarray; - temp = (unsigned short *) charptr; + vptr = static_cast<void*>(iarray); + temp = static_cast<unsigned short*>(vptr); return *(temp); } diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h index 75089a2e311d97b571d3344acb7c5b69b8d8ba1e..75bee26c6fc5304dd562c76224c136c3a76ad1b4 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h @@ -110,7 +110,7 @@ protected: /** TestBandSelection * Tests the coherency of the Meta File (especifically band selection) with the image types */ - virtual void TestBandSelection(std::vector<unsigned int>& bands) {} + virtual void TestBandSelection(std::vector<unsigned int>& itkNotUsed(bands)) {} /** GenerateData * This method will be specialised if template definitions follow: diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx index 51ad2f02f9ced9ef74f23316fdf339806cd89b78..0bafea5e66ea865e0479e0cad576cdf0fe9c246b 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx @@ -47,7 +47,7 @@ ImageSeriesFileReader<TImage, TInternalImage> template <class TImage, class TInternalImage> void ImageSeriesFileReader<TImage, TInternalImage> -::GenerateData(DataObjectPointerArraySizeType idx) +::GenerateData(DataObjectPointerArraySizeType itkNotUsed(idx)) { std::ostringstream msg; msg << "Something wrong... Check the template definition of this class in the program...\n"; diff --git a/Modules/IO/ImageIO/include/otbStreamingImageFileWriter.h b/Modules/IO/ImageIO/include/otbStreamingImageFileWriter.h deleted file mode 100644 index b4845fbcc8312a62e082776927f4f018fb041877..0000000000000000000000000000000000000000 --- a/Modules/IO/ImageIO/include/otbStreamingImageFileWriter.h +++ /dev/null @@ -1,72 +0,0 @@ -/*========================================================================= - - 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 __otbStreamingImageFileWriter_h -#define __otbStreamingImageFileWriter_h - -#include "vcl_deprecated_header.h" - -#include "otbImageFileWriter.h" - -namespace otb -{ -/** \class StreamingImageFileWriter - * \brief Deprecated streaming-enabled image writing class - * - * StreamingImageFileWriter is deprecated and provided for backward - * compatibility only. Full support of streaming is now provided by - * otb::ImageFileWriter, and StreamingImageFileWriter is a simple - * alias of this class. - * - * \sa ImageFileWriter - * - * \ingroup OTBImageIO - */ -template <class TInputImage> class ITK_EXPORT StreamingImageFileWriter : public ImageFileWriter<TInputImage> -{ -public: - /** Standard class typedefs. */ - typedef StreamingImageFileWriter Self; - typedef ImageFileWriter<TInputImage> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(ImageFileWriter, itk::ImageFileWriter); - - /** Dimension of input image. */ - itkStaticConstMacro(InputImageDimension, unsigned int, - Superclass::InputImageDimension); - -protected: - /** Constructor */ - StreamingImageFileWriter(){} - - /** Destructor */ - virtual ~StreamingImageFileWriter(){} - -private: - StreamingImageFileWriter(const StreamingImageFileWriter &); //purposely not implemented - void operator =(const StreamingImageFileWriter&); //purposely not implemented -}; - -} // end namespace otb - -#endif diff --git a/Modules/IO/ImageIO/test/CMakeLists.txt b/Modules/IO/ImageIO/test/CMakeLists.txt index 8472de5c16849f155afc8a91f040c0eae386490d..ecd67c8605231fdf79bf3c944e1b990f812afb4f 100644 --- a/Modules/IO/ImageIO/test/CMakeLists.txt +++ b/Modules/IO/ImageIO/test/CMakeLists.txt @@ -255,7 +255,6 @@ otb_add_test(NAME ioTvStreamingIFWriterLUMWithoutStreaming COMMAND otbImageIOTes otbStreamingImageFileWriterTest ${TEMP}/ioImageFileReaderPNG2LUM.lum ${TEMP}/ioStreamingImageFileWriterLUM2LUMWithoutStreaming.lum - 0 # StreamingImageFileWriter 0 # NumberOfStreamDivisions ) set_property(TEST ioTvStreamingIFWriterLUMWithoutStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2LUM) @@ -266,7 +265,6 @@ otb_add_test(NAME ioTvStreamingIFWriterBSQWithoutStreaming COMMAND otbImageIOTes otbStreamingImageFileWriterTest ${INPUTDATA}/poupees_1canal.c1.hdr ${TEMP}/ioStreamingImageFileWriterBSQWithoutStreaming.hdr - 0 # Streaming 0 ) set_property(TEST ioTvStreamingIFWriterBSQWithoutStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2BSQ) @@ -277,7 +275,6 @@ otb_add_test(NAME ioTvStreamingWithIFWriterLUMWithStreaming COMMAND otbImageIOTe otbStreamingImageFileWriterTest ${TEMP}/ioImageFileReaderPNG2LUM.lum ${TEMP}/ioStreamingWithImageFileWriterLUM2LUMWithStreaming_10.lum - 0 # StreamingImageFileWriter 10 # NumberOfStreamDivisions ) set_property(TEST ioTvStreamingWithIFWriterLUMWithStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2LUM) @@ -288,7 +285,6 @@ otb_add_test(NAME ioTvStreamingWithIFWriterBSQWithStreaming COMMAND otbImageIOTe otbStreamingImageFileWriterTest ${TEMP}/ioImageFileReaderPNG2BSQ.hd ${TEMP}/ioStreamingWithImageFileWriterBSQ2BSQWithStreaming_10.hd - 0 # StreamingImageFileWriter 10 # NumberOfStreamDivisions ) set_property(TEST ioTvStreamingWithIFWriterBSQWithStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2BSQ) @@ -299,7 +295,6 @@ otb_add_test(NAME ioTvStreamingIFWriterBSQWithStreaming COMMAND otbImageIOTestDr otbStreamingImageFileWriterTest ${INPUTDATA}/poupees_1canal.c1.hdr ${TEMP}/ioStreamingImageFileWriterBSQWithStreaming_100.hdr - 1 # Streaming 100 ) set_property(TEST ioTvStreamingIFWriterBSQWithStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2BSQ) @@ -310,7 +305,6 @@ otb_add_test(NAME ioTvStreamingIFWriterLUMWithStreaming COMMAND otbImageIOTestDr otbStreamingImageFileWriterTest ${TEMP}/ioImageFileReaderPNG2LUM.lum ${TEMP}/ioStreamingImageFileWriterLUM2LUMWithStreaming_10.lum - 1 # StreamingImageFileWriter 10 # NumberOfStreamDivisions ) set_property(TEST ioTvStreamingIFWriterLUMWithStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2LUM) @@ -322,7 +316,7 @@ otb_add_test(NAME ioTvReadingComplexDataIntoComplexImage COMMAND otbImageIOTestD ) otb_add_test(NAME ioTvStreamingImageFilterBSQ2PNG COMMAND otbImageIOTestDriver - --compare-image ${EPSILON_9} + --compare-image ${EPSILON_9} ${TEMP}/ioImageFileReaderPNG2BSQ.hd ${TEMP}/ioStreamingImageFilterTestBSQ.png otbStreamingImageFilterTest @@ -1308,4 +1302,3 @@ otb_add_test(NAME ioTvImageFileReaderPNG2ENVI COMMAND otbImageIOTestDriver ${INPUTDATA}/cthead1.png ${TEMP}/ioImageFileReaderPNG2ENVI.hdr ) set_tests_properties(ioTvImageFileReaderPNG2ENVI PROPERTIES DEPENDS ioTvImageFileReaderPNG2BSQ) - diff --git a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx index bc95c3855cf41b27f0cb3dffdec9ddb29f9fc720..21b2b1038211b3666197ed15d67564deb9844db8 100644 --- a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx +++ b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx @@ -24,7 +24,6 @@ void RegisterTests() REGISTER_TEST(otbVectorImageStreamingFileWriterComplexTestWithoutInputFloat); REGISTER_TEST(otbVectorImageStreamingFileWriterComplexTestWithoutInputDouble); REGISTER_TEST(otbReadingComplexDataIntoComplexImageTest); - REGISTER_TEST(otbStreamingImageFileWriterTest); REGISTER_TEST(otbImageFileReaderRADInt); REGISTER_TEST(otbImageFileReaderRGBTest); REGISTER_TEST(otbImageMetadataStreamingFileWriterTest); @@ -83,6 +82,7 @@ void RegisterTests() REGISTER_TEST(otbImageFileReaderRADComplexDouble); REGISTER_TEST(otbPipeline); REGISTER_TEST(otbStreamingImageFilterTest); + REGISTER_TEST(otbStreamingImageFileWriterTest); REGISTER_TEST(otbImageFileWriterRGBTest); REGISTER_TEST(otbMonobandScalarToImageComplexFloat); REGISTER_TEST(otbMonobandScalarToImageComplexDouble); diff --git a/Modules/IO/ImageIO/test/otbStreamingImageFileWriterTest.cxx b/Modules/IO/ImageIO/test/otbStreamingImageFileWriterTest.cxx index 6679dc218b3fcbf67d01fac4aab9ff6b748fcac6..60a76cab364dcfa5cba24f796f89a42f616103a8 100644 --- a/Modules/IO/ImageIO/test/otbStreamingImageFileWriterTest.cxx +++ b/Modules/IO/ImageIO/test/otbStreamingImageFileWriterTest.cxx @@ -24,16 +24,14 @@ #include "otbImage.h" #include "otbImageFileReader.h" -#include "otbStreamingImageFileWriter.h" +#include "otbImageFileWriter.h" int otbStreamingImageFileWriterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - int iStreaming(::atoi(argv[3])); - bool streaming = (bool) (iStreaming); - int NumberOfStreamDivisions(::atoi(argv[4])); + int NumberOfStreamDivisions(::atoi(argv[3])); typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; @@ -43,23 +41,10 @@ int otbStreamingImageFileWriterTest(int itkNotUsed(argc), char* argv[]) typedef otb::Image<OutputPixelType, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::StreamingImageFileWriter<OutputImageType> StreamingWriterType; typedef otb::ImageFileWriter<OutputImageType> WriterType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFilename); - - if (streaming == true) - { - std::cout << "Streaming writing test" << std::endl; - StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName(outputFilename); - writer->SetNumberOfDivisionsStrippedStreaming(NumberOfStreamDivisions); - writer->SetInput(reader->GetOutput()); - writer->Update(); - } - else - { std::cout << "Writing test" << std::endl; WriterType::Pointer writer = WriterType::New(); if (NumberOfStreamDivisions > 1) @@ -72,7 +57,6 @@ int otbStreamingImageFileWriterTest(int itkNotUsed(argc), char* argv[]) writer->SetFileName(outputFilename); writer->SetInput(reader->GetOutput()); writer->Update(); - } return EXIT_SUCCESS; } diff --git a/Modules/Learning/SVMLearning/include/otbSVMModel.txx b/Modules/Learning/SVMLearning/include/otbSVMModel.txx index a527b2eca7656efd37b52ec66e7d39937cb23dd8..d7a59f3b8e891c3e3b1f05696949e130a9254606 100644 --- a/Modules/Learning/SVMLearning/include/otbSVMModel.txx +++ b/Modules/Learning/SVMLearning/include/otbSVMModel.txx @@ -622,7 +622,7 @@ SVMModel<TValue, TLabel>::SetSupportVectors(svm_node ** sv, int nbOfSupportVecto template <class TValue, class TLabel> void -SVMModel<TValue, TLabel>::SetAlpha(double ** alpha, int nbOfSupportVector) +SVMModel<TValue, TLabel>::SetAlpha(double ** alpha, int itkNotUsed(nbOfSupportVector)) { if (!m_Model) { diff --git a/Modules/Learning/Supervised/include/otbMachineLearningUtils.h b/Modules/Learning/Supervised/include/otbMachineLearningUtils.h deleted file mode 100644 index e8278c7616263fe5aa2f98e409fc75a4d6ead172..0000000000000000000000000000000000000000 --- a/Modules/Learning/Supervised/include/otbMachineLearningUtils.h +++ /dev/null @@ -1,35 +0,0 @@ -/*========================================================================= - - 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 __otbMachineLearningUtils_h -#define __otbMachineLearningUtils_h - -#include "otbMachineLearningModel.h" -#include "vcl_deprecated_header.h" - -typedef otb::MachineLearningModel<float,short> MachineLearningModelType; -typedef MachineLearningModelType::InputValueType InputValueType; -typedef MachineLearningModelType::InputSampleType InputSampleType; -typedef MachineLearningModelType::InputListSampleType InputListSampleType; -typedef MachineLearningModelType::TargetValueType TargetValueType; -typedef MachineLearningModelType::TargetSampleType TargetSampleType; -typedef MachineLearningModelType::TargetListSampleType TargetListSampleType; - - -bool ReadDataFile(const char * infname, InputListSampleType * samples, TargetListSampleType * labels); - -#endif diff --git a/Modules/Learning/Supervised/src/CMakeLists.txt b/Modules/Learning/Supervised/src/CMakeLists.txt index bab85f52ac967624f58f55953f756bcffc83fcb0..d5043898fb721e0d6941cb6926d5013005b15be5 100644 --- a/Modules/Learning/Supervised/src/CMakeLists.txt +++ b/Modules/Learning/Supervised/src/CMakeLists.txt @@ -1,11 +1,10 @@ set(OTBSupervised_SRC otbCvRTreesWrapper.cxx otbMachineLearningModelFactoryBase.cxx - otbMachineLearningUtils.cxx ) add_library(OTBSupervised ${OTBSupervised_SRC}) -target_link_libraries(OTBSupervised +target_link_libraries(OTBSupervised ${OTBCommon_LIBRARIES} ${OTBSVMLearning_LIBRARIES} ${OTBOpenCV_LIBRARIES} diff --git a/Modules/Learning/Supervised/src/otbMachineLearningUtils.cxx b/Modules/Learning/Supervised/src/otbMachineLearningUtils.cxx deleted file mode 100644 index 8fb9fa18e4503b73d4057988534fe8d7f141b648..0000000000000000000000000000000000000000 --- a/Modules/Learning/Supervised/src/otbMachineLearningUtils.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - - =========================================================================*/ - -#include "otbMachineLearningUtils.h" - -#include <fstream> -#include <string> -#include <algorithm> - -bool ReadDataFile(const char * infname, InputListSampleType * samples, TargetListSampleType * labels) -{ - std::ifstream ifs; - ifs.open(infname); - - if(!ifs) - { - std::cerr<<"Could not read file "<<infname<<std::endl; - return false; - } - - unsigned int nbfeatures = 0; - - while (!ifs.eof()) - { - std::string line; - std::getline(ifs, line); - - if(nbfeatures == 0) - { - nbfeatures = std::count(line.begin(),line.end(),' ')-1; - std::cout<<"Found "<<nbfeatures<<" features per samples"<<std::endl; - } - - if(line.size()>1) - { - - InputSampleType sample(nbfeatures); - sample.Fill(0); - - std::string::size_type pos = line.find_first_of(" ", 0); - - // Parse label - TargetSampleType label; - label[0] = atoi(line.substr(0, pos).c_str()); - - bool endOfLine = false; - - unsigned int id = 0; - - while(!endOfLine) - { - std::string::size_type nextpos = line.find_first_of(" ", pos+1); - - if(nextpos == std::string::npos) - { - endOfLine = true; - nextpos = line.size()-1; - } - else - { - std::string feature = line.substr(pos,nextpos-pos); - std::string::size_type semicolonpos = feature.find_first_of(":"); - id = atoi(feature.substr(0,semicolonpos).c_str()); - sample[id] = atof(feature.substr(semicolonpos+1,feature.size()-semicolonpos).c_str()); - pos = nextpos; - } - } - samples->SetMeasurementVectorSize(itk::NumericTraits<InputSampleType>::GetLength(sample)); - samples->PushBack(sample); - labels->PushBack(label); - } - } - - std::cout<<"Retrieved "<<samples->Size()<<" samples"<<std::endl; - - ifs.close(); - - return true; -} diff --git a/Modules/Learning/Supervised/test/otbMachineLearningRegressionTests.cxx b/Modules/Learning/Supervised/test/otbMachineLearningRegressionTests.cxx index f54a9a96adc5a60f18f2a2411ff0e078ad5aba6d..b15bb74a0127e8aa8c9d4c039315e29da2328906 100644 --- a/Modules/Learning/Supervised/test/otbMachineLearningRegressionTests.cxx +++ b/Modules/Learning/Supervised/test/otbMachineLearningRegressionTests.cxx @@ -253,7 +253,7 @@ int otbLibSVMRegressionTests(int itkNotUsed(argc), param.vMin = -0.5; param.vMax = 0.5; param.count = 200; - param.eps = 0.1; + param.eps = epsilon; std::cout << "Testing regression on a linear monovariate function" << std::endl; LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0); @@ -328,7 +328,7 @@ int otbNeuralNetworkRegressionTests(int itkNotUsed(argc), param.vMin = -0.5; param.vMax = 0.5; param.count = 20000; - param.eps = 0.1; + param.eps = epsilon; std::cout << "Testing regression on a linear monovariate function" << std::endl; LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0); @@ -392,7 +392,7 @@ int otbSVMRegressionTests(int itkNotUsed(argc), param.vMin = -0.5; param.vMax = 0.5; param.count = 200; - param.eps = 0.1; + param.eps = epsilon; std::cout << "Testing regression on a linear monovariate function" << std::endl; LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0); @@ -449,7 +449,7 @@ int otbDecisionTreeRegressionTests(int itkNotUsed(argc), param.vMin = -0.5; param.vMax = 0.5; param.count = 200; - param.eps = 0.1; + param.eps = epsilon; std::cout << "Testing regression on a linear monovariate function" << std::endl; LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0); @@ -511,7 +511,7 @@ int otbGradientBoostedTreeRegressionTests(int itkNotUsed(argc), param.vMin = -0.5; param.vMax = 0.5; param.count = 200; - param.eps = 0.1; + param.eps = epsilon; std::cout << "Testing regression on a linear monovariate function" << std::endl; LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0); @@ -572,7 +572,7 @@ int otbKNearestNeighborsRegressionTests(int itkNotUsed(argc), param.vMin = -0.5; param.vMax = 0.5; param.count = 200; - param.eps = 0.1; + param.eps = epsilon; std::cout << "Testing regression on a linear monovariate function" << std::endl; LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0); @@ -630,7 +630,7 @@ int otbRandomForestsRegressionTests(int itkNotUsed(argc), param.vMin = -0.5; param.vMax = 0.5; param.count = 200; - param.eps = 0.1; + param.eps = epsilon; std::cout << "Testing regression on a linear monovariate function" << std::endl; LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0); diff --git a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx index 8fd8030db24305299c1cc51d4ebe4504b546519d..7f9cd034e0278a3b221359e84e9d29acd5576cd3 100644 --- a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx +++ b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx @@ -632,7 +632,7 @@ AdhesionCorrectionFilter<TImage, TMask> int l=-2-win; index2[0] = index_pos[0] + i; index2[1] = index_pos[1] + l; - while (old_maskPtr->GetPixel(index2) == 0) + while (old_maskPtr->GetBufferedRegion().IsInside(index2) && old_maskPtr->GetPixel(index2) == 0) { l++; index2[1] = index_pos[1] + l; diff --git a/SuperBuild/CMake/External_package.cmake b/SuperBuild/CMake/External_package.cmake index f424658a858d10e53dd078166312a85c74d68dde..e6aa64f6193633c34d474d33a1f4c4eff0e21bcf 100644 --- a/SuperBuild/CMake/External_package.cmake +++ b/SuperBuild/CMake/External_package.cmake @@ -1,7 +1,24 @@ message(STATUS "Setup OTB Packaging...") -set(PACKAGE_VERSION 5.0.0) #should take from cmake automatically or update with every release? +set(PACKAGE_VERSION) + +if(EXISTS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt") + file(STRINGS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt" _otb_version_vars REGEX "set\\\(OTB_VERSION_") + file(WRITE ${CMAKE_BINARY_DIR}/CMakeFiles/version_vars.cmake "#OTB version\n") + foreach(_otb_version_var ${_otb_version_vars}) + file(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/version_vars.cmake "${_otb_version_var}\n") + endforeach() + include(${CMAKE_BINARY_DIR}/CMakeFiles/version_vars.cmake) + if(OTB_VERSION_STRING) + set(PACKAGE_VERSION ${OTB_VERSION_STRING}) + else() + message(FATAL_ERROR "Packaging: Cannot find OTB_VERSION_STRING!") + endif() +else() + message(FATAL_ERROR "Packaging: File '${CMAKE_SOURCE_DIR}/../CMakeLists.txt' does not exists") +endif() + set(PACKAGE_NAME OTB) set(PACKAGE_LONG_NAME OrfeoToolBox) diff --git a/SuperBuild/patches/TINYXML/CMakeLists.txt b/SuperBuild/patches/TINYXML/CMakeLists.txt index 33c664a4e922c8860103f0e9632d5922effba7fb..8088c079c99d3d3518fb69475309e453c45ffc13 100644 --- a/SuperBuild/patches/TINYXML/CMakeLists.txt +++ b/SuperBuild/patches/TINYXML/CMakeLists.txt @@ -7,18 +7,26 @@ if(MSVC) set(BUILD_SHARED_LIBS OFF) #force off endif() -file(GLOB tinyXMLlib_SRCS "*.cpp") -file(GLOB tinyXMLlib_HDRS "*.h") + +set(tinyXMLlib_SRCS + tinystr.cpp + tinyxml.cpp + tinyxmlerror.cpp + tinyxmlparser.cpp) + +set(tinyXMLlib_HDRS + tinystr.h + tinyxml.h) + add_library(tinyxml ${tinyXMLlib_SRCS}) install(TARGETS tinyxml - RUNTIME DESTINATION bin COMPONENT RuntimeLibraries - LIBRARY DESTINATION lib COMPONENT RuntimeLibraries - ARCHIVE DESTINATION lib COMPONENT Development) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) install(FILES ${tinyXMLlib_HDRS} - DESTINATION include - COMPONENT Development) + DESTINATION include) #set(TINYXML_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})