ITK  4.2.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_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;
57  typedef typename Superclass::BoundingBoxType BoundingBoxType;
60 
62  itkNewMacro(Self);
63 
66 
68  ControlPointListType & GetControlPoints(void);
69 
71  const ControlPointListType & GetControlPoints(void) const;
72 
74  void SetControlPoints(ControlPointListType & newPoints);
75 
77  const ControlPointType * GetControlPoint(IdentifierType id) const
78  { return &( m_ControlPoints[id] ); }
79 
81  ControlPointType * GetControlPoint(IdentifierType id)
82  { return &( m_ControlPoints[id] ); }
83 
85  SizeValueType GetNumberOfControlPoints(void) const
86  { return m_ControlPoints.size(); }
87 
89  InterpolatedPointListType & GetInterpolatedPoints(void);
90 
92  const InterpolatedPointListType & GetInterpolatedPoints(void) const;
93 
95  void SetInterpolatedPoints(InterpolatedPointListType & newPoints);
96 
98  const InterpolatedPointType * GetInterpolatedPoint(IdentifierType id) const
99  { return &( m_InterpolatedPoints[id] ); }
100 
102  InterpolatedPointType * GetInterpolatedPoint(IdentifierType id)
103  { return &( m_InterpolatedPoints[id] ); }
104 
106  SizeValueType GetNumberOfInterpolatedPoints(void) const
107  { return m_InterpolatedPoints.size(); }
108 
109  enum InterpolationType { NO_INTERPOLATION = 0,
110  EXPLICIT_INTERPOLATION, BEZIER_INTERPOLATION,
111  LINEAR_INTERPOLATION };
112 
114  InterpolationType GetInterpolationType() const
115  { return m_InterpolationType; }
116  void SetInterpolationType(InterpolationType interpolation)
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 = NULL) const;
143 
148  bool ValueAt(const PointType & point, double & value,
149  unsigned int depth = 0, char *name = NULL) const;
150 
152  bool IsInside(const PointType & point,
153  unsigned int depth, char *name) const;
154 
158  virtual bool IsInside(const PointType & point) const;
159 
161  bool ComputeLocalBoundingBox(void) const;
162 
163 protected:
164  ContourSpatialObject(const Self &); //purposely not implemented
165  void operator=(const Self &); //purposely not implemented
166 
170  bool m_Closed;
173 
175  virtual ~ContourSpatialObject();
176 
178  virtual void PrintSelf(std::ostream & os, Indent indent) const;
179 };
180 } // end namespace itk
181 
182 #ifndef ITK_MANUAL_INSTANTIATION
183 #include "itkContourSpatialObject.hxx"
184 #endif
185 
186 #endif // __itkContourSpatialObject_h
187