diff --git a/Code/BasicFilters/otbSimplifyPathFunctor.h b/Code/BasicFilters/otbSimplifyPathFunctor.h new file mode 100644 index 0000000000000000000000000000000000000000..4d3b96bd758a6b517f67fc8d2ed4639b6d7a5bfc --- /dev/null +++ b/Code/BasicFilters/otbSimplifyPathFunctor.h @@ -0,0 +1,119 @@ +/*========================================================================= + +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 __otbSimplifyPathFunctor_h +#define __otbSimplifyPathFunctor_h + +#include "otbMath.h" + +namespace otb +{ + + /** \class SimplifyPathFunctor + * \brief + * + + * \ingroup Functor + */ + template <class TInput, class TOutput> + class SimplifyPathFunctor + { + public: + + typedef typename TInput::ObjectType::VertexListType::ConstIterator VertexListConstIteratorType; + typedef typename TInput::ObjectType::VertexListType::ConstPointer VertexListConstPointerType; + typedef TOutput OutputPathPointerType; + typedef typename OutputPathPointerType::ObjectType OutputPathType; + + void SetTolerance(double Tolerance ) + { + m_Tolerance = Tolerance; + } + double GetTolerance(void)const + { + return ( m_Tolerance ); + } + + SimplifyPathFunctor() + { + m_Tolerance = 1.0; + }; + ~SimplifyPathFunctor() {}; + + inline OutputPathPointerType operator()(const TInput & input) + { + + OutputPathPointerType newPath = OutputPathType::New(); + newPath->Initialize(); + // Getting the verices list of the current input paths + VertexListConstPointerType vertexList = input->GetVertexList(); + VertexListConstIteratorType beginIt = vertexList->Begin(); + VertexListConstIteratorType beforeTheEndIt = --(vertexList->End()); + + // Add the first vertex + newPath->AddVertex(beginIt.Value()); + + while ( beginIt != beforeTheEndIt) + { + VertexListConstIteratorType endIt = beforeTheEndIt; + // while the segment is not consistent, decrement endIt + while (!this->TestPathConsistency(vertexList,beginIt, endIt)) + { + --endIt; + } + // Add the final vertex + newPath->AddVertex(endIt.Value()); + beginIt=endIt; + } + return newPath; + + } + + + + private: + double m_Tolerance; + + bool TestPathConsistency(VertexListConstPointerType vertexList, + VertexListConstIteratorType begin, + VertexListConstIteratorType end) + { + VertexListConstIteratorType segmentIt = begin; + ++segmentIt; + //Compute the distance of a point to a segment based on the cross product + while (segmentIt != end) + { + double crossProduct = (end.Value()[0]-begin.Value()[0])*(segmentIt.Value()[1]-begin.Value()[1]) + - (end.Value()[1]-begin.Value()[1])*(segmentIt.Value()[0]-begin.Value()[0]); + double lenghtSeg = (end.Value()[0]-begin.Value()[0])*(end.Value()[0]-begin.Value()[0]) + +(end.Value()[1]-begin.Value()[1])*(end.Value()[1]-begin.Value()[1]); + if (lenghtSeg == 0) return false; + double distsq = crossProduct*crossProduct/lenghtSeg; + if (distsq > static_cast<double>(m_Tolerance) ) + { + return false; + } + ++segmentIt; + } + return true; + } + + }; + +} + +#endif diff --git a/Code/FeatureExtraction/otbGenericRoadExtractionFilter.h b/Code/FeatureExtraction/otbGenericRoadExtractionFilter.h index 4054ba925bc0a211d7e62d770482438f4a477ee2..5be16d056ead83aa4126e47e671facb59ce72d76 100644 --- a/Code/FeatureExtraction/otbGenericRoadExtractionFilter.h +++ b/Code/FeatureExtraction/otbGenericRoadExtractionFilter.h @@ -142,7 +142,8 @@ template <class TInputImage, class TOutputPath> /** Template parameters typedefs for internals filters */ typedef typename GradientFilterType::RealType SigmaType; typedef typename VectorizationPathListFilterType::InputPixelType AmplitudeThresholdType; - typedef typename SimplifyPathListFilterType::ToleranceType ToleranceType; +// typedef typename SimplifyPathListFilterType::ToleranceType ToleranceType; + typedef double ToleranceType; typedef typename BreakAngularPathListFilterType::MaxAngleType MaxAngleType; // typedef typename RemoveTortuousPathListFilterType::MeanDistanceThresholdType MeanDistanceThresholdType; typedef double MeanDistanceThresholdType; diff --git a/Code/FeatureExtraction/otbGenericRoadExtractionFilter.txx b/Code/FeatureExtraction/otbGenericRoadExtractionFilter.txx index 85e4117291d472743b07e520ad03bb1e7908739e..2d275378f5068aee6803ea3b0559edd2300e89cf 100644 --- a/Code/FeatureExtraction/otbGenericRoadExtractionFilter.txx +++ b/Code/FeatureExtraction/otbGenericRoadExtractionFilter.txx @@ -130,7 +130,7 @@ GenericRoadExtractionFilter<TInputImage, TOutputPath> m_VectorizationPathListFilter->SetAmplitudeThreshold(m_AmplitudeThreshold); m_FirstSimplifyPathListFilter->SetInput(m_VectorizationPathListFilter->GetOutput()); - m_FirstSimplifyPathListFilter->SetTolerance(m_Tolerance); + m_FirstSimplifyPathListFilter->GetFunctor().SetTolerance(m_Tolerance); m_BreakAngularPathListFilter->SetInput(m_FirstSimplifyPathListFilter->GetOutput()); m_BreakAngularPathListFilter->SetMaxAngle(m_MaxAngle); @@ -143,7 +143,7 @@ GenericRoadExtractionFilter<TInputImage, TOutputPath> m_LinkPathListFilter->SetDistanceThreshold( static_cast<LinkRealType>(m_DistanceThreshold/m_Resolution) ); m_SecondSimplifyPathListFilter->SetInput(m_LinkPathListFilter->GetOutput()); - m_SecondSimplifyPathListFilter->SetTolerance(m_Tolerance); + m_SecondSimplifyPathListFilter->GetFunctor().SetTolerance(m_Tolerance); m_SecondRemoveTortuousPathListFilter->SetInput(m_SecondSimplifyPathListFilter->GetOutput()); m_SecondRemoveTortuousPathListFilter->GetFunctor().SetThreshold(m_SecondMeanDistanceThreshold); diff --git a/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.h b/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.h index 8d469836641f54ff23a8010a50805cf41488a49e..feaa3df371c8309d329bdf92eb6568b2d3fe2789 100644 --- a/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.h +++ b/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.h @@ -31,8 +31,7 @@ namespace otb * A path is considered to be tortuous if the mean distance between each consecutive vertices * is strictly lower than the user provided threshold. * - * \sa BreakAngularPathListFilter - * \sa SimplifyPathFilter + * * *<b>Recent API changes:</b> * Now part of the UnaryFunctorObjectListBooleanFilter hierachy, replace call to SetMeanDistanceThreshold() @@ -40,6 +39,10 @@ namespace otb * * The inequality is now a strict one. * + * \sa BreakAngularPathListFilter + * \sa SimplifyPathFilter + * \sa UnaryFunctorObjectListBooleanFilter + * * \example FeatureExtraction/ExtractRoadByStepsExample.cxx * */ diff --git a/Code/FeatureExtraction/otbSimplifyPathListFilter.h b/Code/FeatureExtraction/otbSimplifyPathListFilter.h index 653396badc3ba8fa1c2996ab8bc148ee23454b77..1fe3c5acf2a98f80d487064e5c9ff4c6d148c640 100644 --- a/Code/FeatureExtraction/otbSimplifyPathListFilter.h +++ b/Code/FeatureExtraction/otbSimplifyPathListFilter.h @@ -18,103 +18,53 @@ PURPOSE. See the above copyright notices for more information. #ifndef __otbSimplifyPathListFilter_h #define __otbSimplifyPathListFilter_h -#include "otbPathListToPathListFilter.h" +#include "otbUnaryFunctorObjectListFilter.h" +#include "otbSimplifyPathFunctor.h" namespace otb { /** \class SimplifyPathListFilter - * \brief This filter performs a simplification of the path in the input list. - * - * It reduces the number of vertices in each path, according to a tolerance criterion. It aims at - * removing aligned vertices while keeping sharp angular points. - * - * In order to ensure the unicity of its output, each path is considered first from begin to end, then - * from begin to the first vertex before the end. At each step, the consistency of the path is checked : - * the equation of the line passing by the first and last vertices is computed. Then, for each - * vertices between them, the euclidean distance to this line is computed. If for one vertex, this distance - * is upper than the tolerance threshold, the path is considered to be inconsistent and no vertices can be removed. - * - * If the past is considered constistent (which will occure at least with a 2 vertices path), only the beginning and ending - * vertices are kept and a new search iteration begin at its end. - * - * This filter is part of the road extraction framework. - * - * \sa BreakAngularPathListFilter - * \sa RemoveTortuousPathFilter. + * \brief This filter performs a simplification of the path in the input list. + * + * It reduces the number of vertices in each path, according to a tolerance criterion. It aims at + * removing aligned vertices while keeping sharp angular points. + * + * In order to ensure the unicity of its output, each path is considered first from begin to end, then + * from begin to the first vertex before the end. At each step, the consistency of the path is checked : + * the equation of the line passing by the first and last vertices is computed. Then, for each + * vertices between them, the euclidean distance to this line is computed. If for one vertex, this distance + * is upper than the tolerance threshold, the path is considered to be inconsistent and no vertices can be removed. + * + * If the past is considered constistent (which will occure at least with a 2 vertices path), + * only the beginning and ending + * vertices are kept and a new search iteration begin at its end. + * + * This filter is part of the road extraction framework. + * + * <b>Recent API changes:</b> + * Now part of the UnaryFunctorObjectListFilter hierachy, replace call to SetTolerance() + * by GetFunctor.SetTolerance(). + * + * + * \sa BreakAngularPathListFilter + * \sa RemoveTortuousPathFilter. + * \sa UnaryFunctorObjectListFilter * * \example FeatureExtraction/ExtractRoadByStepsExample.cxx * */ -template <class TPath> -class ITK_EXPORT SimplifyPathListFilter - : public PathListToPathListFilter<TPath> -{ - public: - /** Standard typedefs */ - typedef SimplifyPathListFilter Self; - typedef PathListToPathListFilter<TPath> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(SimplifyPathListFilter, PathListToPathList); - - /** Derived typedefs */ - typedef typename Superclass::OutputPathType PathType; - typedef typename Superclass::OutputPathPointerType PathPointerType; - typedef typename Superclass::OutputPathListType PathListType; - typedef typename Superclass::OutputPathListPointerType PathListPointerType; - typedef typename Superclass::OutputPathListConstPointerType PathListConstPointerType; - - typedef typename PathType::VertexListType VertexListType; - typedef typename VertexListType::ConstPointer VertexListConstPointerType; - typedef typename VertexListType::Iterator VertexListIteratorType; - typedef typename VertexListType::ConstIterator VertexListConstIteratorType; - typedef typename PathType::VertexType VertexType; - - typedef double ToleranceType; - itkGetMacro(Tolerance,ToleranceType); - itkSetMacro(Tolerance,ToleranceType); + template <class TPath> + class ITK_EXPORT SimplifyPathListFilter: + public UnaryFunctorObjectListFilter< + ObjectList<TPath>, + ObjectList<TPath>, + SimplifyPathFunctor<typename TPath::Pointer, typename TPath::Pointer> > + {}; -protected: - /** Constructor */ - SimplifyPathListFilter(); - /** Destructor */ - virtual ~SimplifyPathListFilter() {}; - /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - /** Main computation method */ - virtual void GenerateData(void); - /** - * Test if the segment composed of the points in vertextlist between the begin and the end iterators is valid. - * \param vertexList The list of vertices composing the segment, - * \param begin The Beginning of the segment, - * \param end The end of the segment, - * \return True if the segment is valid. - */ - virtual bool TestPathConsistency(VertexListConstPointerType vertexList, VertexListConstIteratorType begin, VertexListConstIteratorType end); - - /** - * Simplify one path of the list - * \param path pointer to path to be simplified, - * \return pointer to simplified path. - */ - PathPointerType SimplifyPath(PathPointerType path); - -private: - SimplifyPathListFilter(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented - - //// Tolerance for segment consistency (tolerance in terms of distance) - ToleranceType m_Tolerance; -}; }// End namespace otb -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbSimplifyPathListFilter.txx" -#endif +// #ifndef OTB_MANUAL_INSTANTIATION +// #include "otbSimplifyPathListFilter.txx" +// #endif #endif diff --git a/Code/FeatureExtraction/otbSimplifyPathListFilter.txx b/Code/FeatureExtraction/otbSimplifyPathListFilter.txx deleted file mode 100644 index 769f4c8a34c3dc277b8bac8b5024fa5a8a439e15..0000000000000000000000000000000000000000 --- a/Code/FeatureExtraction/otbSimplifyPathListFilter.txx +++ /dev/null @@ -1,145 +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 __otbSimplifyPathListFilter_txx -#define __otbSimplifyPathListFilter_txx - -#include "otbSimplifyPathListFilter.h" -#include "otbMacro.h" -#include "vnl/vnl_math.h" - -namespace otb -{ - /** - * Constructor - */ - template <class TPath> - SimplifyPathListFilter<TPath> - ::SimplifyPathListFilter() - { - m_Tolerance = 1.0; - } - - /** - * Test if the segment composed of the points in vertextlist between the begin and the end iterators is valid. - * \param vertexList The list of vertices composing the segment, - * \param begin The Beginning of the segment, - * \param end The end of the segment, - * \return True if the segment is valid. - */ - - template <class TPath> - bool - SimplifyPathListFilter<TPath> - ::TestPathConsistency(VertexListConstPointerType vertexList, VertexListConstIteratorType begin, VertexListConstIteratorType end) - { - VertexListConstIteratorType segmentIt = begin; - ++segmentIt; - //Compute the distance of a point to a segment based on the cross product - while (segmentIt != end) - { - double crossProduct = (end.Value()[0]-begin.Value()[0])*(segmentIt.Value()[1]-begin.Value()[1]) - - (end.Value()[1]-begin.Value()[1])*(segmentIt.Value()[0]-begin.Value()[0]); - double lenghtSeg = (end.Value()[0]-begin.Value()[0])*(end.Value()[0]-begin.Value()[0]) - +(end.Value()[1]-begin.Value()[1])*(end.Value()[1]-begin.Value()[1]); - if (lenghtSeg == 0) return false; - double distsq = crossProduct*crossProduct/lenghtSeg; - if (distsq > static_cast<double>(m_Tolerance) ) - { - return false; - } - ++segmentIt; - } - return true; - } - - /** - * Simplify one path of the list - * \param path pointer to path to be simplified, - * \return pointer to simplified path. - */ - template <class TPath> - typename SimplifyPathListFilter<TPath>::PathPointerType - SimplifyPathListFilter<TPath> - ::SimplifyPath(PathPointerType path) - { - PathPointerType newPath = PathType::New(); - newPath->Initialize(); - // Getting the verices list of the current input paths - VertexListConstPointerType vertexList = path->GetVertexList(); - VertexListConstIteratorType beginIt = vertexList->Begin(); - VertexListConstIteratorType beforeTheEndIt = --(vertexList->End()); - - // Add the first vertex - newPath->AddVertex(beginIt.Value()); - - while ( beginIt != beforeTheEndIt) - { - VertexListConstIteratorType endIt = beforeTheEndIt; - // while the segment is not consistent, decrement endIt - while (!this->TestPathConsistency(vertexList,beginIt, endIt)) - { - --endIt; - } - // Add the final vertex - newPath->AddVertex(endIt.Value()); - beginIt=endIt; - } - return newPath; - } - - - template <class TPath> - void - SimplifyPathListFilter<TPath> - ::GenerateData(void) - { - // input/output wiring - PathListConstPointerType inputPtr = this->GetInput(); - PathListPointerType outputPtr = this->GetOutput(); - - // Reset the output list in case of multiple updates - outputPtr->Clear(); - - // path iterator typedef - typedef typename PathListType::ConstIterator PathIteratorType; - - // iterator definition - PathIteratorType inputIt = inputPtr->Begin(); - while(inputIt != inputPtr->End()) - { - - PathPointerType newPath = SimplifyPath(inputIt.Get()); - // otbMsgDevMacro(<< "Path had " << vertexList->Size() << " now has " << newPath->GetVertexList()->Size()); - outputPtr->PushBack(newPath); - ++inputIt; - } - } - - - /** - * PrintSelf Method - */ - template <class TPath> - void - SimplifyPathListFilter<TPath> - ::PrintSelf(std::ostream& os, itk::Indent indent) const - { - Superclass::PrintSelf(os, indent); - } -} // End namespace otb -#endif diff --git a/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.txx b/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.txx index 9bbbc76a5fdb3d6ad11954065b0fe5c6acb41a58..ba644aa357891e0638a8319c0418f4f895c302a8 100644 --- a/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.txx +++ b/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.txx @@ -147,7 +147,7 @@ ImageMultiSegmentationToRCC8GraphFilter<TInputImage, TOutputGraph> // Some typedefs typedef otb::ImageToEdgePathFilter<InputImageType,PathType> EdgeExtractionFilterType; typedef otb::SimplifyPathListFilter<PathType> SimplifyPathFilterType; - typedef typename SimplifyPathFilterType::PathListType PathListType; + typedef typename SimplifyPathFilterType::InputListType PathListType; typedef itk::MinimumMaximumImageCalculator<InputImageType> MinMaxCalculatorType; typedef PolygonToPolygonRCC8Calculator<PathType> RCC8CalculatorType; @@ -185,7 +185,7 @@ ImageMultiSegmentationToRCC8GraphFilter<TInputImage, TOutputGraph> region->PushBack(extraction->GetOutput()); typename SimplifyPathFilterType::Pointer simplifier = SimplifyPathFilterType::New(); simplifier->SetInput(region); - simplifier->SetTolerance(0.1); + simplifier->GetFunctor().SetTolerance(0.1); simplifier->Update(); // Create a new vertex diff --git a/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx b/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx index af6793d64c0ea6193b213e088de961e168548c54..8bd635b0dc1c121e4abb59971f3534550846a883 100644 --- a/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx +++ b/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx @@ -306,7 +306,7 @@ int main( int argc, char * argv[] ) // Software Guide : BeginCodeSnippet typedef otb::SimplifyPathListFilter<PathType> SimplifyPathType; SimplifyPathType::Pointer simplifyPathListFilter = SimplifyPathType::New(); - simplifyPathListFilter->SetTolerance(1.0); + simplifyPathListFilter->GetFunctor().SetTolerance(1.0); simplifyPathListFilter->SetInput(vectorizationFilter->GetOutput()); typedef otb::BreakAngularPathListFilter<PathType> BreakAngularPathType; @@ -340,7 +340,7 @@ int main( int argc, char * argv[] ) linkPathListFilter->SetInput(removeTortuousPathListFilter->GetOutput()); SimplifyPathType::Pointer simplifyPathListFilter2 = SimplifyPathType::New(); - simplifyPathListFilter2->SetTolerance(1.0); + simplifyPathListFilter2->GetFunctor().SetTolerance(1.0); simplifyPathListFilter2->SetInput(linkPathListFilter->GetOutput()); RemoveTortuousPathType::Pointer removeTortuousPathListFilter2 diff --git a/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx index cbd2b4c2c808197e64b20a4ad94301353e09d5e3..56bcbdcadf8024c7e821719e18d766384c64f610 100644 --- a/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx @@ -57,7 +57,7 @@ int otbSimplifyPathListFilter(int argc, char * argv[]) const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath<Dimension> PathType; typedef otb::SimplifyPathListFilter<PathType> SimplifyPathListFilterType; - typedef SimplifyPathListFilterType::PathListType PathListType; + typedef SimplifyPathListFilterType::InputListType PathListType; PathType::ContinuousIndexType cindex; @@ -83,7 +83,7 @@ int otbSimplifyPathListFilter(int argc, char * argv[]) SimplifyPathListFilterType::Pointer simplifyFilter = SimplifyPathListFilterType::New(); simplifyFilter->SetInput(InputPathList); - simplifyFilter->SetTolerance(tolerance); + simplifyFilter->GetFunctor().SetTolerance(tolerance); simplifyFilter->Update(); PathListType::Pointer OutputPathList = simplifyFilter->GetOutput(); @@ -97,7 +97,7 @@ int otbSimplifyPathListFilter(int argc, char * argv[]) unsigned int counter = 1; PathListIteratorType pathListIt = InputPathList->Begin(); - file<<"TOLERANCE: "<<simplifyFilter->GetTolerance()<< "("<<tolerance<<")"<<std::endl; + file<<"TOLERANCE: "<<simplifyFilter->GetFunctor().GetTolerance()<< "("<<tolerance<<")"<<std::endl; file<<"INPUT list of Path "<<": "<<std::endl; while(pathListIt!=InputPathList->End()) { diff --git a/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx b/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx index 44718fe485c82d3581dc18ed18e9d680f1e304d1..37f5ac9e58e7b76349a3c73ece42ddf690e54938 100644 --- a/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx +++ b/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx @@ -36,7 +36,7 @@ int otbPolygonToPolygonRCC8Calculator(int argc, char* argv[]) typedef otb::Image<PixelType,Dimension> ImageType; typedef otb::ImageToEdgePathFilter<ImageType,PolygonType> EdgeExtractionFilterType; typedef otb::SimplifyPathListFilter<PolygonType> SimplifyPathFilterType; - typedef SimplifyPathFilterType::PathListType PathListType; + typedef SimplifyPathFilterType::InputListType PathListType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::PolygonToPolygonRCC8Calculator<PolygonType> CalculatorType; @@ -92,7 +92,7 @@ int otbPolygonToPolygonRCC8Calculator(int argc, char* argv[]) SimplifyPathFilterType::Pointer simplifier = SimplifyPathFilterType::New(); simplifier->SetInput(regions); - simplifier->SetTolerance(0.1); + simplifier->GetFunctor().SetTolerance(0.1); simplifier->Update(); // Declaration