From 8625d71f459c223f5a034cf922cfc935681fa332 Mon Sep 17 00:00:00 2001 From: Gregoire Mercier <gregoire.mercier@telecom-bretagne.eu> Date: Tue, 25 Aug 2009 09:04:47 +0200 Subject: [PATCH] BUG: (wvlt) padding threaded regions --- Code/MultiScale/otbWaveletFilterBank.txx | 62 ++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/Code/MultiScale/otbWaveletFilterBank.txx b/Code/MultiScale/otbWaveletFilterBank.txx index 068426ed45..b12eab7f89 100644 --- a/Code/MultiScale/otbWaveletFilterBank.txx +++ b/Code/MultiScale/otbWaveletFilterBank.txx @@ -237,6 +237,39 @@ WaveletFilterBank< TInputImage, TOutputImage, TWaveletOperator, FORWARD > destRegion.SetIndex( destIndex ); destRegion.SetSize( destSize ); + +#if 0 + // Contrairement a INVERSE, ici ca ne sera a rien apparemment... + + // Region Padding + LowPassOperatorType lowPassOperator; + lowPassOperator.SetDirection(0); + lowPassOperator.SetUpSampleFactor( this->GetUpSampleFilterFactor() ); + lowPassOperator.CreateDirectional(); + + unsigned long radius [ InputImageDimension ]; + radius[0] = lowPassOperator.GetRadius()[0]; + + HighPassOperatorType highPassOperator; + highPassOperator.SetDirection(0); + highPassOperator.SetUpSampleFactor( this->GetUpSampleFilterFactor() ); + highPassOperator.CreateDirectional(); + + if ( radius[0] < highPassOperator.GetRadius()[0] ) + radius[0] = highPassOperator.GetRadius()[0]; + + for ( unsigned int i = 1; i < InputImageDimension; i++ ) + radius[i] = 0; + + InputImageRegionType paddedRegion = destRegion; + paddedRegion.PadByRadius( radius ); + + if ( paddedRegion.Crop( this->GetInput()->GetLargestPossibleRegion() ) ) + { + destRegion = paddedRegion; + } +#endif + } } @@ -771,6 +804,35 @@ WaveletFilterBank< TInputImage, TOutputImage, TWaveletOperator, INVERSE > destRegion.SetIndex( destIndex ); destRegion.SetSize( destSize ); +#if 1 + // Region Padding + LowPassOperatorType lowPassOperator; + lowPassOperator.SetDirection(0); + lowPassOperator.SetUpSampleFactor( this->GetUpSampleFilterFactor() ); + lowPassOperator.CreateDirectional(); + + unsigned long radius [ InputImageDimension ]; + radius[0] = lowPassOperator.GetRadius()[0]; + + HighPassOperatorType highPassOperator; + highPassOperator.SetDirection(0); + highPassOperator.SetUpSampleFactor( this->GetUpSampleFilterFactor() ); + highPassOperator.CreateDirectional(); + + if ( radius[0] < highPassOperator.GetRadius()[0] ) + radius[0] = highPassOperator.GetRadius()[0]; + + for ( unsigned int i = 1; i < InputImageDimension; i++ ) + radius[i] = 0; + + InputImageRegionType paddedRegion = destRegion; + paddedRegion.PadByRadius( radius ); + + if ( paddedRegion.Crop( this->GetInput(0)->GetLargestPossibleRegion() ) ) + { + destRegion = paddedRegion; + } +#endif } } -- GitLab