Skip to content
Snippets Groups Projects
Commit 462792ce authored by Patrick Imbo's avatar Patrick Imbo
Browse files

otbForwardFourierMellinTransformImageFilter : implémentation de la classe + tests

parent e0229883
No related branches found
No related tags found
No related merge requests found
......@@ -141,7 +141,7 @@ public:
/** Set the Sigma value. */
itkSetMacro(Sigma, double);
/** Get the Sigma value. */
itkGetConstReferenceMacro(Sigma, double);
itkGetConstMacro(Sigma, double);
/** LogPolarResampleImageFilter produces an image which is a different size
* than its input. As such, it needs to provide an implementation
......
......@@ -4,7 +4,7 @@
FILE(GLOB OTBFeatureExtraction_SRCS "*.cxx" )
ADD_LIBRARY(OTBFeatureExtraction ${OTBFeatureExtraction_SRCS})
TARGET_LINK_LIBRARIES (OTBFeatureExtraction OTBCommon OTBIO ITKCommon ITKIO)
TARGET_LINK_LIBRARIES (OTBFeatureExtraction OTBCommon OTBIO ITKCommon ITKIO ITKAlgorithms)
INSTALL_TARGETS(/lib/otb OTBFeatureExtraction )
INSTALL_FILES(/include/otb/FeatureExtraction "(\\.h|\\.txx)$")
/*=========================================================================
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 _otbForwardFourierMellinTransformImageFilter_h
#define _otbForwardFourierMellinTransformImageFilter_h
#include "otbImage.h"
#include "otbLogPolarResampleImageFilter.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkImageToImageFilter.h"
#include "itkVnlFFTRealToComplexConjugateImageFilter.h"
namespace otb
{
/**
* \class ForwardFourierMellinTransformImageFilter
* \brief Calculate the Fourier-Mellin transform over an image.
*
* This class implements a composite filter. It combines two filters :
* \begin{itemize}
* \item otb::LogPolarResampleImageFilter
* \item itk:: ...
* \end{itemize}
*
* \ingroup ImageFunctions
*/
template < class TPixel,
class TInterpol,
unsigned int Dimension = 2 >
class ITK_EXPORT ForwardFourierMellinTransformImageFilter :
public itk::ImageToImageFilter<Image< TPixel , Dimension >,
Image< std::complex<TPixel> , Dimension > >
{
public:
typedef TPixel PixelType;
typedef otb::Image< TPixel , Dimension > InputImageType;
typedef otb::Image< std::complex< TPixel > , Dimension > OutputImageType;
/** Standard class typedefs. */
typedef ForwardFourierMellinTransformImageFilter Self;
typedef itk::ImageToImageFilter< InputImageType, OutputImageType> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Run-time type information (and related methods). */
itkTypeMacro( ForwardFourierMellinTransformImageFilter, itk::ImageToImageFilter);
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** InputImageType typedef support. */
typedef typename InputImageType::PixelType PixeltType;
typedef typename InputImageType::IndexType IndexType;
typedef typename OutputImageType::PixelType ComplexType;
/** Typedefs to describe and access Interpolator */
typedef TInterpol InterpolatorType;
typedef typename InterpolatorType::Pointer InterpolatorPointer;
typedef typename InterpolatorType::ConstPointer InterpolatorConstPointer;
typedef typename InterpolatorType::CoordRepType CoordRepType;
typedef typename InterpolatorType::PointType PointType;
typedef typename InterpolatorType::CoordRepType CoordRepType;
typedef LogPolarResampleImageFilter<InputImageType,TInterpol> LogPolarResampleImageFilterType;
typedef typename LogPolarResampleImageFilterType::Pointer LogPolarResampleImageFilterPointer;
typedef typename itk::VnlFFTRealToComplexConjugateImageFilter<PixeltType,Dimension> FourierImageFilterType;
typedef typename FourierImageFilterType::Pointer FourierImageFilterPointer;
typedef typename FourierImageFilterType::ConstPointer FourierImageFilterConstPointer;
/** Set/Get Angular Step */
void SetAngularStep( double angularStep );
const double GetAngularStep( void );
/** Set/Get Radial Step */
void SetRadialStep( double radialStep );
const double GetRadialStep( void );
/** Set/Get Radial number of samples */
void SetRadialNumberOfSamples( double radialNumberOfSamples );
const double GetRadialNumberOfSamples( void );
/** Set/Get Angular number of samples */
void SetAngularNumberOfSamples( double angularNumberOfSamples );
const double GetAngularNumberOfSamples( void );
/** Set/Get the Sigma value for the Log-polar resampler */
void SetSimga( double sigma );
const double GetSigma( void );
/** Set/Get the IsAtCenter value for the Log-polar resampler */
void SetIsAtCenter( bool isAtCenter );
const bool GetIsAtCenter( void );
/** Set/Get the Default pixel value for the Log-polar resampler */
void SetDefaultPixelValue( PixelType pixelValue );
// const PixelType GetDefaultPixelValue( void );
/** Set/Get the Interpolator pointer for the Log-polar resampler */
void SetInterpolator( InterpolatorPointer interpolator );
// InterpolatorConstPointer GetInterpolator( void );
protected:
ForwardFourierMellinTransformImageFilter();
~ForwardFourierMellinTransformImageFilter(){};
void PrintSelf(std::ostream& os, itk::Indent indent) const;
void GenerateData();
private:
ForwardFourierMellinTransformImageFilter( const Self& ); //purposely not implemented
void operator=( const Self& ); //purposely not implemented
LogPolarResampleImageFilterPointer m_LogPolarResample;
FourierImageFilterPointer m_FourierTransform;
};
} // namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbForwardFourierMellinTransformImageFilter.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 _otbForwardFourierMellinTransformImageFilter_txx
#define _otbForwardFourierMellinTransformImageFilter_txx
#include "otbForwardFourierMellinTransformImageFilter.h"
namespace otb
{
template < class TPixel,class TInterpol,unsigned int Dimension >
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::ForwardFourierMellinTransformImageFilter()
{
m_LogPolarResample = LogPolarResampleImageFilterType::New();
m_FourierTransform = FourierImageFilterType::New();
}
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::GenerateData()
{
m_LogPolarResample->SetInput( this->GetInput() );
m_FourierTransform->SetInput( m_LogPolarResample->GetInput() );
m_FourierTransform->GraftOutput( this->GetOutput() );
m_FourierTransform->Update();
this->GraftOutput(m_FourierTransform->GetOutput() );
}
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::SetAngularStep(double angularStep )
{
m_LogPolarResample->SetAngularStep(angularStep);
}
template < class TPixel,class TInterpol,unsigned int Dimension >
const double
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::GetAngularStep()
{
return m_LogPolarResample->GetAngularStep();
}
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::SetRadialStep(double radialStep )
{
m_LogPolarResample->GetRadialStep(radialStep);
}
template < class TPixel,class TInterpol,unsigned int Dimension >
const double
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::GetRadialStep( )
{
return m_LogPolarResample->GetRadialStep();
}
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::SetAngularNumberOfSamples(double angularNumberOfSamples )
{
m_LogPolarResample->SetAngularNumberOfSamples(angularNumberOfSamples);
}
template < class TPixel,class TInterpol,unsigned int Dimension >
const double
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::GetAngularNumberOfSamples()
{
return m_LogPolarResample->GetAngularNumberOfSamples();
}
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::SetRadialNumberOfSamples(double radialNumberOfSamples )
{
m_LogPolarResample->GetRadialNumberOfSamples(radialNumberOfSamples);
}
template < class TPixel,class TInterpol,unsigned int Dimension >
const double
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::GetRadialNumberOfSamples( )
{
return m_LogPolarResample->GetRadialNumberOfSamples();
}
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::SetSimga(double sigma )
{
m_LogPolarResample->SetSimga(sigma);
}
template < class TPixel,class TInterpol,unsigned int Dimension >
const double
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::GetSigma( )
{
return m_LogPolarResample->GetSigma();
}
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::SetIsAtCenter(bool isAtCenter)
{
m_LogPolarResample->SetIsAtCenter(isAtCenter);
}
template < class TPixel,class TInterpol,unsigned int Dimension >
const bool
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::GetIsAtCenter( )
{
return m_LogPolarResample->GetIsAtCenter();
}
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::SetDefaultPixelValue(PixelType pixelValue)
{
m_LogPolarResample->SetDefaultPixelValue(pixelValue);
}
/*
template < class TPixel,class TInterpol,unsigned int Dimension >
const PixelType
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::GetDefaultPixelValue( )
{
return static_cast<const PixelType>(m_LogPolarResample->GetDefaultPixelValue());
}
*/
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::SetInterpolator(InterpolatorPointer interpolator )
{
m_LogPolarResample->SetInterpolator(interpolator);
}
/*
template < class TPixel,class TInterpol,unsigned int Dimension >
InterpolatorConstPointer
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::GetInterpolator( )
{
return static_cast<InterpolatorConstPointer>(m_LogPolarResample->GetInterpolator());
}
*/
/**
* Standard "PrintSelf" method
*/
template < class TPixel,class TInterpol,unsigned int Dimension >
void
ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf( os, indent );
os << indent << "m_LogPolarResample : " << m_LogPolarResample.GetPointer() << std::endl;
}
} // end namespace otb
#endif
......@@ -382,8 +382,8 @@ ADD_TEST(feTvExtractSegments ${FEATUREEXTRACTION_TESTS}
# ------- otb::ForwardFourierMellinTransformImageFilter -------------
#ADD_TEST(feTuForwardFourierMellinTransformImageFilterNew ${COMMON_TESTS}
# otbForwardFourierMellinTransformImageFilterNew)
ADD_TEST(feTuForwardFourierMellinImageFilterNew ${FEATUREEXTRACTION_TESTS}
otbFourierMellinImageFilterNew)
# -----------------------------------------------------------------------
......@@ -440,13 +440,14 @@ otbLocalHough.cxx
otbLocalHoughDraw.cxx
otbExtractSegmentsNew.cxx
otbExtractSegments.cxx
otbFourierMellinImageFilterNew.cxx
)
INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}")
ADD_EXECUTABLE(otbFeatureExtractionTests otbFeatureExtractionTests.cxx ${BasicFeatureExtraction_SRCS})
TARGET_LINK_LIBRARIES(otbFeatureExtractionTests OTBFeatureExtraction OTBCommon OTBIO gdal ITKIO ITKCommon)
TARGET_LINK_LIBRARIES(otbFeatureExtractionTests OTBFeatureExtraction OTBCommon OTBIO gdal ITKIO ITKCommon ITKAlgorithms)
ENDIF( NOT OTB_DISABLE_CXX_TESTING )
......
......@@ -76,4 +76,5 @@ REGISTER_TEST(otbLocalHough);
REGISTER_TEST(otbLocalHoughDraw);
REGISTER_TEST(otbExtractSegmentsNew);
REGISTER_TEST(otbExtractSegments);
REGISTER_TEST(otbFourierMellinImageFilterNew);
}
......@@ -37,11 +37,12 @@ int otbForwardFourierMellinTransformImageFilterNew(int argc, char* argv[])
typedef otb::Image< PixelType, Dimension > InputImageType;
typedef otb::Image< PixelType, Dimension > OutputImageType;
typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType;
typedef otb::ForwardFourierMellinTransformImageFilter<PixelType,InterpolatorType> FourierMellinTransformType;
typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType;
typedef otb::ForwardFourierMellinTransformImageFilter<PixelType,
InterpolatorType,Dimension> FourierMellinTransformType;
try
{
FourierMellinTransformType::Pointer fourierMellinTransform = FourierMellinTransformType::New();
}
catch( itk::ExceptionObject & err )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment