18 #ifndef __itkPSMRegionNeighborhood_hxx 19 #define __itkPSMRegionNeighborhood_hxx 20 #include "itkPSMRegionNeighborhood.h" 24 template<
unsigned int VDimension>
27 Superclass::SetDomain(d);
28 m_Tree->ConstructTree(d->
GetLowerBound(), d->GetUpperBound(), m_TreeLevels);
31 template <
unsigned int VDimension>
32 typename PSMRegionNeighborhood<VDimension>::PointVectorType
38 for (
unsigned int i = 0; i < VDimension; i++)
40 l[i] = center[i] - radius;
41 u[i] = center[i] + radius;
45 typename PointTreeType::PointIteratorListType pointlist = m_Tree->FindPointsInRegion(l, u);
49 ret.reserve(pointlist.size());
53 for (
typename PointTreeType::PointIteratorListType::const_iterator it = pointlist.begin();
54 it != pointlist.end(); it++)
58 for (
unsigned int i = 0; i < VDimension; i++)
60 double q = center[i] - (*it)->Point[i];
65 if ( sum < radius && sum >0 )
67 ret.push_back( **it );
74 template <
unsigned int VDimension>
81 typename IteratorNodePair::IteratorType it;
82 typename IteratorNodePair::NodePointerType node;
83 it = m_Tree->AddPoint(p, idx, node);
88 template <
unsigned int VDimension>
96 for (
unsigned int i = 0; i < VDimension; i++)
98 if (p[i] < pr.NodePointer->GetLowerBound()[i] || p[i] > pr.NodePointer->GetUpperBound()[i])
100 this->RemovePosition(idx, threadId);
101 this->AddPosition(p, idx, threadId);
107 pr.Iterator->Point = p;
110 template <
unsigned int VDimension>
115 m_IteratorMap->Erase(idx);
116 pr.NodePointer->GetList().erase(pr.Iterator);
void AddPosition(const PointType &p, unsigned int idx, int threadId=0)
Base class for defining the domain in which a particle system exists.
virtual void SetDomain(DomainType *p)
std::vector< PSMPointIndexPair< VDimension > > PointVectorType
virtual const PointType & GetLowerBound() const
virtual PointVectorType FindNeighborhoodPoints(const PointType &, double) const