From 967b563d45682949933d3ddb161704454648bb47 Mon Sep 17 00:00:00 2001
From: Patrick Imbo <patrick.imbo@c-s.fr>
Date: Mon, 11 Sep 2006 14:29:29 +0000
Subject: [PATCH] =?UTF-8?q?otbForwardFourierMellinTransformImageFilter=20:?=
 =?UTF-8?q?=20impl=C3=A9mentation=20de=20la=20classe=20+=20tests?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ...ForwardFourierMellinTransformImageFilter.h | 18 ++++++++
 ...rwardFourierMellinTransformImageFilter.txx | 41 +++++++++++++++++--
 .../otbFourierMellinImageFilter.cxx           |  2 +-
 3 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h b/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h
index 0a6923f7a5..eb50936170 100644
--- a/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h
+++ b/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h
@@ -72,6 +72,16 @@ public:
   /** InputImageType typedef support. */
   typedef typename InputImageType::PixelType            PixeltType;
   typedef typename InputImageType::IndexType            IndexType;
+  typedef typename InputImageType::Pointer              ImagePointer;
+  typedef typename InputImageType::ConstPointer         ImageConstPointer;
+  
+  /** InputImageType typedef support. */
+  typedef typename OutputImageType::PixelType            OutputPixeltType;
+  typedef typename OutputImageType::IndexType            OutputIndexType;
+  typedef typename OutputImageType::Pointer              OutputImagePointer;
+  typedef typename OutputImageType::ConstPointer         OutputImageConstPointer;
+  typedef typename OutputImageType::RegionType 	  	 OutputImageRegionType;
+
  
   typedef typename OutputImageType::PixelType            ComplexType;
 
@@ -123,12 +133,20 @@ public:
   void SetInterpolator( InterpolatorPointer interpolator );
 //  InterpolatorConstPointer GetInterpolator( void );  
 
+  /** ForwardFourierMellinTransformImageFilter produces an image which is a different size
+   * than its input.  As such, it needs to provide an implementation
+   * for GenerateOutputInformation() in order to inform the pipeline
+   * execution model.  The original documentation of this method is
+   * below. \sa ProcessObject::GenerateOutputInformaton() */
+  virtual void GenerateOutputInformation();
+
 
 protected:
   ForwardFourierMellinTransformImageFilter();
   ~ForwardFourierMellinTransformImageFilter(){};
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
   void GenerateData();
+
   
 private:
   ForwardFourierMellinTransformImageFilter( const Self& ); //purposely not implemented
diff --git a/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx b/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx
index 3f2f6bda3d..98af234231 100644
--- a/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx
+++ b/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx
@@ -39,12 +39,47 @@ ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
 ::GenerateData()
 {
 	m_LogPolarResample->SetInput( this->GetInput() );
-	m_FourierTransform->SetInput( m_LogPolarResample->GetOutput() );
-	m_FourierTransform->GraftOutput( this->GetOutput() );
+	m_LogPolarResample->Update();
+ 	m_FourierTransform->SetInput( m_LogPolarResample->GetOutput() );
+ 	m_FourierTransform->GraftOutput( this->GetOutput() );
+
 	m_FourierTransform->Update();
-  	this->GraftOutput(m_FourierTransform->GetOutput() );
+ 	this->GraftOutput( m_FourierTransform->GetOutput() );
+}
+
+
+/** 
+ * Inform pipeline of required output region
+ */
+template < class TPixel,class  TInterpol,unsigned int   Dimension >
+void
+ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
+::GenerateOutputInformation()
+{
+  // call the superclass' implementation of this method
+  Superclass::GenerateOutputInformation();
+
+  // get pointers to the input and output
+  ImagePointer inputPtr  =  const_cast<InputImageType *>( this->GetInput() );
+  OutputImagePointer   outputPtr = this->GetOutput();;
+  if ( !inputPtr )
+    {
+    return;
+    }
+
+  m_LogPolarResample->GenerateOutputInformation();
+    
+  
+  OutputImageRegionType    outputLargestPossibleRegion;
+  outputLargestPossibleRegion.SetSize( m_LogPolarResample->GetOutput()->GetLargestPossibleRegion().GetSize() );
+  outputLargestPossibleRegion.SetIndex( m_LogPolarResample->GetOutput()->GetLargestPossibleRegion().GetIndex() );
+  outputPtr->SetLargestPossibleRegion( outputLargestPossibleRegion );
+
+  return;
 }
 
+
+
 template < class TPixel,class  TInterpol,unsigned int   Dimension >
 void
 ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension >
diff --git a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx
index 94798b40b8..d10edeac34 100644
--- a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx
+++ b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx
@@ -61,7 +61,7 @@ int otbFourierMellinImageFilter(int argc, char* argv[])
 //	FourierMellinTransform->SetIsOriginAtCenter(true);
 //	FourierMellinTransform->SetAngularNumberOfSamples(512);
 //	FourierMellinTransform->SetRadialNumberOfSamples(513);
-	
+//	FourierMellinTransform->Update();
         writer->SetInput( FourierMellinTransform->GetOutput() );
         
         writer->Update(); 
-- 
GitLab