17 #ifndef __itkWarpVectorImageFilter_txx
18 #define __itkWarpVectorImageFilter_txx
31 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
36 this->SetNumberOfRequiredInputs( 2 );
39 m_OutputSpacing.Fill( 1.0 );
40 m_OutputOrigin.Fill( 0.0 );
41 m_OutputDirection.SetIdentity();
43 for (
unsigned int i=0; i<PixelDimension; i++)
45 m_EdgePaddingValue[i] = 0;
50 DefaultInterpolatorType::New();
60 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
66 Superclass::PrintSelf(os, indent);
68 os << indent <<
"OutputSpacing: " << m_OutputSpacing << std::endl;
69 os << indent <<
"OutputOrigin: " << m_OutputOrigin << std::endl;
70 os << indent <<
"OutputDirection: " << m_OutputDirection << std::endl;
71 os << indent <<
"EdgePaddingValue: "
72 <<
static_cast<typename NumericTraits<PixelType>::PrintType
>(m_EdgePaddingValue)
74 os << indent <<
"Interpolator: " << m_Interpolator.GetPointer() << std::endl;
79 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
85 this->SetOutputSpacing( s );
89 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
95 this->SetOutputOrigin(p);
100 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
117 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
130 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
132 ::DeformationFieldType *
146 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
152 if( !m_Interpolator )
154 itkExceptionMacro(<<
"Interpolator not set");
158 m_Interpolator->SetInputImage( this->GetInput() );
166 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
179 ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
183 outputPtr, outputRegionForThread );
187 fieldPtr, outputRegionForThread );
194 while( !outputIt.IsAtEnd() )
197 index = outputIt.GetIndex();
198 outputPtr->TransformIndexToPhysicalPoint( index, point );
201 displacement = fieldIt.
Get();
204 for(
unsigned int j = 0; j < ImageDimension; j++ )
206 point[j] += displacement[j];
210 if( m_Interpolator->IsInsideBuffer( point ) )
213 const OutputType interpolatedValue = m_Interpolator->Evaluate( point );
215 for(
unsigned int k = 0; k < PixelDimension; k++ )
217 outputValue[k] =
static_cast<ValueType>( interpolatedValue[k] );
220 outputIt.Set( outputValue );
224 outputIt.Set( m_EdgePaddingValue );
228 progress.CompletedPixel();
234 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
241 Superclass::GenerateInputRequestedRegion();
249 inputPtr->SetRequestedRegionToLargestPossibleRegion();
258 fieldPtr->SetRequestedRegion( outputPtr->GetRequestedRegion() );
264 template <
class TInputImage,
class TOutputImage,
class TDeformationField>
270 Superclass::GenerateOutputInformation();
274 outputPtr->SetSpacing( m_OutputSpacing );
275 outputPtr->SetOrigin( m_OutputOrigin );
276 outputPtr->SetDirection( m_OutputDirection );
281 outputPtr->SetLargestPossibleRegion( fieldPtr->
282 GetLargestPossibleRegion() );