Skip to content

Commit 8f5c91b

Browse files
committed
BUG: Boundary condition was not propagated to FFTPad
1 parent b044756 commit 8f5c91b

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

include/itkFFTPadPositiveIndexImageFilter.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,17 @@ class FFTPadPositiveIndexImageFilter:
9191
itkGetConstMacro(SizeGreatestPrimeFactor, SizeValueType);
9292
itkSetMacro(SizeGreatestPrimeFactor, SizeValueType);
9393
/** Set/get the boundary condition. */
94-
itkSetMacro(BoundaryCondition, BoundaryConditionPointerType);
9594
itkGetConstMacro(BoundaryCondition, BoundaryConditionPointerType);
95+
virtual void SetBoundaryCondition(const BoundaryConditionPointerType boundaryCondition)
96+
{
97+
if ( this->m_BoundaryCondition != boundaryCondition )
98+
{
99+
this->m_BoundaryCondition = boundaryCondition;
100+
this->m_FFTPadFilter->SetBoundaryCondition(this->m_BoundaryCondition);
101+
this->m_FFTPadFilter->Modified();
102+
this->Modified();
103+
}
104+
}
96105

97106
protected:
98107
FFTPadPositiveIndexImageFilter();

include/itkFFTPadPositiveIndexImageFilter.hxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,20 @@ FFTPadPositiveIndexImageFilter< TInputImage, TOutputImage >
5353
const typename OutputImageType::RegionType & outputRequestedRegion =
5454
outputPtr->GetRequestedRegion();
5555

56+
typename OutputImageType::RegionType shiftedOutputRequestedRegion;
57+
typename OutputImageType::RegionType::IndexType shiftedRequestedIndex =
58+
outputRequestedRegion.GetIndex() - this->m_ChangeInfoFilter->GetOutputOffset();
59+
shiftedOutputRequestedRegion.SetIndex(shiftedRequestedIndex);
60+
shiftedOutputRequestedRegion.SetSize(outputRequestedRegion.GetSize());
61+
5662
// Ask the boundary condition for the input requested region.
5763
if ( !m_BoundaryCondition )
5864
{
5965
itkExceptionMacro( << "Boundary condition is ITK_NULLPTR so no request region can be generated.");
6066
}
6167
typename InputImageType::RegionType inputRequestedRegion =
6268
m_BoundaryCondition->GetInputRequestedRegion( inputLargestPossibleRegion,
63-
outputRequestedRegion );
69+
shiftedOutputRequestedRegion );
6470

6571
inputPtr->SetRequestedRegion( inputRequestedRegion );
6672
}

0 commit comments

Comments
 (0)