CustusX  22.04-rc5
An IGT application
cxRegionOfInterestMetricRep.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
14 #include "cxView.h"
15 
16 #include <vtkVectorText.h>
17 #include <vtkFollower.h>
18 #include <vtkPolyDataMapper.h>
19 #include <vtkProperty.h>
20 #include <vtkRenderer.h>
21 #include <vtkCamera.h>
22 #include <vtkRenderWindow.h>
23 #include "cxTypeConversions.h"
24 #include "cxGraphicalBox.h"
25 
26 namespace cx
27 {
28 
30 {
31  return wrap_new(new RegionOfInterestMetricRep(), uid);
32 }
33 
34 RegionOfInterestMetricRep::RegionOfInterestMetricRep()
35 {
36 }
37 
39 {
41  mGraphicalBox.reset();
42 }
43 
44 RegionOfInterestMetricPtr RegionOfInterestMetricRep::getRegionOfInterestMetric()
45 {
46  return boost::dynamic_pointer_cast<RegionOfInterestMetric>(mMetric);
47 }
48 
50 {
51  RegionOfInterestMetricPtr metric = this->getRegionOfInterestMetric();
52  if (!metric)
53  return;
54 
55  if (!mMetric->isValid())
56  return;
57 
58  if (!mGraphicalBox && this->getView())
59  {
60  mGraphicalBox.reset(new GraphicalBox());
61  mGraphicalBox->setRenderWindow(this->getView()->getRenderWindow());
62  }
63 
64  if (mGraphicalBox)
65  {
66  mGraphicalBox->setBoundingBox(metric->getROI().getBox());
67  mGraphicalBox->setPosition(Transform3D::Identity());
68 // mGraphicalBox->setPosition(metric->get_rMd()); // ROI is already in r
69 // mGraphicalBox->setColor(mMetric->getColor());
70  }
71 
72 
73  mGraphicalBox->setInteractive(false);
74 // mGraphicalBox->setVisible(false);
75 
76  this->drawText();
77 }
78 
79 
80 }
ViewPtr getView() const
Definition: cxRepImpl.cpp:83
virtual void clear()
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
Definition: cxRepImpl.h:62
Rep for visualizing a RegionOfInterestMetric.
boost::shared_ptr< class RegionOfInterestMetricRep > RegionOfInterestMetricRepPtr
boost::shared_ptr< class RegionOfInterestMetric > RegionOfInterestMetricPtr
static RegionOfInterestMetricRepPtr New(const QString &uid="")
DataMetricPtr mMetric
Namespace for all CustusX production code.