17 #ifndef __itkVectorResampleImageFilter_txx
18 #define __itkVectorResampleImageFilter_txx
33 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
37 m_OutputSpacing.Fill(1.0);
38 m_OutputOrigin.Fill(0.0);
39 m_OutputDirection.SetIdentity();
41 m_OutputStartIndex.Fill( 0 );
45 m_DefaultPixelValue.Fill(0);
49 this->SetNumberOfThreads(1);
59 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
64 Superclass::PrintSelf(os,indent);
66 os << indent <<
"DefaultPixelValue: "
67 <<
static_cast<typename NumericTraits<PixelType>::PrintType
>(m_DefaultPixelValue)
69 os << indent <<
"Size: " << m_Size << std::endl;
70 os << indent <<
"OutputStartIndex: " << m_OutputStartIndex << std::endl;
71 os << indent <<
"OutputSpacing: " << m_OutputSpacing << std::endl;
72 os << indent <<
"OutputOrigin: " << m_OutputOrigin << std::endl;
73 os << indent <<
"OutputDirection: " << m_OutputDirection << std::endl;
74 os << indent <<
"Transform: " << m_Transform.GetPointer() << std::endl;
75 os << indent <<
"Interpolator: " << m_Interpolator.GetPointer() << std::endl;
83 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
89 this->SetOutputSpacing( s );
95 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
101 this->SetOutputOrigin( p );
109 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
115 if( !m_Interpolator )
117 itkExceptionMacro(<<
"Interpolator not set");
121 m_Interpolator->SetInputImage( this->GetInput() );
128 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
134 m_Interpolator->SetInputImage(
NULL );
141 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
148 itkDebugMacro(<<
"Actually executing");
159 OutputIterator outIt(outputPtr, outputRegionForThread);
167 ContinuousIndexType inputIndex;
169 const unsigned int numberOfComponents = PixelType::GetNumberOfComponents();
172 ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
179 while ( !outIt.IsAtEnd() )
182 outputPtr->TransformIndexToPhysicalPoint( outIt.GetIndex(), outputPoint );
185 inputPoint = m_Transform->TransformPoint(outputPoint);
186 inputPtr->TransformPhysicalPointToContinuousIndex(inputPoint, inputIndex);
189 if( m_Interpolator->IsInsideBuffer(inputIndex) )
192 const OutputType value
193 = m_Interpolator->EvaluateAtContinuousIndex( inputIndex );
194 for(
unsigned int i=0; i< numberOfComponents; i++ )
202 outIt.Set(m_DefaultPixelValue);
205 progress.CompletedPixel();
218 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
224 Superclass::GenerateInputRequestedRegion();
226 if ( !this->GetInput() )
233 const_cast< TInputImage *
>( this->GetInput() );
237 inputRegion = inputPtr->GetLargestPossibleRegion();
238 inputPtr->SetRequestedRegion(inputRegion);
246 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
252 Superclass::GenerateOutputInformation();
262 typename TOutputImage::RegionType outputLargestPossibleRegion;
263 outputLargestPossibleRegion.SetSize( m_Size );
264 outputLargestPossibleRegion.SetIndex( m_OutputStartIndex );
265 outputPtr->SetLargestPossibleRegion( outputLargestPossibleRegion );
268 outputPtr->SetSpacing( m_OutputSpacing );
269 outputPtr->SetOrigin( m_OutputOrigin );
270 outputPtr->SetDirection( m_OutputDirection );
278 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
287 if( latestTime < m_Transform->GetMTime() )
289 latestTime = m_Transform->GetMTime();
295 if( latestTime < m_Interpolator->GetMTime() )
297 latestTime = m_Interpolator->GetMTime();