Medical Imaging Interaction Toolkit  2018.4.99-b20efe7f
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 (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 
13 #ifndef MITKPointSet_H_HEADER_INCLUDED
14 #define MITKPointSet_H_HEADER_INCLUDED
15 
16 #include "mitkBaseData.h"
17 
18 #include <itkDefaultDynamicMeshTraits.h>
19 #include <itkMesh.h>
20 
21 namespace mitk
22 {
76  {
77  public:
79 
80  itkFactorylessNewMacro(Self);
81 
82  itkCloneMacro(Self);
83 
86 
87  static const unsigned int PointDimension = 3;
88  static const unsigned int MaxTopologicalDimension = 3;
89 
94  {
95  unsigned int id; // to give the point a special ID
96  bool selected; // information about if the point is selected
97  mitk::PointSpecificationType pointSpec; // specifies the type of the point
98 
99  bool operator==(const PointDataType &other) const;
100  };
101 
108  typedef std::vector<unsigned int> SelectedLinesType;
109  typedef SelectedLinesType::iterator SelectedLinesIter;
111  {
112  // used to set the whole cell on selected
113  bool selected;
114 
115  // indexes of selected lines. 0 is between pointId 0 and 1
116  SelectedLinesType selectedLines;
117 
118  // is the polygon already finished and closed
119  bool closed;
120  };
121 
122  typedef itk::DefaultDynamicMeshTraits<PointDataType,
123  PointDimension,
124  MaxTopologicalDimension,
125  CoordinateType,
126  InterpolationWeightType,
127  CellDataType>
129  typedef itk::Mesh<PointDataType, PointDimension, MeshTraits> MeshType;
130 
131  typedef MeshType DataType;
133  typedef DataType::PointIdentifier PointIdentifier;
134  typedef DataType::PointsContainer PointsContainer;
135  typedef DataType::PointsContainerIterator PointsIterator;
136  typedef DataType::PointsContainer::ConstIterator PointsConstIterator;
137  typedef DataType::PointDataContainer PointDataContainer;
138  typedef DataType::PointDataContainerIterator PointDataIterator;
139  typedef DataType::PointDataContainerIterator PointDataConstIterator;
140 
141  void Expand(unsigned int timeSteps) override;
142 
144  void ExecuteOperation(Operation *operation) override;
145 
147  virtual int GetSize(unsigned int t = 0) const;
148 
149  virtual unsigned int GetPointSetSeriesSize() const;
150 
152  virtual DataType::Pointer GetPointSet(int t = 0) const;
153 
154  PointsIterator Begin(int t = 0);
155 
156  PointsConstIterator Begin(int t = 0) const;
157 
158  PointsIterator End(int t = 0);
159 
160  PointsConstIterator End(int t = 0) const;
161 
165  PointsIterator GetMaxId(int t = 0);
166 
172  PointType GetPoint(PointIdentifier id, int t = 0) const;
173 
180  bool GetPointIfExists(PointIdentifier id, PointType *point, int t = 0) const;
181 
185  void SetPoint(PointIdentifier id, PointType point, int t = 0);
186 
190  void SetPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t = 0);
191 
195  void InsertPoint(PointIdentifier id, PointType point, int t = 0);
196 
200  void InsertPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t);
201 
205  PointIdentifier InsertPoint(PointType point, int t = 0);
206 
210  bool RemovePointIfExists(PointIdentifier id, int t = 0);
211 
215  PointsIterator RemovePointAtEnd(int t = 0);
216 
222  bool SwapPointPosition(PointIdentifier id, bool moveUpwards, int t = 0);
223 
228  virtual int SearchSelectedPoint(int t = 0) const;
229 
231  virtual bool IndexExists(int position, int t = 0) const;
232 
236  virtual bool GetSelectInfo(int position, int t = 0) const;
237 
238  virtual void SetSelectInfo(int position, bool selected, int t = 0);
239 
241  virtual PointSpecificationType GetSpecificationTypeInfo(int position, int t) const;
242 
244  virtual int GetNumberOfSelected(int t = 0) const;
245 
254  int SearchPoint(Point3D point, ScalarType distance, int t = 0) const;
255 
256  bool IsEmptyTimeStep(unsigned int t) const override;
257 
258  // virtual methods, that need to be implemented
259  void UpdateOutputInformation() override;
260  void SetRequestedRegionToLargestPossibleRegion() override;
261  bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
262  bool VerifyRequestedRegion() override;
263  void SetRequestedRegion(const itk::DataObject *data) override;
264 
265  // Method for subclasses
266  virtual void OnPointSetChange(){};
267 
268  protected:
270 
271  PointSet();
272  PointSet(const PointSet &other);
273  ~PointSet() override;
274 
275  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
276 
277  void ClearData() override;
278 
279  void InitializeEmpty() override;
280 
282  bool SwapPointContents(PointIdentifier id1, PointIdentifier id2, int t = 0);
283 
284  typedef std::vector<DataType::Pointer> PointSetSeries;
285 
286  PointSetSeries m_PointSetSeries;
287 
288  DataType::PointsContainer::Pointer m_EmptyPointsContainer;
289 
294  };
295 
314  DEPRECATED(MITKCORE_EXPORT bool Equal(const mitk::PointSet *leftHandSide,
315  const mitk::PointSet *rightHandSide,
317  bool verbose,
318  bool checkGeometry = true));
319 
336  MITKCORE_EXPORT bool Equal(const mitk::PointSet &leftHandSide,
337  const mitk::PointSet &rightHandSide,
339  bool verbose,
340  bool checkGeometry = true);
341 
342  itkEventMacro(PointSetEvent, itk::AnyEvent);
343  itkEventMacro(PointSetMoveEvent, PointSetEvent);
344  itkEventMacro(PointSetSizeChangeEvent, PointSetEvent);
345  itkEventMacro(PointSetAddEvent, PointSetSizeChangeEvent);
346  itkEventMacro(PointSetRemoveEvent, PointSetSizeChangeEvent);
347  itkEventMacro(PointSetExtendTimeRangeEvent, PointSetEvent);
348 
349 } // namespace mitk
350 
351 #endif /* MITKPointSet_H_HEADER_INCLUDED */
MeshType DataType
Definition: mitkPointSet.h:131
DataType::PointsContainerIterator PointsIterator
Definition: mitkPointSet.h:135
DataType::PointDataContainer PointDataContainer
Definition: mitkPointSet.h:137
#define MITKCORE_EXPORT
itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent)
Base of all data objects.
Definition: mitkBaseData.h:42
Base class of all Operation-classes.
Definition: mitkOperation.h:29
double ScalarType
bool m_CalculateBoundingBox
flag to indicate the right time to call SetBounds
Definition: mitkPointSet.h:293
mitk::ScalarType CoordinateType
Definition: mitkPointSet.h:82
DataCollection - Class to facilitate loading/accessing structured data.
struct for data of a point
Definition: mitkPointSet.h:93
virtual void OnPointSetChange()
Definition: mitkPointSet.h:266
SelectedLinesType::iterator SelectedLinesIter
Definition: mitkPointSet.h:109
mitk::PointSpecificationType pointSpec
Definition: mitkPointSet.h:97
DataType::PointsContainer::ConstIterator PointsConstIterator
Definition: mitkPointSet.h:136
PointSetSeries m_PointSetSeries
Definition: mitkPointSet.h:286
itk::Mesh< PointDataType, PointDimension, MeshTraits > MeshType
Definition: mitkPointSet.h:129
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
DataType::PointDataContainerIterator PointDataConstIterator
Definition: mitkPointSet.h:139
DataType::PointIdentifier PointIdentifier
Definition: mitkPointSet.h:133
#define DEPRECATED(func)
Definition: mitkCommon.h:179
std::vector< unsigned int > SelectedLinesType
cellDataType, that stores all indexes of the lines, that are selected e.g.: points A...
Definition: mitkPointSet.h:108
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:75
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
bool verbose(false)
SelectedLinesType selectedLines
Definition: mitkPointSet.h:116
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:158
DataType::PointsContainer PointsContainer
Definition: mitkPointSet.h:134
mitk::ScalarType InterpolationWeightType
Definition: mitkPointSet.h:85
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:288
MITKCORE_EXPORT const ScalarType eps
itk::DefaultDynamicMeshTraits< PointDataType, PointDimension, MaxTopologicalDimension, CoordinateType, InterpolationWeightType, CellDataType > MeshTraits
Definition: mitkPointSet.h:128
std::vector< DataType::Pointer > PointSetSeries
Definition: mitkPointSet.h:284
DataType::PointDataContainerIterator PointDataIterator
Definition: mitkPointSet.h:138
PointSpecificationType
enumeration of the type a point can be
Definition: mitkPoint.h:26
Point3D PointType
Definition: mitkPointSet.h:132