Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef _mitkContourElement_H_
17 #define _mitkContourElement_H_
18 
19 #include "mitkCommon.h"
21 #include <mitkNumericTypes.h>
22 
23 //#include <ANN/ANN.h>
24 
25 #include <deque>
26 
27 namespace mitk
28 {
38  class MITKCONTOURMODEL_EXPORT ContourElement : public itk::LightObject
39  {
40  public:
41  mitkClassMacroItkParent(ContourElement, itk::LightObject);
42 
43  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
44 
45  // Data container representing vertices
46 
47 
50  {
51  ContourModelVertex(mitk::Point3D &point, bool active = false) : IsControlPoint(active), Coordinates(point) {}
52  ContourModelVertex(const ContourModelVertex &other)
53  : IsControlPoint(other.IsControlPoint), Coordinates(other.Coordinates)
54  {
55  }
56 
59 
62  };
63  // END Data container representing vertices
64 
66  typedef std::deque<VertexType *> VertexListType;
67  typedef VertexListType::iterator VertexIterator;
68  typedef VertexListType::const_iterator ConstVertexIterator;
69 
70  // start of inline methods
71 
74  virtual ConstVertexIterator ConstIteratorBegin() { return this->m_Vertices->begin(); }
77  virtual ConstVertexIterator ConstIteratorEnd() { return this->m_Vertices->end(); }
80  virtual VertexIterator IteratorBegin() { return this->m_Vertices->begin(); }
83  virtual VertexIterator IteratorEnd() { return this->m_Vertices->end(); }
86  virtual int GetSize() { return this->m_Vertices->size(); }
87  // end of inline methods
88 
93  virtual void AddVertex(mitk::Point3D &point, bool isControlPoint);
94 
98  virtual void AddVertex(VertexType &vertex);
99 
104  virtual void AddVertexAtFront(mitk::Point3D &point, bool isControlPoint);
105 
109  virtual void AddVertexAtFront(VertexType &vertex);
110 
116  virtual void InsertVertexAtIndex(mitk::Point3D &point, bool isControlPoint, int index);
117 
122  virtual void SetVertexAt(int pointId, const mitk::Point3D &point);
123 
128  virtual void SetVertexAt(int pointId, const VertexType *vertex);
129 
133  virtual VertexType *GetVertexAt(int index);
134 
139  virtual VertexType *GetVertexAt(const mitk::Point3D &point, float eps);
140 
145  virtual int GetIndex(const VertexType *vertex);
146 
149  VertexListType *GetVertexList();
150 
153  bool IsEmpty();
154 
157  virtual bool IsClosed();
158 
163  virtual bool IsNearContour(const mitk::Point3D &point, float eps);
164 
168  virtual void Close();
169 
173  virtual void Open();
174 
178  virtual void SetClosed(bool isClosed);
179 
185  void Concatenate(mitk::ContourElement *other, bool check);
186 
190  virtual bool RemoveVertex(const VertexType *vertex);
191 
195  virtual bool RemoveVertexAt(int index);
196 
201  virtual bool RemoveVertexAt(mitk::Point3D &point, float eps);
202 
205  virtual void Clear();
206 
211  VertexType *BruteForceGetVertexAt(const mitk::Point3D &point, float eps);
212 
217  // VertexType* OptimizedGetVertexAt(const mitk::Point3D &point, float eps);
218 
219  VertexListType *GetControlVertices();
220 
225  void RedistributeControlVertices(const VertexType *vertex, int period);
226 
227  protected:
228  mitkCloneMacro(Self);
229 
230  ContourElement();
231  ContourElement(const mitk::ContourElement &other);
232  virtual ~ContourElement();
233 
234  VertexListType *m_Vertices; // double ended queue with vertices
236  };
237 } // namespace mitk
238 
239 #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:53
ContourModelVertex(const ContourModelVertex &other)
ContourModelVertex(mitk::Point3D &point, bool active=false)
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:162
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