18 #ifndef __otbStreamingResampleImageFilter_txx
19 #define __otbStreamingResampleImageFilter_txx
28 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
33 m_DeformationFilter = DeformationFieldGeneratorType::New();
34 m_WarpFilter = WarpImageFilterType::New();
38 this->SetDeformationFieldSpacing(itk::NumericTraits<SpacingType>::Zero);
41 m_WarpFilter->SetDeformationField(m_DeformationFilter->GetOutput());
44 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
51 progress->SetMiniPipelineFilter(
this);
52 progress->RegisterInternalFilter(m_WarpFilter, 1.f);
54 m_WarpFilter->GraftOutput(this->GetOutput());
55 m_WarpFilter->Update();
56 this->GraftOutput(m_WarpFilter->GetOutput());
62 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
68 Superclass::GenerateOutputInformation();
70 typename OutputImageType::Pointer outputPtr = this->GetOutput();
72 outputPtr->SetSpacing( this->GetOutputSpacing() );
73 outputPtr->SetOrigin( this->GetOutputOrigin() );
75 typename OutputImageType::RegionType region;
76 region.SetSize( this->GetOutputSize() );
77 region.SetIndex(this->GetOutputStartIndex() );
79 outputPtr->SetLargestPossibleRegion(region);
82 if(this->GetDeformationFieldSpacing()== itk::NumericTraits<SpacingType>::Zero)
84 this->SetDeformationFieldSpacing(2.*this->GetOutputSpacing());
88 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
100 RegionType requestedRegion = outputPtr->GetRequestedRegion();
101 SizeType largestSize = outputPtr->GetLargestPossibleRegion().GetSize();
104 SizeType deformationFieldLargestSize;
106 for(
unsigned int dim = 0; dim < InputImageType::ImageDimension; ++dim)
114 deformationFieldLargestSize[dim] =
static_cast<unsigned int>(
115 vcl_ceil( largestSize[dim]*
116 vcl_abs(this->GetOutputSpacing()[dim] /
117 this->GetDeformationFieldSpacing()[dim]))) + 1;
119 m_DeformationFilter->SetOutputSize(deformationFieldLargestSize);
120 m_DeformationFilter->SetOutputIndex(this->GetOutputStartIndex());
123 m_WarpFilter->SetInput(inputPtr);
124 m_WarpFilter->GetOutput()->UpdateOutputInformation();
125 m_WarpFilter->GetOutput()->SetRequestedRegion(requestedRegion);
126 m_WarpFilter->GetOutput()->PropagateRequestedRegion();
133 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
138 this->SetOutputOrigin ( image->
GetOrigin() );
139 this->SetOutputSpacing ( image->
GetSpacing() );
145 template <
class TInputImage,
class TOutputImage,
class TInterpolatorPrecisionType>
150 Superclass::PrintSelf(os, indent);
151 os << indent <<
"OutputOrigin: " << this->GetOutputOrigin() << std::endl;
152 os << indent <<
"OutputSpacing: " << this->GetOutputSpacing() << std::endl;
153 os << indent <<
"OutputStartIndex: " << this->GetOutputStartIndex() << std::endl;
154 os << indent <<
"OutputSize: " << this->GetOutputSize() << std::endl;