ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkTubeSpatialObject.h
Go to the documentation of this file.
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 __itkTubeSpatialObject_h
19 #define __itkTubeSpatialObject_h
20 
21 #include <list>
22 
25 
26 namespace itk
27 {
41 template< unsigned int TDimension = 3,
42  typename TTubePointType = TubeSpatialObjectPoint< TDimension > >
43 class ITK_EXPORT TubeSpatialObject:
44  public PointBasedSpatialObject< TDimension >
45 {
46 public:
47 
52  typedef double ScalarType;
53  typedef TTubePointType TubePointType;
54  typedef std::vector< TubePointType > PointListType;
56  typedef typename Superclass::PointType PointType;
58  typedef typename Superclass::SpatialObjectPointType SpatialObjectPointType;
61  typedef typename Superclass::VectorType VectorType;
62  typedef typename Superclass::CovariantVectorType CovariantVectorType;
63  typedef typename Superclass::BoundingBoxType BoundingBoxType;
64 
66  itkNewMacro(Self);
67 
70 
72  virtual PointListType & GetPoints(void);
73 
75  virtual const PointListType & GetPoints(void) const;
76 
78  virtual void SetPoints(PointListType & newPoints);
79 
81  virtual const SpatialObjectPointType * GetPoint(IdentifierType ind) const
82  { return &( m_Points[ind] ); }
83 
85  virtual SpatialObjectPointType * GetPoint(IdentifierType ind)
86  { return &( m_Points[ind] ); }
87 
89  virtual void SetPoint(IdentifierType ind, const TubePointType & pnt)
90  { m_Points[ind] = pnt; }
91 
93  virtual void RemovePoint(IdentifierType ind)
94  { m_Points.erase(m_Points.begin() + ind); }
95 
97  virtual SizeValueType GetNumberOfPoints(void) const
98  { return m_Points.size(); }
99 
101  itkSetMacro(EndType, unsigned int);
102  itkGetConstMacro(EndType, unsigned int);
104 
106  void Clear(void);
107 
109  bool ComputeTangentAndNormals(void);
110 
112  unsigned int RemoveDuplicatePoints(unsigned int step = 1);
113 
116  bool IsEvaluableAt(const PointType & point,
117  unsigned int depth = 0, char *name = NULL) const;
118 
123  bool ValueAt(const PointType & point, double & value,
124  unsigned int depth = 0, char *name = NULL) const;
125 
127  bool IsInside(const PointType & point,
128  unsigned int depth, char *name) const;
129 
133  virtual bool IsInside(const PointType & point) const;
134 
136  bool ComputeLocalBoundingBox() const;
137 
140  itkSetMacro(ParentPoint, int);
141  itkGetConstMacro(ParentPoint, int);
143 
146  itkSetMacro(Root, bool);
147  itkGetConstMacro(Root, bool);
149 
151  itkSetMacro(Artery, bool);
152  itkGetConstMacro(Artery, bool);
154 
156  void CopyInformation(const DataObject *data);
157 
158 protected:
160 
162 
163  unsigned int m_EndType;
164 
165  bool m_Root;
166  bool m_Artery;
167 
169  virtual ~TubeSpatialObject();
170 
172  virtual void PrintSelf(std::ostream & os, Indent indent) const;
173 
175  mutable unsigned long m_OldMTime;
176  mutable unsigned long m_IndexToWorldTransformMTime;
177 private:
178  TubeSpatialObject(const Self &); //purposely not implemented
179  void operator=(const Self &); //purposely not implemented
180 };
181 } // end namespace itk
183 
184 #ifndef ITK_MANUAL_INSTANTIATION
185 #include "itkTubeSpatialObject.hxx"
186 #endif
187 
188 #endif // __itkTubeSpatialObject_h
189