Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkFreeIsoDoseLevelWidget.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 (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 
15 
16 
17 QmitkFreeIsoDoseLevelWidget::QmitkFreeIsoDoseLevelWidget(QWidget*): m_ReferenceDose (40.0), m_InternalUpdate(false)
18 {
19  this->setupUi(this);
20 
21  this->colorBtn->setDisplayColorName(false);
23 
24  connect(this->sbAbsValue, SIGNAL(valueChanged(double)), this, SLOT(OnAbsValueChanged(double)));
25  connect(this->sbRelValue, SIGNAL(valueChanged(double)), this, SLOT(OnRelValueChanged(double)));
26  connect(this->doseSlider, SIGNAL(valueChanged(int)), this, SLOT(OnSliderChanged(int)));
27  connect(this->checkVisibleIso, SIGNAL(clicked(bool)), this, SLOT(OnVisibleClicked(bool)));
28  connect(this->colorBtn, SIGNAL(colorChanged(QColor)), this, SLOT(OnColorChanged(QColor)));
29 }
30 
34 {
35  return this->m_ReferenceDose;
36 };
37 
41 {
42  return this->m_IsoDoseLevel;
43 };
44 
46  setReferenceDose(double newReferenceDose)
47 {
48  if (newReferenceDose != m_ReferenceDose)
49  {
50  this->m_ReferenceDose = newReferenceDose;
51  this->update();
52  }
53 };
54 
57 {
58  if (level != m_IsoDoseLevel)
59  {
60  if(!level)
61  {
62  mitkThrow() << "Error. Cannot set iso dose level for widget to nullptr pointer.";
63  }
64 
65  this->m_IsoDoseLevel = level;
66  this->update();
67  }
68 }
69 
71  OnRelValueChanged(double newValue)
72 {
73  if(!m_InternalUpdate)
74  {
75  updateValue(newValue/100.0);
76  }
77 };
78 
80  OnAbsValueChanged(double newValue)
81 {
82  if(!m_InternalUpdate)
83  {
84  updateValue(newValue/this->m_ReferenceDose);
85  }
86 };
87 
89  OnSliderChanged(int newValue)
90 {
91  if(!m_InternalUpdate)
92  {
93  updateValue(newValue/100.0);
94  }
95 };
96 
98  OnVisibleClicked(bool checked)
99 {
100  this->m_IsoDoseLevel->SetVisibleIsoLine(checked);
102 };
103 
105  OnColorChanged(QColor color)
106 {
108  doseColor.SetRed(color.redF());
109  doseColor.SetGreen(color.greenF());
110  doseColor.SetBlue(color.blueF());
111  this->m_IsoDoseLevel->SetColor(doseColor);
112  emit ColorChanged(this->m_IsoDoseLevel);
113 };
114 
117 {
118  m_InternalUpdate = true;
119 
120  mitk::DoseValueRel oldValue = this->m_IsoDoseLevel->GetDoseValue();
121  this->m_IsoDoseLevel->SetDoseValue(newDose);
122  this->sbAbsValue->setValue(newDose*this->m_ReferenceDose);
123  this->sbRelValue->setValue(newDose*100);
124  this->doseSlider->setValue(newDose*100);
125 
126  m_InternalUpdate = false;
127 
128  emit ValueChanged(this->m_IsoDoseLevel,oldValue);
129 };
130 
133 {
134  updateValue(this->m_IsoDoseLevel->GetDoseValue());
135 
136  this->checkVisibleIso->setChecked(this->m_IsoDoseLevel->GetVisibleIsoLine());
137 
138  QColor color;
139  color.setRgbF(this->m_IsoDoseLevel->GetColor().GetRed(),this->m_IsoDoseLevel->GetColor().GetGreen(),this->m_IsoDoseLevel->GetColor().GetBlue());
140  this->colorBtn->setColor(color);
141 };
void VisualizationStyleChanged(mitk::IsoDoseLevel *)
void setIsoDoseLevel(mitk::IsoDoseLevel *level)
Slot that can be used to set the dose level instance that should be handled by the widget...
void updateValue(mitk::DoseValueRel newDose)
QmitkFreeIsoDoseLevelWidget(QWidget *parent=nullptr)
void setReferenceDose(double newReferenceDose)
Slot that can be used to set the reference dose.
void ColorChanged(mitk::IsoDoseLevel *)
Stores values needed for the representation/visualization of dose iso levels.
void ValueChanged(mitk::IsoDoseLevel *, mitk::DoseValueRel oldValue)
#define mitkThrow()
::itk::RGBPixel< float > ColorType
void update()
Updates the widget according to its current settings.
mitk::DoseValueAbs getReferenceDose() const
mitk::IsoDoseLevel * getIsoDoseLevel() const
double DoseValueAbs
Represents absolute dose values (in Gy).
static Pointer New()
double DoseValueRel
Represents relative dose values (in %).
mitk::IsoDoseLevel::Pointer m_IsoDoseLevel