Shapeworks Studio  2.1
Shape analysis software suite
itkPSMRegionNeighborhood.h
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkPSMRegionNeighborhood_h
19 #define __itkPSMRegionNeighborhood_h
20 
21 #include "itkPSMNeighborhood.h"
22 #include "itkPSMPointTree.h"
23 
24 namespace itk
25 {
34 template <unsigned int VDimension>
35 class ITK_EXPORT PSMRegionNeighborhood : public PSMNeighborhood<VDimension>
36 {
37 public:
40  typedef PSMNeighborhood<VDimension> Superclass;
41  typedef SmartPointer<Self> Pointer;
42  typedef SmartPointer<const Self> ConstPointer;
43  typedef WeakPointer<const Self> ConstWeakPointer;
44 
46  itkNewMacro(Self);
47 
50 
52  itkStaticConstMacro(Dimension, unsigned int, VDimension);
53 
55  typedef typename Superclass::PointType PointType;
56  typedef typename Superclass::PointContainerType PointContainerType;
57  typedef typename Superclass::DomainType DomainType;
58  typedef typename Superclass::PointVectorType PointVectorType;
59 
62 
66  virtual PointVectorType FindNeighborhoodPoints(const PointType &, double) const;
67 
70  virtual void SetDomain( DomainType *p);
71 
73  itkSetMacro(TreeLevels, unsigned int);
74  itkGetMacro(TreeLevels, unsigned int);
75 
76  void PrintSelf(std::ostream& os, Indent indent) const
77  {
78  os << indent << "m_TreeLevels = " << m_TreeLevels << std::endl;
79  m_Tree->PrintSelf(os, indent);
80  Superclass::PrintSelf(os, indent);
81  }
82 
88  void AddPosition(const PointType &p, unsigned int idx, int threadId = 0);
89  void SetPosition(const PointType &p, unsigned int idx, int threadId = 0);
90  void RemovePosition(unsigned int idx, int threadId = 0);
91 
92 protected:
93  PSMRegionNeighborhood() : m_TreeLevels(3)
94  {
95  m_Tree = PointTreeType::New();
96  m_IteratorMap = IteratorMapType::New();
97  }
98  virtual ~PSMRegionNeighborhood() {};
99 
104  {
105  typedef typename PointTreeType::NodePointerType NodePointerType;
106  typedef typename PointTreeType::PointListType::iterator IteratorType;
107 
108  IteratorNodePair() {}
109  ~IteratorNodePair() {}
110  IteratorNodePair(const IteratorType &p, const NodePointerType &n)
111  {
112  Iterator = p;
113  NodePointer = n;
114  }
115 
117  { this->operator=(o); }
118  const IteratorNodePair &operator=(const IteratorNodePair &o)
119  {
120  Iterator = o.Iterator;
121  NodePointer = o.NodePointer;
122  return *this;
123  }
124 
125  IteratorType Iterator;
126  NodePointerType NodePointer;
127  };
128 
130 
131 protected:
132  typename PointTreeType::Pointer m_Tree;
133  typename IteratorMapType::Pointer m_IteratorMap;
134  unsigned int m_TreeLevels;
135 
136 
137 private:
138  PSMRegionNeighborhood(const Self&); //purposely not implemented
139  void operator=(const Self&); //purposely not implemented
140 
141 };
142 
143 } // end namespace itk
144 
145 #ifndef ITK_MANUAL_INSTANTIATION
146 #include "itkPSMRegionNeighborhood.hxx"
147 #endif
148 
149 #endif
NodeType::Pointer NodePointerType
Base class for defining the domain in which a particle system exists.
Definition: itkPSMDomain.h:48
std::vector< PSMPointIndexPair< VDimension > > PointVectorType
A container class that holds particle position information for the PSMParticleSystem class...
PSMPointTree< VDimension > PointTreeType