Commit e00416f8 authored by Julien Michel's avatar Julien Michel

PERF: Optimize WarpImageFilter by avoiding refcount bouncing

parent 0a0765f1
......@@ -257,7 +257,7 @@ private:
/** This function should be in an interpolator but none of the ITK
* interpolators at this point handle edge conditions properly
*/
DisplacementType EvaluateDisplacementAtPhysicalPoint(const PointType &p);
DisplacementType EvaluateDisplacementAtPhysicalPoint(const PointType &p, const DisplacementFieldType *fieldPtr);
PixelType m_EdgePaddingValue;
SpacingType m_OutputSpacing;
......
......@@ -214,9 +214,8 @@ typename WarpImageFilter<TInputImage,
TOutputImage,
TDisplacementField>::DisplacementType
WarpImageFilter<TInputImage,TOutputImage,TDisplacementField>
::EvaluateDisplacementAtPhysicalPoint(const PointType &point)
::EvaluateDisplacementAtPhysicalPoint(const PointType &point, const DisplacementFieldType *fieldPtr)
{
DisplacementFieldPointer fieldPtr = this->GetDisplacementField();
itk::ContinuousIndex<double,ImageDimension> index;
fieldPtr->TransformPhysicalPointToContinuousIndex(point,index);
unsigned int dim; // index over dimension
......@@ -377,7 +376,7 @@ WarpImageFilter<TInputImage,TOutputImage,TDisplacementField>
index = outputIt.GetIndex();
outputPtr->TransformIndexToPhysicalPoint( index, point );
displacement = this->EvaluateDisplacementAtPhysicalPoint(point);
displacement = this->EvaluateDisplacementAtPhysicalPoint( point, fieldPtr );
// compute the required input image point
for(unsigned int j = 0; j < ImageDimension; j++ )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment