Skip to content
Snippets Groups Projects
Commit 37d24881 authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH : initialize the deformation field spacing in the streaming resample

parent 368a80f3
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,10 @@ StreamingResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionTy
m_DeformationFilter = DeformationFieldGeneratorType::New();
m_WarpFilter = WarpImageFilterType::New();
// Initialize the deformation field spacing to zero : inconsistant
// value
this->SetDeformationFieldSpacing(itk::NumericTraits<SpacingType>::Zero);
// Wire minipipeline
m_WarpFilter->SetDeformationField(m_DeformationFilter->GetOutput());
}
......@@ -65,6 +69,12 @@ StreamingResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionTy
region.SetIndex(this->GetOutputStartIndex() );
outputPtr->SetLargestPossibleRegion(region);
// check the output spacing of the deformation field
if(this->GetDeformationFieldSpacing()== itk::NumericTraits<SpacingType>::Zero)
{
this->SetDeformationFieldSpacing(2.*this->GetOutputSpacing());
}
}
template <class TInputImage, class TOutputImage, class TInterpolatorPrecisionType>
......
......@@ -43,10 +43,6 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage>
m_InputRpcEstimator = InputRpcModelEstimatorType::New();
m_OutputRpcEstimator= OutputRpcModelEstimatorType::New();
m_Transform = GenericRSTransformType::New();
// Initialize the deformation field spacing to zero : inconsistant
// value
this->SetDeformationFieldSpacing(itk::NumericTraits<SpacingType>::Zero);
}
template <class TInputImage, class TOutputImage>
......@@ -54,11 +50,6 @@ void
GenericRSResampleImageFilter<TInputImage, TOutputImage>
::GenerateData()
{
// check the output spacing of the deformation field
// if 0 put an initial value
if(this->GetDeformationFieldSpacing() == itk::NumericTraits<SpacingType>::Zero )
this->SetDeformationFieldSpacing(2.*this->GetOutputSpacing());
m_Resampler->GraftOutput(this->GetOutput());
m_Resampler->Update();
this->GraftOutput(m_Resampler->GetOutput());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment