Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkPlanarFigure.cpp
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 #include "mitkPlanarFigure.h"
18 #include "mitkPlaneGeometry.h"
19 #include <mitkProperties.h>
21 
22 #include <algorithm>
23 
25  : m_SelectedControlPoint(-1),
26  m_PreviewControlPointVisible(false),
27  m_FigurePlaced(false),
28  m_PlaneGeometry(nullptr),
29  m_PolyLineUpToDate(false),
30  m_HelperLinesUpToDate(false),
31  m_FeaturesUpToDate(false),
32  m_FeaturesMTime(0)
33 {
35 
36  m_DisplaySize.first = 0.0;
37  m_DisplaySize.second = 0;
38 
39  this->SetProperty("closed", mitk::BoolProperty::New(false));
40 
41  // Currently only single-time-step geometries are supported
42  this->InitializeTimeGeometry(1);
43 }
44 
46  : BaseData(other),
47  m_ControlPoints(other.m_ControlPoints),
48  m_NumberOfControlPoints(other.m_NumberOfControlPoints),
49  m_SelectedControlPoint(other.m_SelectedControlPoint),
50  m_PolyLines(other.m_PolyLines),
51  m_HelperPolyLines(other.m_HelperPolyLines),
52  m_PreviewControlPoint(other.m_PreviewControlPoint),
53  m_PreviewControlPointVisible(other.m_PreviewControlPointVisible),
54  m_FigurePlaced(other.m_FigurePlaced),
55  m_PlaneGeometry(other.m_PlaneGeometry), // do not clone since SetPlaneGeometry() doesn't clone either
56  m_PolyLineUpToDate(other.m_PolyLineUpToDate),
57  m_HelperLinesUpToDate(other.m_HelperLinesUpToDate),
58  m_FeaturesUpToDate(other.m_FeaturesUpToDate),
59  m_Features(other.m_Features),
60  m_FeaturesMTime(other.m_FeaturesMTime),
61  m_DisplaySize(other.m_DisplaySize)
62 {
64  for (unsigned long i = 0; i < other.m_HelperPolyLinesToBePainted->Size(); ++i)
65  {
66  m_HelperPolyLinesToBePainted->InsertElement(i, other.m_HelperPolyLinesToBePainted->GetElement(i));
67  }
68 }
69 
71 {
72  this->SetGeometry(geometry);
73  m_PlaneGeometry = dynamic_cast<PlaneGeometry *>(GetGeometry(0)); // geometry;
74 }
75 
77 {
78  return m_PlaneGeometry;
79 }
80 
82 {
83  mitk::BoolProperty *closed = dynamic_cast<mitk::BoolProperty *>(this->GetProperty("closed").GetPointer());
84  if (closed != nullptr)
85  {
86  return closed->GetValue();
87  }
88  return false;
89 }
90 
92 {
93  for (unsigned int i = 0; i < this->GetNumberOfControlPoints(); ++i)
94  {
95  m_ControlPoints.push_back(this->ApplyControlPointConstraints(i, point));
96  }
97 
98  m_FigurePlaced = true;
99  m_SelectedControlPoint = 1;
100 }
101 
102 bool mitk::PlanarFigure::AddControlPoint(const mitk::Point2D &point, int position)
103 {
104  // if we already have the maximum number of control points, do nothing
105  if (m_NumberOfControlPoints < this->GetMaximumNumberOfControlPoints())
106  {
107  // if position has not been defined or position would be the last control point, just append the new one
108  // we also append a new point if we click onto the line between the first two control-points if the second
109  // control-point is selected
110  // -> special case for PlanarCross
111  if (position == -1 || position > (int)m_NumberOfControlPoints - 1 || (position == 1 && m_SelectedControlPoint == 2))
112  {
113  if (m_ControlPoints.size() > this->GetMaximumNumberOfControlPoints() - 1)
114  {
115  // get rid of deprecated control points in the list. This is necessary
116  // as ::ResetNumberOfControlPoints() only sets the member, does not resize the list!
117  m_ControlPoints.resize(this->GetNumberOfControlPoints());
118  }
119 
120  m_ControlPoints.push_back(this->ApplyControlPointConstraints(m_NumberOfControlPoints, point));
121  m_SelectedControlPoint = m_NumberOfControlPoints;
122  }
123  else
124  {
125  // insert the point at the given position and set it as selected point
126  auto iter = m_ControlPoints.begin() + position;
127  m_ControlPoints.insert(iter, this->ApplyControlPointConstraints(position, point));
128  for (unsigned int i = 0; i < m_ControlPoints.size(); ++i)
129  {
130  if (point == m_ControlPoints.at(i))
131  {
132  m_SelectedControlPoint = i;
133  }
134  }
135  }
136 
137  // polylines & helperpolylines need to be repainted
138  m_PolyLineUpToDate = false;
139  m_HelperLinesUpToDate = false;
140  m_FeaturesUpToDate = false;
141 
142  // one control point more
143  ++m_NumberOfControlPoints;
144  return true;
145  }
146  else
147  {
148  return false;
149  }
150 }
151 
152 bool mitk::PlanarFigure::SetControlPoint(unsigned int index, const Point2D &point, bool createIfDoesNotExist)
153 {
154  bool controlPointSetCorrectly = false;
155  if (createIfDoesNotExist)
156  {
157  if (m_NumberOfControlPoints <= index)
158  {
159  m_ControlPoints.push_back(this->ApplyControlPointConstraints(index, point));
160  m_NumberOfControlPoints++;
161  }
162  else
163  {
164  m_ControlPoints.at(index) = this->ApplyControlPointConstraints(index, point);
165  }
166  controlPointSetCorrectly = true;
167  }
168  else if (index < m_NumberOfControlPoints)
169  {
170  m_ControlPoints.at(index) = this->ApplyControlPointConstraints(index, point);
171  controlPointSetCorrectly = true;
172  }
173  else
174  {
175  return false;
176  }
177 
178  if (controlPointSetCorrectly)
179  {
180  m_PolyLineUpToDate = false;
181  m_HelperLinesUpToDate = false;
182  m_FeaturesUpToDate = false;
183  }
184 
185  return controlPointSetCorrectly;
186 }
187 
189 {
190  if ((m_SelectedControlPoint < 0) || (m_SelectedControlPoint >= (int)m_NumberOfControlPoints))
191  {
192  return false;
193  }
194 
195  return this->SetControlPoint(m_SelectedControlPoint, point, false);
196 }
197 
199 {
200  return m_NumberOfControlPoints;
201 }
202 
204 {
205  if (index < this->GetNumberOfControlPoints())
206  {
207  m_SelectedControlPoint = index;
208  return true;
209  }
210  else
211  {
212  return false;
213  }
214 }
215 
217 {
218  bool wasSelected = (m_SelectedControlPoint != -1);
219 
220  m_SelectedControlPoint = -1;
221 
222  return wasSelected;
223 }
224 
226 {
227  m_PreviewControlPoint = point;
228  m_PreviewControlPointVisible = true;
229 }
230 
232 {
233  m_PreviewControlPointVisible = false;
234 }
235 
237 {
238  return m_PreviewControlPoint;
239 }
240 
242 {
243  return m_PreviewControlPointVisible;
244 }
245 
247 {
248  if (index < m_NumberOfControlPoints)
249  {
250  return m_ControlPoints.at(index);
251  }
252 
253  itkExceptionMacro(<< "GetControlPoint(): Invalid index!");
254 }
255 
257 {
258  Point3D point3D;
259  if ((m_PlaneGeometry != nullptr) && (index < m_NumberOfControlPoints))
260  {
261  m_PlaneGeometry->Map(m_ControlPoints.at(index), point3D);
262  return point3D;
263  }
264 
265  itkExceptionMacro(<< "GetWorldControlPoint(): Invalid index!");
266 }
267 
269 {
271  if (index > m_PolyLines.size() || !m_PolyLineUpToDate)
272  {
273  this->GeneratePolyLine();
274  m_PolyLineUpToDate = true;
275  }
276 
277  return m_PolyLines.at(index);
278 }
279 
281 {
282  return m_PolyLines.at(index);
283 }
284 
286 {
287  for (std::vector<PolyLineType>::size_type i = 0; i < m_PolyLines.size(); i++)
288  {
289  m_PolyLines.at(i).clear();
290  }
291  m_PolyLineUpToDate = false;
292 }
293 
295  double mmPerDisplayUnit,
296  unsigned int displayHeight)
297 {
298  mitk::PlanarFigure::PolyLineType helperPolyLine;
299  if (index < m_HelperPolyLines.size())
300  {
301  // m_HelperLinesUpToDate does not cover changes in zoom-level, so we have to check previous values of the
302  // two parameters as well
303  if (!m_HelperLinesUpToDate || m_DisplaySize.first != mmPerDisplayUnit || m_DisplaySize.second != displayHeight)
304  {
305  this->GenerateHelperPolyLine(mmPerDisplayUnit, displayHeight);
306  m_HelperLinesUpToDate = true;
307 
308  // store these parameters to be able to check next time if somebody zoomed in or out
309  m_DisplaySize.first = mmPerDisplayUnit;
310  m_DisplaySize.second = displayHeight;
311  }
312 
313  helperPolyLine = m_HelperPolyLines.at(index);
314  }
315 
316  return helperPolyLine;
317 }
318 
320 {
321  for (std::vector<PolyLineType>::size_type i = 0; i < m_HelperPolyLines.size(); i++)
322  {
323  m_HelperPolyLines.at(i).clear();
324  }
325  m_HelperLinesUpToDate = false;
326 }
327 
331 {
332  return m_Features.size();
333 }
334 
335 int mitk::PlanarFigure::GetControlPointForPolylinePoint(int indexOfPolylinePoint, int /*polyLineIndex*/) const
336 {
337  return indexOfPolylinePoint;
338 }
339 
340 const char *mitk::PlanarFigure::GetFeatureName(unsigned int index) const
341 {
342  if (index < m_Features.size())
343  {
344  return m_Features[index].Name.c_str();
345  }
346  else
347  {
348  return nullptr;
349  }
350 }
351 
352 const char *mitk::PlanarFigure::GetFeatureUnit(unsigned int index) const
353 {
354  if (index < m_Features.size())
355  {
356  return m_Features[index].Unit.c_str();
357  }
358  else
359  {
360  return nullptr;
361  }
362 }
363 
364 double mitk::PlanarFigure::GetQuantity(unsigned int index) const
365 {
366  if (index < m_Features.size())
367  {
368  return m_Features[index].Quantity;
369  }
370  else
371  {
372  return 0.0;
373  }
374 }
375 
376 bool mitk::PlanarFigure::IsFeatureActive(unsigned int index) const
377 {
378  if (index < m_Features.size())
379  {
380  return m_Features[index].Active;
381  }
382  else
383  {
384  return false;
385  }
386 }
387 
388 bool mitk::PlanarFigure::IsFeatureVisible(unsigned int index) const
389 {
390  if (index < m_Features.size())
391  {
392  return m_Features[index].Visible;
393  }
394  else
395  {
396  return false;
397  }
398 }
399 
400 void mitk::PlanarFigure::SetFeatureVisible(unsigned int index, bool visible)
401 {
402  if (index < m_Features.size())
403  {
404  m_Features[index].Visible = visible;
405  }
406 }
407 
409 {
410  if (!m_FeaturesUpToDate || !m_PolyLineUpToDate)
411  {
412  if (!m_PolyLineUpToDate)
413  {
414  this->GeneratePolyLine();
415  }
416 
417  this->EvaluateFeaturesInternal();
418 
419  m_FeaturesUpToDate = true;
420  }
421 }
422 
424 {
425  // Bounds are NOT calculated here, since the PlaneGeometry defines a fixed
426  // frame (= bounds) for the planar figure.
427  Superclass::UpdateOutputInformation();
428  this->GetTimeGeometry()->Update();
429 }
430 
432 {
433 }
434 
436 {
437  return false;
438 }
439 
441 {
442  return true;
443 }
444 
445 void mitk::PlanarFigure::SetRequestedRegion(const itk::DataObject * /*data*/)
446 {
447 }
448 
449 void mitk::PlanarFigure::ResetNumberOfControlPoints(int numberOfControlPoints)
450 {
451  // DO NOT resize the list here, will cause crash!!
452  m_NumberOfControlPoints = numberOfControlPoints;
453 }
454 
456 {
457  if (m_PlaneGeometry == nullptr)
458  {
459  return point;
460  }
461 
462  Point2D indexPoint;
463  m_PlaneGeometry->WorldToIndex(point, indexPoint);
464 
465  BoundingBox::BoundsArrayType bounds = m_PlaneGeometry->GetBounds();
466  if (indexPoint[0] < bounds[0])
467  {
468  indexPoint[0] = bounds[0];
469  }
470  if (indexPoint[0] > bounds[1])
471  {
472  indexPoint[0] = bounds[1];
473  }
474  if (indexPoint[1] < bounds[2])
475  {
476  indexPoint[1] = bounds[2];
477  }
478  if (indexPoint[1] > bounds[3])
479  {
480  indexPoint[1] = bounds[3];
481  }
482 
483  Point2D constrainedPoint;
484  m_PlaneGeometry->IndexToWorld(indexPoint, constrainedPoint);
485 
486  return constrainedPoint;
487 }
488 
489 unsigned int mitk::PlanarFigure::AddFeature(const char *featureName, const char *unitName)
490 {
491  unsigned int index = m_Features.size();
492 
493  Feature newFeature(featureName, unitName);
494  m_Features.push_back(newFeature);
495 
496  return index;
497 }
498 
499 void mitk::PlanarFigure::SetFeatureName(unsigned int index, const char *featureName)
500 {
501  if (index < m_Features.size())
502  {
503  m_Features[index].Name = featureName;
504  }
505 }
506 
507 void mitk::PlanarFigure::SetFeatureUnit(unsigned int index, const char *unitName)
508 {
509  if (index < m_Features.size())
510  {
511  m_Features[index].Unit = unitName;
512  }
513 }
514 
515 void mitk::PlanarFigure::SetQuantity(unsigned int index, double quantity)
516 {
517  if (index < m_Features.size())
518  {
519  m_Features[index].Quantity = quantity;
520  }
521 }
522 
523 void mitk::PlanarFigure::ActivateFeature(unsigned int index)
524 {
525  if (index < m_Features.size())
526  {
527  m_Features[index].Active = true;
528  }
529 }
530 
532 {
533  if (index < m_Features.size())
534  {
535  m_Features[index].Active = false;
536  }
537 }
538 
539 void mitk::PlanarFigure::InitializeTimeGeometry(unsigned int timeSteps)
540 {
542  geometry2D->Initialize();
543 
544  // The geometry is propagated automatically to all time steps,
545  // if EvenlyTimed is true...
547  timeGeometry->Initialize(geometry2D, timeSteps);
548  SetTimeGeometry(timeGeometry);
549 }
550 
551 void mitk::PlanarFigure::PrintSelf(std::ostream &os, itk::Indent indent) const
552 {
553  Superclass::PrintSelf(os, indent);
554  os << indent << this->GetNameOfClass() << ":\n";
555 
556  if (this->IsClosed())
557  os << indent << "This figure is closed\n";
558  else
559  os << indent << "This figure is not closed\n";
560  os << indent << "Minimum number of control points: " << this->GetMinimumNumberOfControlPoints() << std::endl;
561  os << indent << "Maximum number of control points: " << this->GetMaximumNumberOfControlPoints() << std::endl;
562  os << indent << "Current number of control points: " << this->GetNumberOfControlPoints() << std::endl;
563  os << indent << "Control points:" << std::endl;
564 
565  for (unsigned int i = 0; i < this->GetNumberOfControlPoints(); ++i)
566  {
567  // os << indent.GetNextIndent() << i << ": " << m_ControlPoints->ElementAt( i ) << std::endl;
568  os << indent.GetNextIndent() << i << ": " << m_ControlPoints.at(i) << std::endl;
569  }
570  os << indent << "Geometry:\n";
571  this->GetPlaneGeometry()->Print(os, indent.GetNextIndent());
572 }
573 
575 {
576  if (!m_PolyLineUpToDate)
577  {
578  this->GeneratePolyLine();
579  m_PolyLineUpToDate = true;
580  }
581  return m_PolyLines.size();
582 }
583 
585 {
586  return m_HelperPolyLines.size();
587 }
588 
589 bool mitk::PlanarFigure::IsHelperToBePainted(unsigned int index) const
590 {
591  return m_HelperPolyLinesToBePainted->GetElement(index);
592 }
593 
595 {
596  return false;
597 }
598 
600 {
601  return false;
602 }
603 
605 {
606  if (index > m_ControlPoints.size())
607  return;
608 
609  if ((m_ControlPoints.size() - 1) < this->GetMinimumNumberOfControlPoints())
610  return;
611 
612  ControlPointListType::iterator iter;
613  iter = m_ControlPoints.begin() + index;
614 
615  m_ControlPoints.erase(iter);
616 
617  m_PolyLineUpToDate = false;
618  m_HelperLinesUpToDate = false;
619  m_FeaturesUpToDate = false;
620 
621  --m_NumberOfControlPoints;
622 }
623 
625 {
626  RemoveControlPoint(m_ControlPoints.size() - 1);
627 }
628 
629 void mitk::PlanarFigure::SetNumberOfPolyLines(unsigned int numberOfPolyLines)
630 {
631  m_PolyLines.resize(numberOfPolyLines);
632 }
633 
634 void mitk::PlanarFigure::SetNumberOfHelperPolyLines(unsigned int numberOfHerlperPolyLines)
635 {
636  m_HelperPolyLines.resize(numberOfHerlperPolyLines);
637 }
638 
640 {
641  if (index < m_PolyLines.size())
642  {
643  m_PolyLines[index].push_back(element);
644  m_PolyLineUpToDate = false;
645  }
646  else
647  {
648  MITK_ERROR << "Tried to add point to PolyLine " << index + 1 << ", although only " << m_PolyLines.size()
649  << " exists";
650  }
651 }
652 
654 {
655  if (index < m_HelperPolyLines.size())
656  {
657  m_HelperPolyLines[index].push_back(element);
658  m_HelperLinesUpToDate = false;
659  }
660  else
661  {
662  MITK_ERROR << "Tried to add point to HelperPolyLine " << index + 1 << ", although only " << m_HelperPolyLines.size()
663  << " exists";
664  }
665 }
666 
668 {
669  // check geometries
670  if (this->GetPlaneGeometry() && other.GetPlaneGeometry())
671  {
672  if (!Equal(*(this->GetPlaneGeometry()), *(other.GetPlaneGeometry()), mitk::eps, true))
673  {
674  return false;
675  }
676  }
677  else
678  {
679  MITK_ERROR << "Geometry is not equal";
680  return false;
681  }
682 
683  // check isPlaced member
684  if (this->m_FigurePlaced != other.m_FigurePlaced)
685  {
686  MITK_ERROR << "Is_Placed is not equal";
687  return false;
688  }
689 
690  // check closed property
691  if (this->IsClosed() != other.IsClosed())
692  {
693  MITK_ERROR << "Is_closed is not equal";
694  return false;
695  }
696 
697  // check poly lines
698  if (this->m_PolyLines.size() != other.m_PolyLines.size())
699  {
700  return false;
701  }
702  else
703  {
704  auto itThis = this->m_PolyLines.begin();
705  auto itEnd = this->m_PolyLines.end();
706  auto itOther = other.m_PolyLines.begin();
707 
708  while (itThis != itEnd)
709  {
710  if (itThis->size() != itOther->size())
711  return false;
712  else
713  {
714  auto itLineThis = itThis->begin();
715  auto itLineEnd = itThis->end();
716  auto itLineOther = itOther->begin();
717 
718  while (itLineThis != itLineEnd)
719  {
720  Point2D p1 = *itLineThis;
721  Point2D p2 = *itLineOther;
722  ScalarType delta = fabs(p1[0] - p2[0]) + fabs(p1[1] - p2[1]);
723  if (delta > .001)
724  {
725  MITK_ERROR << "Poly line is not equal";
726  MITK_ERROR << p1 << "/" << p2;
727  return false;
728  }
729 
730  ++itLineThis;
731  ++itLineOther;
732  }
733  }
734  ++itThis;
735  ++itOther;
736  }
737  }
738 
739  // check features
740  if (this->GetNumberOfFeatures() != other.GetNumberOfFeatures())
741  {
742  MITK_ERROR << "Number of Features is Different";
743  return false;
744  }
745  else
746  {
747  auto itThis = m_Features.begin();
748  auto itEnd = m_Features.end();
749  auto itOther = other.m_Features.begin();
750 
751  while (itThis != itEnd)
752  {
753  if ((itThis->Quantity - itOther->Quantity) > .001)
754  {
755  MITK_ERROR << "Quantity is Different" << itThis->Quantity << "/" << itOther->Quantity;
756  return false;
757  }
758  if (itThis->Unit.compare(itOther->Unit) != 0)
759  {
760  MITK_ERROR << "Unit is Different" << itThis->Unit << "/" << itOther->Unit;
761  return false;
762  }
763  if (itThis->Name.compare(itOther->Name) != 0)
764  {
765  MITK_ERROR << "Name of Measure is Different " << itThis->Name << "/ " << itOther->Name;
766  ;
767  return false;
768  }
769 
770  ++itThis;
771  ++itOther;
772  }
773  }
774 
775  return true;
776 }
777 
778 bool mitk::Equal(const mitk::PlanarFigure &leftHandSide,
779  const mitk::PlanarFigure &rightHandSide,
780  ScalarType /*eps*/,
781  bool /*verbose*/)
782 {
783  // FIXME: use eps and verbose
784  return leftHandSide.Equals(rightHandSide);
785 }
virtual bool IsHelperToBePainted(unsigned int index) const
Returns whether a helper polyline should be painted or not.
void DeactivateFeature(unsigned int index)
bool IsFeatureActive(unsigned int index) const
Returns true if the feature with the specified index exists and is active (an inactive feature may e...
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const override
Base of all data objects.
Definition: mitkBaseData.h:39
bool IsFeatureVisible(unsigned int index) const
Returns true if the feature with the specified index exists and is set visible.
virtual unsigned int AddFeature(const char *featureName, const char *unitName)
virtual void RemoveLastControlPoint()
Removes last control point.
#define MITK_ERROR
Definition: mitkLogMacros.h:24
double ScalarType
const char * GetFeatureName(unsigned int index) const
Returns the name (identifier) of the specified features.
void ResetNumberOfControlPoints(int numberOfControlPoints)
Set the initial number of control points of the planar figure.
virtual unsigned int GetNumberOfFeatures() const
Returns the number of features available for this PlanarFigure (such as, radius, area, ...).
virtual unsigned short GetHelperPolyLinesSize() const
Returns the current number of helperpolylines.
virtual const PlaneGeometry * GetPlaneGeometry() const
Returns (previously set) 2D geometry of this figure.
double GetQuantity(unsigned int index) const
virtual bool VerifyRequestedRegion() override
Intherited from parent.
Point2D GetPreviewControlPoint() const
Returns the coordinates of the PreviewControlPoint.
const PolyLineType GetPolyLine(unsigned int index)
Returns the polyline representing the planar figure (for rendering, measurements, etc...
virtual void SetRequestedRegion(const itk::DataObject *data) override
Intherited from parent.
static Pointer New()
virtual void EvaluateFeatures()
Calculates quantities of all features of this planar figure.
void SetProperty(const char *propertyKey, BaseProperty *property)
virtual bool Equals(const mitk::PlanarFigure &other) const
Compare two PlanarFigure objects Note: all subclasses have to implement the method on their own...
void SetQuantity(unsigned int index, double quantity)
void SetFeatureVisible(unsigned int index, bool visible)
Defines if the feature with the specified index will be shown as an overlay in the RenderWindow...
virtual bool ResetOnPointSelectNeeded() const
void ResetPreviewContolPoint()
Marks the PreviewControlPoint as invisible.
virtual int GetControlPointForPolylinePoint(int indexOfPolylinePoint, int polyLineIndex) const
Returns the id of the control-point that corresponds to the given polyline-point. ...
virtual bool IsClosed() const
True if the planar figure is closed.
virtual bool ResetOnPointSelect()
Returns true if the planar figure is reset to "add points" mode when a point is selected.
virtual void UpdateOutputInformation() override
Intherited from parent.
void SetNumberOfHelperPolyLines(unsigned int numberOfHelperPolyLines)
defines the number of HelperPolyLines that will be available
virtual void PlaceFigure(const Point2D &point)
Place figure at the given point (in 2D index coordinates) onto the given 2D geometry.
virtual Point2D ApplyControlPointConstraints(unsigned int, const Point2D &point)
Allow sub-classes to apply constraints on control points.
void ActivateFeature(unsigned int index)
virtual unsigned short GetPolyLinesSize()
Returns the current number of polylines.
virtual bool SetCurrentControlPoint(const Point2D &point)
const PolyLineType GetHelperPolyLine(unsigned int index, double mmPerDisplayUnit, unsigned int displayHeight)
Returns the polyline that should be drawn the same size at every scale (for text, angles...
void AppendPointToPolyLine(unsigned int index, PolyLineElement element)
Append a point to the PolyLine # index.
Point3D GetWorldControlPoint(unsigned int index) const
Returns specified control point in world coordinates.
bool IsPreviewControlPointVisible() const
Returns whether or not the PreviewControlPoint is visible.
void SetNumberOfPolyLines(unsigned int numberOfPolyLines)
defines the number of PolyLines that will be available
virtual bool DeselectControlPoint()
Deselect control point; no control point active.
const char * GetFeatureUnit(unsigned int index) const
Returns the physical unit of the specified features.
void SetFeatureName(unsigned int index, const char *featureName)
virtual void SetPlaneGeometry(mitk::PlaneGeometry *geometry)
Sets the 2D geometry on which this figure will be placed.
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.
virtual bool SetControlPoint(unsigned int index, const Point2D &point, bool createIfDoesNotExist=false)
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons...
void AppendPointToHelperPolyLine(unsigned int index, PolyLineElement element)
Append a point to the HelperPolyLine # index.
void ClearHelperPolyLines()
clears the list of HelperPolyLines. Call before re-calculating a new HelperPolyline.
BoolContainerType::Pointer m_HelperPolyLinesToBePainted
Point2D GetControlPoint(unsigned int index) const
Returns specified control point in 2D world coordinates.
static Pointer New()
MITKCORE_EXPORT const ScalarType eps
virtual void RemoveControlPoint(unsigned int index)
removes the point with the given index from the list of controlpoints.
std::vector< PolyLineElement > PolyLineType
std::vector< PolyLineType > m_PolyLines
virtual bool SelectControlPoint(unsigned int index)
Selects currently active control points.
Describes a two-dimensional, rectangular plane.
void SetPreviewControlPoint(const Point2D &point)
Sets the position of the PreviewControlPoint. Automatically sets it visible.
virtual void InitializeTimeGeometry(unsigned int timeSteps=1) override
Initializes the TimeGeometry describing the (time-resolved) geometry of this figure. Note that each time step holds one PlaneGeometry.
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Intherited from parent.
virtual bool AddControlPoint(const Point2D &point, int index=-1)
Adds / inserts new control-points.
unsigned int GetNumberOfControlPoints() const
Returns the current number of 2D control points defining this figure.
virtual void SetRequestedRegionToLargestPossibleRegion() override
Intherited from parent.
void ClearPolyLines()
clears the list of PolyLines. Call before re-calculating a new Polyline.
BoundingBoxType::BoundsArrayType BoundsArrayType
virtual T GetValue() const
void SetFeatureUnit(unsigned int index, const char *unitName)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.