diff --git a/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h b/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h index 0a6923f7a50f20aed4f5ef358d74a208fb99e160..eb509361704219cebf9d91e5eff48cdb6d8794a6 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 3f2f6bda3dff5e5ca2063b6c7afa9059cc9f0ff5..98af2342311242f3f45bed25dc3f8463fbe2f2e4 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 94798b40b8072c342a1c227915aa627c0d92cd84..d10edeac34b9fc9495bc0575df6329240f19b37a 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();