Skip to content
Snippets Groups Projects
Commit bd2e9f4d authored by Thomas Feuvrier's avatar Thomas Feuvrier
Browse files

Ajout de la classe de base "ImageToPathFilter" dans COmmon + Test.

parent 2be03a3c
Branches
Tags
No related merge requests found
/*=========================================================================
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 __otbImageToPathFilter_h
#define __otbImageToPathFilter_h
#include "itkPathSource.h"
namespace otb
{
/**
* \class ImageToPathFilter
* \brief Classe de base base pour les filtres prenant une entr�e de type
* \doxygen{itk}{Image} et renvoyant une sortie de type \doxygen{itk}{Path}.
*/
template <class TInputImage, class TOutputPath>
class ITK_EXPORT ImageToPathFilter
: public itk::PathSource<TOutputPath>
{
public:
///Typedefs standards
typedef ImageToPathFilter Self;
typedef itk::PathSource<TOutputPath> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::ProcessObject ProcessObjectType;
/// Constructeur "objectFactory"
itkNewMacro(Self);
/// Informations � l'ex�cution
itkTypeMacro(PathToImageFilter,PathSource);
/// typedefs relatifs aux param�tres du template
typedef TInputImage InputImageType;
typedef typename InputImageType::Pointer InputImagePointerType;
typedef TOutputPath OutputPathType;
typedef typename OutputPathType::Pointer OutputPathPointerType;
///Dimension de l'image d'entr�e
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
///Entr�e du pipeline
virtual void SetInput(const InputImageType * Image);
const InputImageType * GetInput(void);
protected:
ImageToPathFilter();
virtual ~ImageToPathFilter(){};
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
private:
ImageToPathFilter(const Self&);
void operator=(const Self&);
};
}//Fin de l'espace de nom otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbImageToPathFilter.txx"
#endif
#endif
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbImageToPathFilter_txx
#define __otbImageToPathFilter_txx
#include "otbImageToPathFilter.h"
namespace otb
{
/**
* Constructeur
*/
template <class TInputImage, class TOutputPath>
ImageToPathFilter<TInputImage, TOutputPath>
::ImageToPathFilter()
{
// Peut etre modifie par les sous-classes
this->SetNumberOfRequiredInputs(1);
}
/**
* Methode Set pour l'image en entree
*/
template <class TInputImage, class TOutputPath>
void
ImageToPathFilter<TInputImage, TOutputPath>
::SetInput(const TInputImage * image)
{
this->ProcessObjectType::SetNthInput(0,const_cast<InputImageType *>(image));
}
/**
* Methode Get pour l'image en entree
*/
template <class TInputImage, class TOutputPath>
const typename ImageToPathFilter<TInputImage, TOutputPath>::InputImageType *
ImageToPathFilter<TInputImage, TOutputPath>
::GetInput(void)
{
return static_cast<const TInputImage *>(this->ProcessObjectType::GetInput(0));
}
/**
* Methode PrintSelf
*/
template <class TInputImage, class TOutputPath>
void
ImageToPathFilter<TInputImage,TOutputPath>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
}
}//Fin de l'espace de nom otb
#endif
......@@ -290,6 +290,11 @@ ADD_TEST(coTvConcatenateVectorImageFilter ${COMMON_TESTS}
${TEMP}/coConcatenateVectorImageFilterOutput1.hdr
)
# ------- otb::ImageToPathFilterNew -------------------------------------------
ADD_TEST(coTuImageToPathFilterNew ${COMMON_TESTS}
otbImageToPathFilterNew)
# ------- Fichiers sources CXX -----------------------------------
SET(BasicCommon_SRCS
......@@ -326,6 +331,7 @@ otbListNew.cxx
otbList.cxx
otbConcatenateVectorImageFilterNew.cxx
otbConcatenateVectorImageFilter.cxx
otbImageToPathFilterNew.cxx
)
......
......@@ -59,4 +59,5 @@ REGISTER_TEST(otbImageToImageListFilterNew);
REGISTER_TEST(otbImageListToImageListFilterNew);
REGISTER_TEST(otbConcatenateVectorImageFilterNew);
REGISTER_TEST(otbConcatenateVectorImageFilter);
REGISTER_TEST(otbImageToPathFilterNew);
}
/*=========================================================================
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 "itkPolyLineParametricPath.h"
#include "otbImageToPathFilter.h"
#include "otbImage.h"
int otbImageToPathFilterNew(int argc, char * argv[])
{
try
{
const unsigned int Dimension = 2;
typedef unsigned char PixelType;
typedef otb::Image<PixelType, Dimension> ImageType;
typedef itk::PolyLineParametricPath< Dimension > PathType;
typedef otb::ImageToPathFilter<ImageType,PathType> ImageToPathFilterType;
ImageToPathFilterType::Pointer pathFilter = ImageToPathFilterType::New();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject thrown !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Unknown exception thrown !" << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment