Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes
itk::PSMRegionNeighborhood< VDimension > Class Template Reference

#include <itkPSMRegionNeighborhood.h>

+ Inheritance diagram for itk::PSMRegionNeighborhood< VDimension >:
+ Collaboration diagram for itk::PSMRegionNeighborhood< VDimension >:

Classes

struct  IteratorNodePair
 

Public Types

typedef PSMRegionNeighborhood Self
 
typedef PSMNeighborhood< VDimension > Superclass
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef WeakPointer< const SelfConstWeakPointer
 
typedef Superclass::PointType PointType
 
typedef Superclass::PointContainerType PointContainerType
 
typedef Superclass::DomainType DomainType
 
typedef Superclass::PointVectorType PointVectorType
 
typedef PSMPointTree< VDimension > PointTreeType
 
- Public Types inherited from itk::PSMNeighborhood< VDimension >
typedef PSMNeighborhood Self
 
typedef DataObject Superclass
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef WeakPointer< const SelfConstWeakPointer
 
typedef Point< double, VDimension > PointType
 
typedef PSMDomain< VDimension > DomainType
 
typedef PSMContainer< PointTypePointContainerType
 
typedef std::vector< PSMPointIndexPair< VDimension > > PointVectorType
 

Public Member Functions

 itkNewMacro (Self)
 
 itkTypeMacro (PSMRegionNeighborhood, PSMNeighborhood)
 
 itkStaticConstMacro (Dimension, unsigned int, VDimension)
 
virtual PointVectorType FindNeighborhoodPoints (const PointType &, double) const
 
virtual void SetDomain (DomainType *p)
 
 itkSetMacro (TreeLevels, unsigned int)
 
 itkGetMacro (TreeLevels, unsigned int)
 
void PrintSelf (std::ostream &os, Indent indent) const
 
void AddPosition (const PointType &p, unsigned int idx, int threadId=0)
 
void SetPosition (const PointType &p, unsigned int idx, int threadId=0)
 
void RemovePosition (unsigned int idx, int threadId=0)
 
- Public Member Functions inherited from itk::PSMNeighborhood< VDimension >
 itkNewMacro (Self)
 
 itkTypeMacro (PSMNeighborhood, DataObject)
 
 itkStaticConstMacro (Dimension, unsigned int, VDimension)
 
 itkSetObjectMacro (PointContainer, PointContainerType)
 
 itkGetConstObjectMacro (PointContainer, PointContainerType)
 
virtual PointVectorType FindNeighborhoodPointsWithWeights (const PointType &, std::vector< double > &, double) const
 
 itkSetObjectMacro (Domain, DomainType)
 
 itkGetConstObjectMacro (Domain, DomainType)
 

Protected Types

typedef PSMContainer< IteratorNodePairIteratorMapType
 

Protected Attributes

PointTreeType::Pointer m_Tree
 
IteratorMapType::Pointer m_IteratorMap
 
unsigned int m_TreeLevels
 

Additional Inherited Members

- Protected Member Functions inherited from itk::PSMNeighborhood< VDimension >
void PrintSelf (std::ostream &os, Indent indent) const
 

Detailed Description

template<unsigned int VDimension>
class itk::PSMRegionNeighborhood< VDimension >

PSMRegionNeighborhood is a general purpose neighborhood object that computes neighborhoods based on distance from a point. It requires a domain that provides bounds information and a distance metric. This class uses a PSMPointTree to cache point and index values so that FindNeighborhoodPoints is somewhat optimized.

Definition at line 35 of file itkPSMRegionNeighborhood.h.

Member Typedef Documentation

template<unsigned int VDimension>
typedef PSMPointTree<VDimension> itk::PSMRegionNeighborhood< VDimension >::PointTreeType

PSMTree type used to sort points according to location.

Definition at line 61 of file itkPSMRegionNeighborhood.h.

template<unsigned int VDimension>
typedef Superclass::PointType itk::PSMRegionNeighborhood< VDimension >::PointType

Inherited typedefs from parent class.

Definition at line 55 of file itkPSMRegionNeighborhood.h.

template<unsigned int VDimension>
typedef PSMRegionNeighborhood itk::PSMRegionNeighborhood< VDimension >::Self

Standard class typedefs

Definition at line 39 of file itkPSMRegionNeighborhood.h.

Member Function Documentation

template<unsigned int VDimension>
void itk::PSMRegionNeighborhood< VDimension >::AddPosition ( const PointType p,
unsigned int  idx,
int  threadId = 0 
)
virtual

For efficiency, itkNeighborhoods are not necessarily observers of itkPSMParticleSystem, but have specific methods invoked for various events. AddPosition is called by itkPSMParticleSystem when a particle location is added. SetPosition is called when a particle location is set. RemovePosition is called when a particle location is removed.

Reimplemented from itk::PSMNeighborhood< VDimension >.

Definition at line 76 of file itkPSMRegionNeighborhood.hxx.

77 {
78  // Cache this point and index into the tree. AddPoint returns a pointer
79  // to the cached values and the node in which the point resides. This info
80  // is saved for efficient moves and deletes.
81  typename IteratorNodePair::IteratorType it;
82  typename IteratorNodePair::NodePointerType node;
83  it = m_Tree->AddPoint(p, idx, node);
84 
85  m_IteratorMap->operator[](idx) = IteratorNodePair(it, node);
86 }
template<unsigned int VDimension>
PSMRegionNeighborhood< VDimension >::PointVectorType itk::PSMRegionNeighborhood< VDimension >::FindNeighborhoodPoints ( const PointType center,
double  radius 
) const
virtual

Compile a list of points that are within a specified radius of a given point. This implementation uses a PSMTree to sort points according to location.

Reimplemented from itk::PSMNeighborhood< VDimension >.

Definition at line 34 of file itkPSMRegionNeighborhood.hxx.

35 {
36  // Compute bounding box of the given hypersphere.
37  PointType l, u;
38  for (unsigned int i = 0; i < VDimension; i++)
39  {
40  l[i] = center[i] - radius;
41  u[i] = center[i] + radius;
42  }
43 
44  // Grab the list of points in this bounding box.
45  typename PointTreeType::PointIteratorListType pointlist = m_Tree->FindPointsInRegion(l, u);
46 
47  // Allocate return vector. Reserve ensures no extra copies occur.
48  PointVectorType ret;
49  ret.reserve(pointlist.size());
50 
51  // Add any point whose distance from center is less than radius to the return
52  // list.
53  for (typename PointTreeType::PointIteratorListType::const_iterator it = pointlist.begin();
54  it != pointlist.end(); it++)
55  {
56  // double dist = this->GetDomain()->Distance(center, (*it)->Point);
57  double sum = 0.0;
58  for (unsigned int i = 0; i < VDimension; i++)
59  {
60  double q = center[i] - (*it)->Point[i];
61  sum += q*q;
62  }
63  sum = sqrt(sum);
64 
65  if ( sum < radius && sum >0 )
66  {
67  ret.push_back( **it );
68  }
69  }
70 
71  return ret;
72 }
template<unsigned int VDimension>
itk::PSMRegionNeighborhood< VDimension >::itkNewMacro ( Self  )

Method for creation through the object factory.

template<unsigned int VDimension>
itk::PSMRegionNeighborhood< VDimension >::itkSetMacro ( TreeLevels  ,
unsigned  int 
)

Set/Get the number of levels in the sorting tree.

template<unsigned int VDimension>
itk::PSMRegionNeighborhood< VDimension >::itkStaticConstMacro ( Dimension  ,
unsigned  int,
VDimension   
)

Dimensionality of the domain of the particle system.

template<unsigned int VDimension>
itk::PSMRegionNeighborhood< VDimension >::itkTypeMacro ( PSMRegionNeighborhood< VDimension >  ,
PSMNeighborhood   
)

Run-time type information (and related methods).

template<unsigned int VDimension>
void itk::PSMRegionNeighborhood< VDimension >::SetDomain ( DomainType p)
virtual

Override SetDomain so that we can grab the region extent info and construct our tree.

Definition at line 25 of file itkPSMRegionNeighborhood.hxx.

26 {
27  Superclass::SetDomain(d);
28  m_Tree->ConstructTree(d->GetLowerBound(), d->GetUpperBound(), m_TreeLevels);
29 }

The documentation for this class was generated from the following files: