17 #ifndef __itkNeighborhoodIterator_txx
18 #define __itkNeighborhoodIterator_txx
21 template<
class TImage,
class TBoundaryCondition>
26 register unsigned int i;
27 OffsetType OverlapLow, OverlapHigh, temp, offset;
30 if (this->m_NeedToUseBoundaryCondition ==
false)
31 { this->m_NeighborhoodAccessorFunctor.Set( this->
operator[](n), v ); }
34 else if (this->InBounds()) this->m_NeighborhoodAccessorFunctor.Set( this->
operator[](n), v );
37 temp = this->ComputeInternalIndex(n);
40 for (i=0; i<Superclass::Dimension; i++)
42 OverlapLow[i] = this->m_InnerBoundsLow[i] - this->m_Loop[i];
45 - ( (this->m_Loop[i]+2) - this->m_InnerBoundsHigh[i]) );
51 for (i=0; i<Superclass::Dimension; ++i)
53 if (this->m_InBounds[i]) offset[i] = 0;
56 if (temp[i] < OverlapLow[i])
59 offset[i] = OverlapLow[i] - temp[i];
61 else if ( OverlapHigh[i] < temp[i] )
64 offset[i] = OverlapHigh[i] - temp[i];
72 this->m_NeighborhoodAccessorFunctor.Set( this->
operator[](n), v );
84 template<
class TImage,
class TBoundaryCondition>
89 register unsigned int i;
94 if (this->m_NeedToUseBoundaryCondition ==
false)
97 this->m_NeighborhoodAccessorFunctor.Set( this->
operator[](n), v );
101 else if (this->InBounds())
103 this->m_NeighborhoodAccessorFunctor.Set( this->
operator[](n), v );
109 temp = this->ComputeInternalIndex(n);
115 for (i=0; i<Superclass::Dimension; i++)
117 if (! this->m_InBounds[i])
119 OverlapLow = this->m_InnerBoundsLow[i] - this->m_Loop[i];
122 - ( (this->m_Loop[i]+2) - this->m_InnerBoundsHigh[i]) );
123 if (temp[i] < OverlapLow || OverlapHigh < temp[i])
131 this->m_NeighborhoodAccessorFunctor.Set( this->
operator[](n), v );
137 template<
class TImage,
class TBoundaryCondition>
143 os <<
"NeighborhoodIterator {this= " <<
this <<
"}" << std::endl;
144 Superclass::PrintSelf(os, indent.GetNextIndent());
147 template<
class TImage,
class TBoundaryCondition>
152 register unsigned int i;
160 if (this->m_NeedToUseBoundaryCondition ==
false)
162 for (N_it = N.
Begin(), this_it = this->Begin(); this_it < _end;
165 this->m_NeighborhoodAccessorFunctor.Set(*this_it, *N_it);
168 else if (this->InBounds())
170 for (N_it = N.
Begin(), this_it = this->Begin(); this_it < _end;
173 this->m_NeighborhoodAccessorFunctor.Set(*this_it, *N_it);
179 for (i=0; i<Superclass::Dimension; i++)
181 OverlapLow[i] =this->m_InnerBoundsLow[i] - this->m_Loop[i];
183 static_cast<OffsetValueType>(this->GetSize(i) - (this->m_Loop[i]-this->m_InnerBoundsHigh[i])-1);
188 for (N_it = N.
Begin(), this_it = this->Begin();
189 this_it < _end; N_it++, this_it++)
192 for (i=0; i<Superclass::Dimension; ++i)
194 if (!this->m_InBounds[i] && ((temp[i] < OverlapLow[i])
195 || (temp[i] >= OverlapHigh[i])) )
204 this->m_NeighborhoodAccessorFunctor.Set(*this_it, *N_it);
207 for (i=0; i<Superclass::Dimension; ++i)
210 if ( (
unsigned int)(temp[i]) == this->GetSize(i) ) temp[i]= 0;