Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions
itk::PSMSurfaceNeighborhood< TImage > Class Template Reference

PSMSurfaceNeighborhood 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 PowerOfTwoPointTree to cache point and index values so that FindNeighborhoodPoints is somewhat optimized. PSMSurfaceNeighborhood adds the concept of distanes and neighbors in the surface tangent plane to the concept of PSMRegionNeighborhood, which has no knowledge of surfaces. More...

#include <itkPSMSurfaceNeighborhood.h>

+ Inheritance diagram for itk::PSMSurfaceNeighborhood< TImage >:
+ Collaboration diagram for itk::PSMSurfaceNeighborhood< TImage >:

Public Types

typedef TImage ImageType
 
typedef PSMSurfaceNeighborhood Self
 
typedef PSMRegionNeighborhood< TImage::ImageDimension > Superclass
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef WeakPointer< const SelfConstWeakPointer
 
typedef ImageType::PixelType NumericType
 
typedef Superclass::PointTreeType PointTreeType
 
typedef vnl_vector_fixed< NumericType, TImage::ImageDimension > GradientVectorType
 
typedef Superclass::PointType PointType
 
typedef Superclass::PointContainerType PointContainerType
 
typedef PSMImplicitSurfaceDomain< typename TImage::PixelType, Dimension > DomainType
 
typedef Superclass::PointVectorType PointVectorType
 
- Public Types inherited from itk::PSMRegionNeighborhood< TImage::ImageDimension >
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

 itkStaticConstMacro (Dimension, unsigned int, TImage::ImageDimension)
 
 itkNewMacro (Self)
 
 itkTypeMacro (PSMSurfaceNeighborhood, PSMRegionNeighborhood)
 
virtual PointVectorType FindNeighborhoodPointsWithWeights (const PointType &, std::vector< double > &, double) const
 
void PrintSelf (std::ostream &os, Indent indent) const
 
- Public Member Functions inherited from itk::PSMRegionNeighborhood< TImage::ImageDimension >
 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)
 
 itkSetObjectMacro (Domain, DomainType)
 
 itkGetConstObjectMacro (Domain, DomainType)
 

Additional Inherited Members

- Protected Types inherited from itk::PSMRegionNeighborhood< TImage::ImageDimension >
typedef PSMContainer< IteratorNodePair > IteratorMapType
 
- Protected Member Functions inherited from itk::PSMNeighborhood< VDimension >
void PrintSelf (std::ostream &os, Indent indent) const
 
- Protected Attributes inherited from itk::PSMRegionNeighborhood< TImage::ImageDimension >
PointTreeType::Pointer m_Tree
 
IteratorMapType::Pointer m_IteratorMap
 
unsigned int m_TreeLevels
 

Detailed Description

template<class TImage>
class itk::PSMSurfaceNeighborhood< TImage >

PSMSurfaceNeighborhood 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 PowerOfTwoPointTree to cache point and index values so that FindNeighborhoodPoints is somewhat optimized. PSMSurfaceNeighborhood adds the concept of distanes and neighbors in the surface tangent plane to the concept of PSMRegionNeighborhood, which has no knowledge of surfaces.

Author
Josh Cates

Definition at line 45 of file itkPSMSurfaceNeighborhood.h.

Member Typedef Documentation

template<class TImage>
typedef TImage itk::PSMSurfaceNeighborhood< TImage >::ImageType

Standard class typedefs

Definition at line 49 of file itkPSMSurfaceNeighborhood.h.

template<class TImage>
typedef Superclass::PointType itk::PSMSurfaceNeighborhood< TImage >::PointType

Inherited typedefs from parent class.

Definition at line 70 of file itkPSMSurfaceNeighborhood.h.

Member Function Documentation

template<class TImage >
PSMSurfaceNeighborhood< TImage >::PointVectorType itk::PSMSurfaceNeighborhood< TImage >::FindNeighborhoodPointsWithWeights ( const PointType center,
std::vector< double > &  weights,
double  radius 
) const
virtual

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

Reimplemented from itk::PSMNeighborhood< VDimension >.

Definition at line 27 of file itkPSMSurfaceNeighborhood.hxx.

29 {
30  const DomainType *domain = dynamic_cast<const DomainType *>(this->GetDomain());
31  GradientVectorType posnormal = domain->SampleNormalVnl(center, 1.0e-10);
32  // double posnormalmag = posnormal.magnitude();
33  weights.clear();
34 
35  // Compute bounding box of the given hypersphere.
36  PointType l, u;
37  for (unsigned int i = 0; i < Dimension; i++)
38  {
39  l[i] = center[i] - radius;
40  u[i] = center[i] + radius;
41  }
42 
43  // Grab the list of points in this bounding box.
44  typename PointTreeType::PointIteratorListType pointlist
45  = Superclass::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  weights.reserve(pointlist.size());
51 
52  std::vector<double> vec_dist;
53  std::vector<double> vec_cos;
54 
55  // Add any point whose distance from center is less than radius to the return
56  // list.
57  // double vmax = radius;
58  for (typename PointTreeType::PointIteratorListType::const_iterator it = pointlist.begin();
59  it != pointlist.end(); it++)
60  {
61  // double dist = this->GetDomain()->Distance(center, (*it)->Point);
62  double sum = 0.0;
63  for (unsigned int i = 0; i < Dimension; i++)
64  {
65  double q = center[i] - (*it)->Point[i];
66  sum += q*q;
67  }
68  sum = sqrt(sum);
69 
70  if ( sum < radius && sum > 0.0 )
71  {
72  GradientVectorType pn = domain->SampleNormalVnl((*it)->Point, 1.0e-10);
73  double cosine = dot_product(posnormal,pn); // normals already normalized
74  // double cosine = proj / (posnormalmag * pn.magnitude() + 1.0e-6);
75 
76  // double dist =
77 
78 
79  if ( cosine >= m_FlatCutoff)
80  {
81  // Determine distance to tangent plane by projecting the point onto the
82  // normal.
83  weights.push_back(1.0);
84 
85  }
86  else
87  {
88  // Drop to zero influence over 90 degrees.
89  weights.push_back(cos((m_FlatCutoff - cosine) / (1.0+m_FlatCutoff) * 1.5708));
90 
91  // More quickly drop to zero influence
92  // weights.push_back( exp((cosine - m_FlatCutoff) / (1.0 + m_FlatCutoff) * 4.0) );
93 
94  // vmax = dist;
95  }
96 
97  ret.push_back( **it );
98  }
99 
100  }
101 
102  return ret;
103 }
template<class TImage>
itk::PSMSurfaceNeighborhood< TImage >::itkNewMacro ( Self  )

Method for creation through the object factory.

template<class TImage>
itk::PSMSurfaceNeighborhood< TImage >::itkStaticConstMacro ( Dimension  ,
unsigned  int,
TImage::ImageDimension   
)

Expose the image dimension.

template<class TImage>
itk::PSMSurfaceNeighborhood< TImage >::itkTypeMacro ( PSMSurfaceNeighborhood< TImage >  ,
PSMRegionNeighborhood   
)

Run-time type information (and related methods).


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