diff --git a/Code/FeatureExtraction/otbImageFittingPolygonListFilter.h b/Code/FeatureExtraction/otbImageFittingPolygonListFilter.h index 39ba6869f4b68601449dd556d0f65c7ac6ee79ed..bff0584dbd3499ea6d736048281c86ae8e12b1cf 100644 --- a/Code/FeatureExtraction/otbImageFittingPolygonListFilter.h +++ b/Code/FeatureExtraction/otbImageFittingPolygonListFilter.h @@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImagePerturbationPolygonListFilter_h -#define __otbImagePerturbationPolygonListFilter_h +#ifndef __otbImageFittingPolygonListFilter_h +#define __otbImageFittingPolygonListFilter_h #include "otbPathListToPathListFilter.h" #include "otbMacro.h" @@ -24,7 +24,7 @@ PURPOSE. See the above copyright notices for more information. namespace otb { -/** \class ImagePerturbationPolygonListFilter +/** \class ImageFittingPolygonListFilter * \brief Slightly deform polygon to reach higher enery from the image * * <br>Limitations:</br> This filter is currently working with integer position @@ -32,12 +32,12 @@ namespace otb * */ template <class TPath, class TImage> -class ITK_EXPORT ImagePerturbationPolygonListFilter +class ITK_EXPORT ImageFittingPolygonListFilter : public PathListToPathListFilter<TPath> { public: /** Standard typedefs */ - typedef ImagePerturbationPolygonListFilter Self; + typedef ImageFittingPolygonListFilter Self; typedef PathListToPathListFilter<TPath> Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; @@ -46,7 +46,7 @@ class ITK_EXPORT ImagePerturbationPolygonListFilter itkNewMacro(Self); /** Creation through object factory macro */ - itkTypeMacro(ImagePerturbationPolygonListFilter, PathListToPathListFilter); + itkTypeMacro(ImageFittingPolygonListFilter, PathListToPathListFilter); /** Template parameters typedefs */ typedef typename Superclass::PathType PathType; @@ -87,9 +87,9 @@ class ITK_EXPORT ImagePerturbationPolygonListFilter protected: /** Constructor */ - ImagePerturbationPolygonListFilter(); + ImageFittingPolygonListFilter(); /** Destructor */ - virtual ~ImagePerturbationPolygonListFilter() {}; + virtual ~ImageFittingPolygonListFilter() {}; /** GenerateData method */ virtual void GenerateData(); /** PrintSelf method */ @@ -101,14 +101,14 @@ protected: unsigned int m_NumberOfIterations; private: - ImagePerturbationPolygonListFilter(const Self&); //purposely not implemented + ImageFittingPolygonListFilter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; }// End namespace otb #ifndef OTB_MANUAL_INSTANTIATION -#include "otbImagePerturbationPolygonListFilter.txx" +#include "otbImageFittingPolygonListFilter.txx" #endif #endif diff --git a/Code/FeatureExtraction/otbImageFittingPolygonListFilter.txx b/Code/FeatureExtraction/otbImageFittingPolygonListFilter.txx index 2d054ca12d96a339ee118e66fde5ea99e7d63846..5b0e5d0e41b3035a44d2fb98d0dc1a612e509278 100644 --- a/Code/FeatureExtraction/otbImageFittingPolygonListFilter.txx +++ b/Code/FeatureExtraction/otbImageFittingPolygonListFilter.txx @@ -15,13 +15,13 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef __otbImagePerturbationPolygonListFilter_txx -#define __otbImagePerturbationPolygonListFilter_txx +#ifndef __otbImageFittingPolygonListFilter_txx +#define __otbImageFittingPolygonListFilter_txx -#include "otbImagePerturbationPolygonListFilter.h" +#include "otbImageFittingPolygonListFilter.h" #include "otbPolyLineImageConstIterator.h" #include "otbMacro.h" - +#include "itkImageRegionConstIteratorWithIndex.h" namespace otb { @@ -29,8 +29,8 @@ namespace otb * Constructor */ template <class TPath, class TImage> -ImagePerturbationPolygonListFilter<TPath, TImage> -::ImagePerturbationPolygonListFilter() +ImageFittingPolygonListFilter<TPath, TImage> +::ImageFittingPolygonListFilter() { this->SetNumberOfRequiredInputs(2); this->SetNumberOfInputs(2); @@ -40,16 +40,16 @@ ImagePerturbationPolygonListFilter<TPath, TImage> template <class TPath, class TImage> void -ImagePerturbationPolygonListFilter<TPath, TImage> +ImageFittingPolygonListFilter<TPath, TImage> ::SetInputImage(const ImageType * image) { this->itk::ProcessObject::SetNthInput(1,const_cast<ImageType *>(image)); } template <class TPath, class TImage> -const typename ImagePerturbationPolygonListFilter<TPath, TImage> +const typename ImageFittingPolygonListFilter<TPath, TImage> ::ImageType * -ImagePerturbationPolygonListFilter<TPath, TImage> +ImageFittingPolygonListFilter<TPath, TImage> ::GetInputImage(void) { if(this->GetNumberOfInputs()<1) @@ -65,7 +65,7 @@ ImagePerturbationPolygonListFilter<TPath, TImage> //maybe we should use the itk::LineConstIterator template <class TPath, class TImage> void -ImagePerturbationPolygonListFilter<TPath, TImage> +ImageFittingPolygonListFilter<TPath, TImage> ::GenerateData() { // I/O wiring @@ -222,7 +222,7 @@ ImagePerturbationPolygonListFilter<TPath, TImage> template <class TPath, class TImage> double - ImagePerturbationPolygonListFilter<TPath, TImage> + ImageFittingPolygonListFilter<TPath, TImage> ::computeValue(ImageConstPointerType image, VertexType middlePoint, VertexType previousPoint, VertexType nextPoint) const { typedef typename ImageType::IndexType IndexType; @@ -263,7 +263,7 @@ template <class TPath, class TImage> */ template <class TPath, class TImage> void -ImagePerturbationPolygonListFilter<TPath, TImage> +ImageFittingPolygonListFilter<TPath, TImage> ::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); diff --git a/Testing/Code/FeatureExtraction/CMakeLists.txt b/Testing/Code/FeatureExtraction/CMakeLists.txt index 1a96b798a6ebbde08127cc2759339d56484359e1..16147db51985b2cac75d32dd63de899be25edaba 100644 --- a/Testing/Code/FeatureExtraction/CMakeLists.txt +++ b/Testing/Code/FeatureExtraction/CMakeLists.txt @@ -839,8 +839,10 @@ ADD_TEST(feTvImageToHessianDeterminantImageFilter ${FEATUREEXTRACTION_TESTS9} ${TEMP}/feTvImageToHessianDeterminantImageFilterOutput.tif 1.5 ) - - + +# ------- otb::ImageFittingPolygonListFilter ------------- +ADD_TEST(feTuImageFittingPolygonListFilterNew ${FEATUREEXTRACTION_TESTS9} + otbImageFittingPolygonListFilterNew) # A enrichir SET(BasicFeatureExtraction_SRCS1 @@ -946,6 +948,7 @@ otbImageToSIFTKeyPointSetFilterOutputImage.cxx otbImageToSIFTKeyPointSetFilterOutputAscii.cxx otbImageToHessianDeterminantImageFilterNew.cxx otbImageToHessianDeterminantImageFilter.cxx +otbImageFittingPolygonListFilterNew.cxx ) INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}") diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests9.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests9.cxx index 556fbe6f73604c20d62602dd6fd95791651d3c1a..9b4221b808cf1c489e92c082fbe1be9076307aeb 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests9.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests9.cxx @@ -35,5 +35,6 @@ REGISTER_TEST(otbImageToSIFTKeyPointSetFilterOutputAscii); //REGISTER_TEST(otbImageToSIFTKeyPointSetFilterValid); REGISTER_TEST(otbImageToHessianDeterminantImageFilterNew); REGISTER_TEST(otbImageToHessianDeterminantImageFilter); +REGISTER_TEST(otbImageFittingPolygonListFilterNew); } diff --git a/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx b/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ecc01af65103fdb190484fe2546d2751adc401df --- /dev/null +++ b/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx @@ -0,0 +1,37 @@ +/*========================================================================= + + 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 "itkExceptionObject.h" + +#include "otbImageFittingPolygonListFilter.h" +#include "otbPolygon.h" +#include "otbImage.h" +#include <cstdlib> + +int otbImageFittingPolygonListFilterNew(int argc, char * argv[]) +{ + const unsigned int Dimension =2; + typedef otb::Polygon<double> PolygonType; + typedef otb::Image<double,2> ImageType; + + typedef otb::ImageFittingPolygonListFilter<PolygonType,ImageType> FittingPolygonType; + + // Instantiating object + FittingPolygonType::Pointer fittingPolygon = FittingPolygonType::New(); + + return EXIT_SUCCESS; +}