ITK  4.13.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_TEMPLATE_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;
57  typedef typename Superclass::TransformType TransformType;
58  typedef typename Superclass::SpatialObjectPointType SpatialObjectPointType;
62  typedef typename Superclass::CovariantVectorType CovariantVectorType;
63  typedef typename Superclass::BoundingBoxType BoundingBoxType;
64 
66  itkNewMacro(Self);
67 
70 
72  virtual PointListType & GetPoints();
73 
75  virtual const PointListType & GetPoints() const;
76 
78  virtual void SetPoints(PointListType & newPoints);
79 
81  virtual const SpatialObjectPointType * GetPoint(IdentifierType ind) const ITK_OVERRIDE
82  { return &( m_Points[ind] ); }
83 
85  virtual SpatialObjectPointType * GetPoint(IdentifierType ind) ITK_OVERRIDE
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 ITK_OVERRIDE
98  {
99  return static_cast<SizeValueType>(m_Points.size());
100  }
101 
103  itkSetMacro(EndType, unsigned int);
104  itkGetConstMacro(EndType, unsigned int);
106 
108  void Clear(void) ITK_OVERRIDE;
109 
111  bool ComputeTangentAndNormals();
112 
114  unsigned int RemoveDuplicatePoints(unsigned int step = 1);
115 
118  bool IsEvaluableAt(const PointType & point,
119  unsigned int depth = 0, char *name = ITK_NULLPTR) const ITK_OVERRIDE;
120 
125  bool ValueAt(const PointType & point, double & value,
126  unsigned int depth = 0, char *name = ITK_NULLPTR) const ITK_OVERRIDE;
127 
129  bool IsInside(const PointType & point,
130  unsigned int depth, char *name) const ITK_OVERRIDE;
131 
135  virtual bool IsInside(const PointType & point) const;
136 
138  bool ComputeLocalBoundingBox() const ITK_OVERRIDE;
139 
142  itkSetMacro(ParentPoint, int);
143  itkGetConstMacro(ParentPoint, int);
145 
148  itkSetMacro(Root, bool);
149  itkGetConstMacro(Root, bool);
151 
153  itkSetMacro(Artery, bool);
154  itkGetConstMacro(Artery, bool);
156 
158  void CopyInformation(const DataObject *data) ITK_OVERRIDE;
159 
160 protected:
161  PointListType m_Points;
162 
163  int m_ParentPoint;
164 
165  unsigned int m_EndType;
166 
167  bool m_Root;
168  bool m_Artery;
169 
171  virtual ~TubeSpatialObject() ITK_OVERRIDE;
172 
174  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
175 
177  mutable ModifiedTimeType m_OldMTime;
178  mutable ModifiedTimeType m_IndexToWorldTransformMTime;
179 
180 private:
181  ITK_DISALLOW_COPY_AND_ASSIGN(TubeSpatialObject);
182 };
183 } // end namespace itk
184 
185 #ifndef ITK_MANUAL_INSTANTIATION
186 #include "itkTubeSpatialObject.hxx"
187 #endif
188 
189 #endif // itkTubeSpatialObject_h
Superclass::VectorType VectorType
PointListType * PointListPointer
PointBasedSpatialObject< TDimension > Superclass
virtual SizeValueType GetNumberOfPoints(void) const override
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
This class serves as the base class for point-based spatial objects.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Superclass::BoundingBoxType BoundingBoxType
virtual void SetPoint(IdentifierType ind, const TubePointType &pnt)
Point used for a tube definition.
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
std::vector< TubePointType > PointListType
SmartPointer< const Self > ConstPointer
Superclass::SpatialObjectPointType SpatialObjectPointType
Superclass::PointType PointType
SmartPointer< PointContainerType > PointContainerPointer
VectorContainer< IdentifierType, PointType > PointContainerType
virtual void RemovePoint(IdentifierType ind)
Superclass::TransformType TransformType
Point used for spatial objets.
virtual const SpatialObjectPointType * GetPoint(IdentifierType ind) const override
Define a front-end to the STL &quot;vector&quot; container that conforms to the IndexedContainerInterface.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Representation of a tube based on the spatial object classes.
SmartPointer< Self > Pointer
Base class for all data objects in ITK.
virtual SpatialObjectPointType * GetPoint(IdentifierType ind) override
Superclass::CovariantVectorType CovariantVectorType