Medical Imaging Interaction Toolkit  2024.06.00
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
14 #define mitkPointSet_h
15 
16 #include "mitkBaseData.h"
17 
18 #include <itkDefaultDynamicMeshTraits.h>
19 #include <itkMesh.h>
20 
21 namespace mitk
22 {
72  {
73  public:
75 
76  itkFactorylessNewMacro(Self);
77 
78  itkCloneMacro(Self);
79 
82 
83  static const unsigned int PointDimension = 3;
84  static const unsigned int MaxTopologicalDimension = 3;
85 
90  {
91  unsigned int id; // to give the point a special ID
92  bool selected; // information about if the point is selected
93  mitk::PointSpecificationType pointSpec; // specifies the type of the point
94 
95  bool operator==(const PointDataType &other) const;
96  };
97 
104  typedef std::vector<unsigned int> SelectedLinesType;
105  typedef SelectedLinesType::iterator SelectedLinesIter;
107  {
108  // used to set the whole cell on selected
109  bool selected;
110 
111  // indexes of selected lines. 0 is between pointId 0 and 1
113 
114  // is the polygon already finished and closed
115  bool closed;
116  };
117 
118  typedef itk::DefaultDynamicMeshTraits<PointDataType,
119  PointDimension,
120  MaxTopologicalDimension,
123  CellDataType>
125  typedef itk::Mesh<PointDataType, PointDimension, MeshTraits> MeshType;
126 
129  typedef DataType::PointIdentifier PointIdentifier;
130  typedef DataType::PointsContainer PointsContainer;
131  typedef DataType::PointsContainerIterator PointsIterator;
132  typedef DataType::PointsContainer::ConstIterator PointsConstIterator;
133  typedef DataType::PointDataContainer PointDataContainer;
134  typedef DataType::PointDataContainerIterator PointDataIterator;
135  typedef DataType::PointDataContainerIterator PointDataConstIterator;
136 
137  void Expand(unsigned int timeSteps) override;
138 
140  void ExecuteOperation(Operation *operation) override;
141 
143  virtual int GetSize(unsigned int t = 0) const;
144 
145  virtual unsigned int GetPointSetSeriesSize() const;
146 
148  virtual DataType::Pointer GetPointSet(int t = 0) const;
149 
150  PointsIterator Begin(int t = 0);
151 
152  PointsConstIterator Begin(int t = 0) const;
153 
154  PointsIterator End(int t = 0);
155 
156  PointsConstIterator End(int t = 0) const;
157 
161  PointsIterator GetMaxId(int t = 0);
162 
168  PointType GetPoint(PointIdentifier id, int t = 0) const;
169 
176  bool GetPointIfExists(PointIdentifier id, PointType *point, int t = 0) const;
177 
181  void SetPoint(PointIdentifier id, PointType point, int t = 0);
182 
186  void SetPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t = 0);
187 
191  void InsertPoint(PointIdentifier id, PointType point, int t = 0);
192 
196  void InsertPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t);
197 
201  PointIdentifier InsertPoint(PointType point, int t = 0);
202 
206  bool RemovePointIfExists(PointIdentifier id, int t = 0);
207 
211  PointsIterator RemovePointAtEnd(int t = 0);
212 
218  bool SwapPointPosition(PointIdentifier id, bool moveUpwards, int t = 0);
219 
224  virtual int SearchSelectedPoint(int t = 0) const;
225 
227  virtual bool IndexExists(int position, int t = 0) const;
228 
232  virtual bool GetSelectInfo(int position, int t = 0) const;
233 
234  virtual void SetSelectInfo(int position, bool selected, int t = 0);
235 
237  virtual PointSpecificationType GetSpecificationTypeInfo(int position, int t) const;
238 
240  virtual int GetNumberOfSelected(int t = 0) const;
241 
251  int SearchPoint(Point3D point, ScalarType distance, int t = 0) const;
252 
253  bool IsEmptyTimeStep(unsigned int t) const override;
254 
255  // virtual methods, that need to be implemented
256  void UpdateOutputInformation() override;
257  void SetRequestedRegionToLargestPossibleRegion() override;
258  bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
259  bool VerifyRequestedRegion() override;
260  void SetRequestedRegion(const itk::DataObject *data) override;
261 
262  // Method for subclasses
263  virtual void OnPointSetChange(){};
264 
265  protected:
267 
268  PointSet();
269  PointSet(const PointSet &other);
270  ~PointSet() override;
271 
272  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
273 
274  void ClearData() override;
275 
276  void InitializeEmpty() override;
277 
279  bool SwapPointContents(PointIdentifier id1, PointIdentifier id2, int t = 0);
280 
281  typedef std::vector<DataType::Pointer> PointSetSeries;
282 
284 
285  DataType::PointsContainer::Pointer m_EmptyPointsContainer;
286 
291  };
292 
311  DEPRECATED(MITKCORE_EXPORT bool Equal(const mitk::PointSet *leftHandSide,
312  const mitk::PointSet *rightHandSide,
314  bool verbose,
315  bool checkGeometry = true));
316 
333  MITKCORE_EXPORT bool Equal(const mitk::PointSet &leftHandSide,
334  const mitk::PointSet &rightHandSide,
336  bool verbose,
337  bool checkGeometry = true);
338 
339  itkEventMacroDeclaration(PointSetEvent, itk::AnyEvent);
340  itkEventMacroDeclaration(PointSetMoveEvent, PointSetEvent);
341  itkEventMacroDeclaration(PointSetSizeChangeEvent, PointSetEvent);
342  itkEventMacroDeclaration(PointSetAddEvent, PointSetSizeChangeEvent);
343  itkEventMacroDeclaration(PointSetRemoveEvent, PointSetSizeChangeEvent);
344  itkEventMacroDeclaration(PointSetExtendTimeRangeEvent, PointSetEvent);
345 
346 } // namespace mitk
347 
348 #endif
mitk::PointSet::CellDataType::selectedLines
SelectedLinesType selectedLines
Definition: mitkPointSet.h:112
mitk::eps
const MITKCORE_EXPORT ScalarType eps
mitk::PointSet::PointDataType
struct for data of a point
Definition: mitkPointSet.h:89
mitk::PointSet::PointIdentifier
DataType::PointIdentifier PointIdentifier
Definition: mitkPointSet.h:129
mitk::PointSet::SelectedLinesType
std::vector< unsigned int > SelectedLinesType
cellDataType, that stores all indexes of the lines, that are selected e.g.: points A,...
Definition: mitkPointSet.h:104
mitk::PointSet::PointsConstIterator
DataType::PointsContainer::ConstIterator PointsConstIterator
Definition: mitkPointSet.h:132
mitk::PointSet::PointDataType::selected
bool selected
Definition: mitkPointSet.h:92
mitk::Operation
Base class of all Operation-classes.
Definition: mitkOperation.h:29
mitk::PointSet::DataType
MeshType DataType
Definition: mitkPointSet.h:127
mitk::PointSet::CellDataType
Definition: mitkPointSet.h:106
DEPRECATED
#define DEPRECATED(func)
Definition: mitkCommon.h:175
mitk::Equal
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.
mitk::PointSet::m_PointSetSeries
PointSetSeries m_PointSetSeries
Definition: mitkPointSet.h:283
mitk::PointSet::MeshType
itk::Mesh< PointDataType, PointDimension, MeshTraits > MeshType
Definition: mitkPointSet.h:125
mitk::PointSet::PointType
Point3D PointType
Definition: mitkPointSet.h:128
mitk::PointSet::CellDataType::selected
bool selected
Definition: mitkPointSet.h:109
mitk::PointSet::PointsIterator
DataType::PointsContainerIterator PointsIterator
Definition: mitkPointSet.h:131
mitk::PointSet::m_EmptyPointsContainer
DataType::PointsContainer::Pointer m_EmptyPointsContainer
Definition: mitkPointSet.h:285
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::PointSet::PointDataType::pointSpec
mitk::PointSpecificationType pointSpec
Definition: mitkPointSet.h:93
mitk::PointSet::CellDataType::closed
bool closed
Definition: mitkPointSet.h:115
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
mitk::Point
Definition: mitkPoint.h:38
mitk::PointSet::SelectedLinesIter
SelectedLinesType::iterator SelectedLinesIter
Definition: mitkPointSet.h:105
mitk::PointSet::PointDataConstIterator
DataType::PointDataContainerIterator PointDataConstIterator
Definition: mitkPointSet.h:135
mitk::PointSet::PointDataType::id
unsigned int id
Definition: mitkPointSet.h:91
mitk::BaseData
Base of all data objects.
Definition: mitkBaseData.h:42
mitk::PointSet::PointDataIterator
DataType::PointDataContainerIterator PointDataIterator
Definition: mitkPointSet.h:134
mitk::PointSet::InterpolationWeightType
mitk::ScalarType InterpolationWeightType
Definition: mitkPointSet.h:81
mitk::PointSet::PointsContainer
DataType::PointsContainer PointsContainer
Definition: mitkPointSet.h:130
mitk::PointSet::m_CalculateBoundingBox
bool m_CalculateBoundingBox
flag to indicate the right time to call SetBounds
Definition: mitkPointSet.h:290
mitkCloneMacro
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:154
mitk::PointSet::PointDataContainer
DataType::PointDataContainer PointDataContainer
Definition: mitkPointSet.h:133
mitkBaseData.h
mitk::PointSet::PointSetSeries
std::vector< DataType::Pointer > PointSetSeries
Definition: mitkPointSet.h:281
mitk::PointSpecificationType
PointSpecificationType
enumeration of the type a point can be
Definition: mitkPoint.h:28
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::PointSet::CoordinateType
mitk::ScalarType CoordinateType
Definition: mitkPointSet.h:78
mitk::PointSet
Data structure which stores a set of points.
Definition: mitkPointSet.h:71
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::PointSet::MeshTraits
itk::DefaultDynamicMeshTraits< PointDataType, PointDimension, MaxTopologicalDimension, CoordinateType, InterpolationWeightType, CellDataType > MeshTraits
Definition: mitkPointSet.h:124
mitk::itkEventMacroDeclaration
itkEventMacroDeclaration(BoundingShapeInteractionEvent, itk::AnyEvent)
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
mitk::PointSet::OnPointSetChange
virtual void OnPointSetChange()
Definition: mitkPointSet.h:263