ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkContourSpatialObject.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 itkContourSpatialObject_h
19 #define itkContourSpatialObject_h
20 
21 #include <list>
22 
25 
26 namespace itk
27 {
38 template< unsigned int TDimension = 3 >
39 class ITK_TEMPLATE_EXPORT ContourSpatialObject:
40  public PointBasedSpatialObject< TDimension >
41 {
42 public:
43 
48  typedef double ScalarType;
51  typedef std::vector< ControlPointType > ControlPointListType;
52  typedef std::vector< InterpolatedPointType > InterpolatedPointListType;
53 
54  typedef typename Superclass::SpatialObjectPointType SpatialObjectPointType;
55  typedef typename Superclass::PointType PointType;
56  typedef typename Superclass::TransformType TransformType;
57  typedef typename Superclass::BoundingBoxType BoundingBoxType;
60 
62  itkNewMacro(Self);
63 
66 
68  ControlPointListType & GetControlPoints();
69 
71  const ControlPointListType & GetControlPoints() const;
72 
74  void SetControlPoints(ControlPointListType & newPoints);
75 
78  { return &( m_ControlPoints[id] ); }
79 
82  { return &( m_ControlPoints[id] ); }
83 
86  { return static_cast<SizeValueType>( m_ControlPoints.size() ); }
87 
89  InterpolatedPointListType & GetInterpolatedPoints();
90 
92  const InterpolatedPointListType & GetInterpolatedPoints() const;
93 
95  void SetInterpolatedPoints(InterpolatedPointListType & newPoints);
96 
99  { return &( m_InterpolatedPoints[id] ); }
100 
103  { return &( m_InterpolatedPoints[id] ); }
104 
107  { return static_cast<SizeValueType>( m_InterpolatedPoints.size() ); }
108 
109  enum InterpolationType { NO_INTERPOLATION = 0,
110  EXPLICIT_INTERPOLATION, BEZIER_INTERPOLATION,
111  LINEAR_INTERPOLATION };
112 
115  { return m_InterpolationType; }
117  { m_InterpolationType = interpolation; }
119 
121  itkSetMacro(Closed, bool);
122  itkGetConstMacro(Closed, bool);
124 
126  itkSetMacro(DisplayOrientation, int);
127  itkGetConstMacro(DisplayOrientation, int);
129 
132  itkSetMacro(AttachedToSlice, int);
133  itkGetConstMacro(AttachedToSlice, int);
135 
141  bool IsEvaluableAt(const PointType & point,
142  unsigned int depth = 0, char *name = ITK_NULLPTR) const ITK_OVERRIDE;
143 
148  bool ValueAt(const PointType & point, double & value,
149  unsigned int depth = 0, char *name = ITK_NULLPTR) const ITK_OVERRIDE;
150 
152  bool IsInside(const PointType & point,
153  unsigned int depth, char *name) const ITK_OVERRIDE;
154 
158  virtual bool IsInside(const PointType & point) const;
159 
161  bool ComputeLocalBoundingBox(void) const ITK_OVERRIDE;
162 
163 protected:
164  ITK_DISALLOW_COPY_AND_ASSIGN(ContourSpatialObject);
165 
166  ControlPointListType m_ControlPoints;
167  InterpolatedPointListType m_InterpolatedPoints;
168  InterpolationType m_InterpolationType;
169  bool m_Closed;
170  int m_DisplayOrientation;
171  int m_AttachedToSlice;
172 
173  ContourSpatialObject();
174  virtual ~ContourSpatialObject() ITK_OVERRIDE;
175 
177  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
178 };
179 } // end namespace itk
180 
181 #ifndef ITK_MANUAL_INSTANTIATION
182 #include "itkContourSpatialObject.hxx"
183 #endif
184 
185 #endif // itkContourSpatialObject_h
Representation of a Contour based on the spatial object classes.
SmartPointer< PointContainerType > PointContainerPointer
SmartPointer< const Self > ConstPointer
Superclass::PointType PointType
void SetInterpolationType(InterpolationType interpolation)
Superclass::TransformType TransformType
const InterpolatedPointType * GetInterpolatedPoint(IdentifierType id) const
VectorContainer< IdentifierType, PointType > PointContainerType
This class serves as the base class for point-based spatial objects.
InterpolationType GetInterpolationType() const
InterpolatedPointType * GetInterpolatedPoint(IdentifierType id)
unsigned long SizeValueType
Definition: itkIntTypes.h:143
std::vector< ControlPointType > ControlPointListType
Point used for a Contour definition.
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
Superclass::BoundingBoxType BoundingBoxType
SizeValueType GetNumberOfInterpolatedPoints(void) const
PointBasedSpatialObject< TDimension > Superclass
SpatialObjectPoint< TDimension > InterpolatedPointType
SizeValueType GetNumberOfControlPoints(void) const
const ControlPointType * GetControlPoint(IdentifierType id) const
Point used for spatial objets.
Define a front-end to the STL &quot;vector&quot; container that conforms to the IndexedContainerInterface.
ContourSpatialObjectPoint< TDimension > ControlPointType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
std::vector< InterpolatedPointType > InterpolatedPointListType
Superclass::SpatialObjectPointType SpatialObjectPointType
ControlPointType * GetControlPoint(IdentifierType id)
Base class for all data objects in ITK.