Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkContourElement.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef _mitkContourElement_H_
13 #define _mitkContourElement_H_
14 
15 #include "mitkCommon.h"
17 #include <mitkNumericTypes.h>
18 
19 //#include <ANN/ANN.h>
20 
21 #include <deque>
22 
23 namespace mitk
24 {
34  class MITKCONTOURMODEL_EXPORT ContourElement : public itk::LightObject
35  {
36  public:
37  mitkClassMacroItkParent(ContourElement, itk::LightObject);
38 
39  itkFactorylessNewMacro(Self);
40 
41  itkCloneMacro(Self);
42 
43  // Data container representing vertices
44 
48  {
49  ContourModelVertex(mitk::Point3D &point, bool active = false) : IsControlPoint(active), Coordinates(point) {}
51  : IsControlPoint(other.IsControlPoint), Coordinates(other.Coordinates)
52  {
53  }
54 
57 
60  };
61  // END Data container representing vertices
62 
64  typedef std::deque<VertexType *> VertexListType;
65  typedef VertexListType::iterator VertexIterator;
66  typedef VertexListType::const_iterator ConstVertexIterator;
67 
68  // start of inline methods
69 
72  virtual ConstVertexIterator ConstIteratorBegin() { return this->m_Vertices->begin(); }
75  virtual ConstVertexIterator ConstIteratorEnd() { return this->m_Vertices->end(); }
78  virtual VertexIterator IteratorBegin() { return this->m_Vertices->begin(); }
81  virtual VertexIterator IteratorEnd() { return this->m_Vertices->end(); }
84  virtual int GetSize() { return this->m_Vertices->size(); }
85  // end of inline methods
86 
91  virtual void AddVertex(mitk::Point3D &point, bool isControlPoint);
92 
96  virtual void AddVertex(VertexType &vertex);
97 
102  virtual void AddVertexAtFront(mitk::Point3D &point, bool isControlPoint);
103 
107  virtual void AddVertexAtFront(VertexType &vertex);
108 
114  virtual void InsertVertexAtIndex(mitk::Point3D &point, bool isControlPoint, int index);
115 
120  virtual void SetVertexAt(int pointId, const mitk::Point3D &point);
121 
126  virtual void SetVertexAt(int pointId, const VertexType *vertex);
127 
131  virtual VertexType *GetVertexAt(int index);
132 
137  virtual VertexType *GetVertexAt(const mitk::Point3D &point, float eps);
138 
143  virtual int GetIndex(const VertexType *vertex);
144 
147  VertexListType *GetVertexList();
148 
151  bool IsEmpty();
152 
155  virtual bool IsClosed();
156 
161  virtual bool IsNearContour(const mitk::Point3D &point, float eps);
162 
166  virtual void Close();
167 
171  virtual void Open();
172 
176  virtual void SetClosed(bool isClosed);
177 
183  void Concatenate(mitk::ContourElement *other, bool check);
184 
188  virtual bool RemoveVertex(const VertexType *vertex);
189 
193  virtual bool RemoveVertexAt(int index);
194 
199  virtual bool RemoveVertexAt(mitk::Point3D &point, float eps);
200 
203  virtual void Clear();
204 
209  VertexType *BruteForceGetVertexAt(const mitk::Point3D &point, float eps);
210 
215  // VertexType* OptimizedGetVertexAt(const mitk::Point3D &point, float eps);
216 
217  VertexListType *GetControlVertices();
218 
223  void RedistributeControlVertices(const VertexType *vertex, int period);
224 
225  protected:
226  mitkCloneMacro(Self);
227 
228  ContourElement();
229  ContourElement(const mitk::ContourElement &other);
230  ~ContourElement() override;
231 
232  VertexListType *m_Vertices; // double ended queue with vertices
234  };
235 } // namespace mitk
236 
237 #endif // _mitkContourElement_H_
std::deque< VertexType * > VertexListType
mitk::Point3D Coordinates
Coordinates in 3D space.
ContourModelVertex VertexType
Represents a contour in 3D space. A ContourElement is consisting of linked vertices implicitely defin...
#define MITKCONTOURMODEL_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
VertexListType::const_iterator ConstVertexIterator
virtual ConstVertexIterator ConstIteratorBegin()
Return a const iterator a the front.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
ContourModelVertex(const ContourModelVertex &other)
ContourModelVertex(mitk::Point3D &point, bool active=false)
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:158
virtual VertexIterator IteratorBegin()
Return an iterator a the front.
MITKCORE_EXPORT const ScalarType eps
VertexListType::iterator VertexIterator
virtual ConstVertexIterator ConstIteratorEnd()
Return a const iterator a the end.
virtual VertexIterator IteratorEnd()
Return an iterator a the end.
Represents a single vertex of contour.
virtual int GetSize()
Returns the number of contained vertices.
VertexListType * m_Vertices