Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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) itkCloneMacro(Self)
81 
84 
85  static const unsigned int PointDimension = 3;
86  static const unsigned int MaxTopologicalDimension = 3;
87 
92  {
93  unsigned int id; // to give the point a special ID
94  bool selected; // information about if the point is selected
95  mitk::PointSpecificationType pointSpec; // specifies the type of the point
96 
97  bool operator==(const PointDataType &other) const;
98  };
99 
106  typedef std::vector<unsigned int> SelectedLinesType;
107  typedef SelectedLinesType::iterator SelectedLinesIter;
109  {
110  // used to set the whole cell on selected
111  bool selected;
112 
113  // indexes of selected lines. 0 is between pointId 0 and 1
114  SelectedLinesType selectedLines;
115 
116  // is the polygon already finished and closed
117  bool closed;
118  };
119 
120  typedef itk::DefaultDynamicMeshTraits<PointDataType,
121  PointDimension,
122  MaxTopologicalDimension,
125  CellDataType>
127  typedef itk::Mesh<PointDataType, PointDimension, MeshTraits> MeshType;
128 
129  typedef MeshType DataType;
131  typedef DataType::PointIdentifier PointIdentifier;
132  typedef DataType::PointsContainer PointsContainer;
133  typedef DataType::PointsContainerIterator PointsIterator;
134  typedef DataType::PointsContainer::ConstIterator PointsConstIterator;
135  typedef DataType::PointDataContainer PointDataContainer;
136  typedef DataType::PointDataContainerIterator PointDataIterator;
137  typedef DataType::PointDataContainerIterator PointDataConstIterator;
138 
139  void Expand(unsigned int timeSteps) override;
140 
142  void ExecuteOperation(Operation *operation) override;
143 
145  virtual int GetSize(unsigned int t = 0) const;
146 
147  virtual unsigned int GetPointSetSeriesSize() const;
148 
150  virtual DataType::Pointer GetPointSet(int t = 0) const;
151 
152  PointsIterator Begin(int t = 0);
153 
154  PointsConstIterator Begin(int t = 0) const;
155 
156  PointsIterator End(int t = 0);
157 
158  PointsConstIterator End(int t = 0) const;
159 
163  PointsIterator GetMaxId(int t = 0);
164 
170  PointType GetPoint(PointIdentifier id, int t = 0) const;
171 
178  bool GetPointIfExists(PointIdentifier id, PointType *point, int t = 0) const;
179 
183  void SetPoint(PointIdentifier id, PointType point, int t = 0);
184 
188  void SetPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t = 0);
189 
193  void InsertPoint(PointIdentifier id, PointType point, int t = 0);
194 
198  void InsertPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t);
199 
203  PointIdentifier InsertPoint(PointType point, int t = 0);
204 
208  bool RemovePointIfExists(PointIdentifier id, int t = 0);
209 
213  PointsIterator RemovePointAtEnd(int t = 0);
214 
220  bool SwapPointPosition(PointIdentifier id, bool moveUpwards, int t = 0);
221 
226  virtual int SearchSelectedPoint(int t = 0) const;
227 
229  virtual bool IndexExists(int position, int t = 0) const;
230 
234  virtual bool GetSelectInfo(int position, int t = 0) const;
235 
236  virtual void SetSelectInfo(int position, bool selected, int t = 0);
237 
239  virtual PointSpecificationType GetSpecificationTypeInfo(int position, int t) const;
240 
242  virtual int GetNumberOfSelected(int t = 0) const;
243 
252  int SearchPoint(Point3D point, ScalarType distance, int t = 0) const;
253 
254  bool IsEmptyTimeStep(unsigned int t) const override;
255 
256  // virtual methods, that need to be implemented
257  void UpdateOutputInformation() override;
258  void SetRequestedRegionToLargestPossibleRegion() override;
259  bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
260  bool VerifyRequestedRegion() override;
261  void SetRequestedRegion(const itk::DataObject *data) override;
262 
263  // Method for subclasses
264  virtual void OnPointSetChange(){};
265 
266  protected:
268 
269  PointSet();
270  PointSet(const PointSet &other);
271  ~PointSet() override;
272 
273  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
274 
275  void ClearData() override;
276 
277  void InitializeEmpty() override;
278 
280  bool SwapPointContents(PointIdentifier id1, PointIdentifier id2, int t = 0);
281 
282  typedef std::vector<DataType::Pointer> PointSetSeries;
283 
284  PointSetSeries m_PointSetSeries;
285 
286  DataType::PointsContainer::Pointer m_EmptyPointsContainer;
287 
292  };
293 
312  DEPRECATED(MITKCORE_EXPORT bool Equal(const mitk::PointSet *leftHandSide,
313  const mitk::PointSet *rightHandSide,
315  bool verbose,
316  bool checkGeometry = true));
317 
334  MITKCORE_EXPORT bool Equal(const mitk::PointSet &leftHandSide,
335  const mitk::PointSet &rightHandSide,
337  bool verbose,
338  bool checkGeometry = true);
339 
340  itkEventMacro(PointSetEvent, itk::AnyEvent);
341  itkEventMacro(PointSetMoveEvent, PointSetEvent);
342  itkEventMacro(PointSetSizeChangeEvent, PointSetEvent);
343  itkEventMacro(PointSetAddEvent, PointSetSizeChangeEvent);
344  itkEventMacro(PointSetRemoveEvent, PointSetSizeChangeEvent);
345  itkEventMacro(PointSetExtendTimeRangeEvent, PointSetEvent);
346 
347 } // namespace mitk
348 
349 #endif /* MITKPointSet_H_HEADER_INCLUDED */
MeshType DataType
Definition: mitkPointSet.h:129
DataType::PointsContainerIterator PointsIterator
Definition: mitkPointSet.h:133
DataType::PointDataContainer PointDataContainer
Definition: mitkPointSet.h:135
#define MITKCORE_EXPORT
Base of all data objects.
Definition: mitkBaseData.h:37
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:291
mitk::ScalarType CoordinateType
Definition: mitkPointSet.h:82
DataCollection - Class to facilitate loading/accessing structured data.
struct for data of a point
Definition: mitkPointSet.h:91
virtual void OnPointSetChange()
Definition: mitkPointSet.h:264
SelectedLinesType::iterator SelectedLinesIter
Definition: mitkPointSet.h:107
mitk::PointSpecificationType pointSpec
Definition: mitkPointSet.h:95
DataType::PointsContainer::ConstIterator PointsConstIterator
Definition: mitkPointSet.h:134
PointSetSeries m_PointSetSeries
Definition: mitkPointSet.h:284
itk::Mesh< PointDataType, PointDimension, MeshTraits > MeshType
Definition: mitkPointSet.h:127
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
DataType::PointDataContainerIterator PointDataConstIterator
Definition: mitkPointSet.h:137
DataType::PointIdentifier PointIdentifier
Definition: mitkPointSet.h:131
#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:106
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:114
itkEventMacro(ContourModelEvent, itk::AnyEvent)
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:158
DataType::PointsContainer PointsContainer
Definition: mitkPointSet.h:132
mitk::ScalarType InterpolationWeightType
Definition: mitkPointSet.h:83
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:286
MITKCORE_EXPORT const ScalarType eps
itk::DefaultDynamicMeshTraits< PointDataType, PointDimension, MaxTopologicalDimension, CoordinateType, InterpolationWeightType, CellDataType > MeshTraits
Definition: mitkPointSet.h:126
std::vector< DataType::Pointer > PointSetSeries
Definition: mitkPointSet.h:282
DataType::PointDataContainerIterator PointDataIterator
Definition: mitkPointSet.h:136
PointSpecificationType
enumeration of the type a point can be
Definition: mitkPoint.h:26
Point3D PointType
Definition: mitkPointSet.h:130