Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkPointSet.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 
17 #ifndef MITKPointSet_H_HEADER_INCLUDED
18 #define MITKPointSet_H_HEADER_INCLUDED
19 
20 #include "mitkBaseData.h"
21 
22 #include <itkDefaultDynamicMeshTraits.h>
23 #include <itkMesh.h>
24 
25 namespace mitk
26 {
80  {
81  public:
83 
84  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
85 
88 
89  static const unsigned int PointDimension = 3;
90  static const unsigned int MaxTopologicalDimension = 3;
91 
96  {
97  unsigned int id; // to give the point a special ID
98  bool selected; // information about if the point is selected
99  mitk::PointSpecificationType pointSpec; // specifies the type of the point
100 
101  bool operator==(const PointDataType &other) const;
102  };
103 
110  typedef std::vector<unsigned int> SelectedLinesType;
111  typedef SelectedLinesType::iterator SelectedLinesIter;
113  {
114  // used to set the whole cell on selected
115  bool selected;
116 
117  // indexes of selected lines. 0 is between pointId 0 and 1
118  SelectedLinesType selectedLines;
119 
120  // is the polygon already finished and closed
121  bool closed;
122  };
123 
124  typedef itk::DefaultDynamicMeshTraits<PointDataType,
125  PointDimension,
126  MaxTopologicalDimension,
129  CellDataType>
131  typedef itk::Mesh<PointDataType, PointDimension, MeshTraits> MeshType;
132 
133  typedef MeshType DataType;
135  typedef DataType::PointIdentifier PointIdentifier;
136  typedef DataType::PointsContainer PointsContainer;
137  typedef DataType::PointsContainerIterator PointsIterator;
138  typedef DataType::PointsContainer::ConstIterator PointsConstIterator;
139  typedef DataType::PointDataContainer PointDataContainer;
140  typedef DataType::PointDataContainerIterator PointDataIterator;
141  typedef DataType::PointDataContainerIterator PointDataConstIterator;
142 
143  virtual void Expand(unsigned int timeSteps) override;
144 
146  virtual void ExecuteOperation(Operation *operation) override;
147 
149  virtual int GetSize(unsigned int t = 0) const;
150 
151  virtual unsigned int GetPointSetSeriesSize() const;
152 
154  virtual DataType::Pointer GetPointSet(int t = 0) const;
155 
156  PointsIterator Begin(int t = 0);
157 
158  PointsConstIterator Begin(int t = 0) const;
159 
160  PointsIterator End(int t = 0);
161 
162  PointsConstIterator End(int t = 0) const;
163 
167  PointsIterator GetMaxId(int t = 0);
168 
174  PointType GetPoint(PointIdentifier id, int t = 0) const;
175 
182  bool GetPointIfExists(PointIdentifier id, PointType *point, int t = 0) const;
183 
187  void SetPoint(PointIdentifier id, PointType point, int t = 0);
188 
192  void SetPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t = 0);
193 
197  void InsertPoint(PointIdentifier id, PointType point, int t = 0);
198 
202  void InsertPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t);
203 
207  PointIdentifier InsertPoint(PointType point, int t = 0);
208 
212  bool RemovePointIfExists(PointIdentifier id, int t = 0);
213 
217  PointsIterator RemovePointAtEnd(int t = 0);
218 
224  bool SwapPointPosition(PointIdentifier id, bool moveUpwards, int t = 0);
225 
230  virtual int SearchSelectedPoint(int t = 0) const;
231 
233  virtual bool IndexExists(int position, int t = 0) const;
234 
238  virtual bool GetSelectInfo(int position, int t = 0) const;
239 
240  virtual void SetSelectInfo(int position, bool selected, int t = 0);
241 
243  virtual PointSpecificationType GetSpecificationTypeInfo(int position, int t) const;
244 
246  virtual int GetNumberOfSelected(int t = 0) const;
247 
256  int SearchPoint(Point3D point, ScalarType distance, int t = 0) const;
257 
258  virtual bool IsEmptyTimeStep(unsigned int t) const override;
259 
260  // virtual methods, that need to be implemented
261  virtual void UpdateOutputInformation() override;
262  virtual void SetRequestedRegionToLargestPossibleRegion() override;
263  virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
264  virtual bool VerifyRequestedRegion() override;
265  virtual void SetRequestedRegion(const itk::DataObject *data) override;
266 
267  // Method for subclasses
268  virtual void OnPointSetChange(){};
269 
270  protected:
272 
273  PointSet();
274  PointSet(const PointSet &other);
275  virtual ~PointSet();
276 
277  virtual void PrintSelf(std::ostream &os, itk::Indent indent) const override;
278 
279  virtual void ClearData() override;
280 
281  virtual void InitializeEmpty() override;
282 
284  bool SwapPointContents(PointIdentifier id1, PointIdentifier id2, int t = 0);
285 
286  typedef std::vector<DataType::Pointer> PointSetSeries;
287 
288  PointSetSeries m_PointSetSeries;
289 
291 
296  };
297 
316  DEPRECATED(MITKCORE_EXPORT bool Equal(const mitk::PointSet *leftHandSide,
317  const mitk::PointSet *rightHandSide,
319  bool verbose,
320  bool checkGeometry = true));
321 
338  MITKCORE_EXPORT bool Equal(const mitk::PointSet &leftHandSide,
339  const mitk::PointSet &rightHandSide,
341  bool verbose,
342  bool checkGeometry = true);
343 
344  itkEventMacro(PointSetEvent, itk::AnyEvent);
345  itkEventMacro(PointSetMoveEvent, PointSetEvent);
346  itkEventMacro(PointSetSizeChangeEvent, PointSetEvent);
347  itkEventMacro(PointSetAddEvent, PointSetSizeChangeEvent);
348  itkEventMacro(PointSetRemoveEvent, PointSetSizeChangeEvent);
349  itkEventMacro(PointSetExtendTimeRangeEvent, PointSetEvent);
350 
351 } // namespace mitk
352 
353 #endif /* MITKPointSet_H_HEADER_INCLUDED */
MeshType DataType
Definition: mitkPointSet.h:133
DataType::PointsContainerIterator PointsIterator
Definition: mitkPointSet.h:137
itk::SmartPointer< Self > Pointer
DataType::PointDataContainer PointDataContainer
Definition: mitkPointSet.h:139
#define MITKCORE_EXPORT
Base of all data objects.
Definition: mitkBaseData.h:39
Base class of all Operation-classes.
Definition: mitkOperation.h:33
double ScalarType
bool m_CalculateBoundingBox
flag to indicate the right time to call SetBounds
Definition: mitkPointSet.h:295
mitk::ScalarType CoordinateType
Definition: mitkPointSet.h:86
DataCollection - Class to facilitate loading/accessing structured data.
struct for data of a point
Definition: mitkPointSet.h:95
virtual void OnPointSetChange()
Definition: mitkPointSet.h:268
SelectedLinesType::iterator SelectedLinesIter
Definition: mitkPointSet.h:111
mitk::PointSpecificationType pointSpec
Definition: mitkPointSet.h:99
DataType::PointsContainer::ConstIterator PointsConstIterator
Definition: mitkPointSet.h:138
PointSetSeries m_PointSetSeries
Definition: mitkPointSet.h:288
itk::Mesh< PointDataType, PointDimension, MeshTraits > MeshType
Definition: mitkPointSet.h:131
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
DataType::PointDataContainerIterator PointDataConstIterator
Definition: mitkPointSet.h:141
DataType::PointIdentifier PointIdentifier
Definition: mitkPointSet.h:135
#define DEPRECATED(func)
Definition: mitkCommon.h:183
std::vector< unsigned int > SelectedLinesType
cellDataType, that stores all indexes of the lines, that are selected e.g.: points A...
Definition: mitkPointSet.h:110
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:79
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
SelectedLinesType selectedLines
Definition: mitkPointSet.h:118
itkEventMacro(ContourModelEvent, itk::AnyEvent)
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:162
DataType::PointsContainer PointsContainer
Definition: mitkPointSet.h:136
mitk::ScalarType InterpolationWeightType
Definition: mitkPointSet.h:87
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
DataType::PointsContainer::Pointer m_EmptyPointsContainer
Definition: mitkPointSet.h:290
MITKCORE_EXPORT const ScalarType eps
itk::DefaultDynamicMeshTraits< PointDataType, PointDimension, MaxTopologicalDimension, CoordinateType, InterpolationWeightType, CellDataType > MeshTraits
Definition: mitkPointSet.h:130
std::vector< DataType::Pointer > PointSetSeries
Definition: mitkPointSet.h:286
DataType::PointDataContainerIterator PointDataIterator
Definition: mitkPointSet.h:140
PointSpecificationType
enumeration of the type a point can be
Definition: mitkPoint.h:30
Point3D PointType
Definition: mitkPointSet.h:134