Medical Imaging Interaction Toolkit  2016.11.0
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,
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 
19 
20 
21 QmitkFreeIsoDoseLevelWidget::QmitkFreeIsoDoseLevelWidget(QWidget*): m_ReferenceDose (40.0), m_InternalUpdate(false)
22 {
23  this->setupUi(this);
24 
25  this->colorBtn->setDisplayColorName(false);
27 
28  connect(this->sbAbsValue, SIGNAL(valueChanged(double)), this, SLOT(OnAbsValueChanged(double)));
29  connect(this->sbRelValue, SIGNAL(valueChanged(double)), this, SLOT(OnRelValueChanged(double)));
30  connect(this->doseSlider, SIGNAL(valueChanged(int)), this, SLOT(OnSliderChanged(int)));
31  connect(this->checkVisibleIso, SIGNAL(clicked(bool)), this, SLOT(OnVisibleClicked(bool)));
32  connect(this->colorBtn, SIGNAL(colorChanged(QColor)), this, SLOT(OnColorChanged(QColor)));
33 }
34 
38 {
39  return this->m_ReferenceDose;
40 };
41 
45 {
46  return this->m_IsoDoseLevel;
47 };
48 
50  setReferenceDose(double newReferenceDose)
51 {
52  if (newReferenceDose != m_ReferenceDose)
53  {
54  this->m_ReferenceDose = newReferenceDose;
55  this->update();
56  }
57 };
58 
61 {
62  if (level != m_IsoDoseLevel)
63  {
64  if(!level)
65  {
66  mitkThrow() << "Error. Cannot set iso dose level for widget to NULL pointer.";
67  }
68 
69  this->m_IsoDoseLevel = level;
70  this->update();
71  }
72 }
73 
75  OnRelValueChanged(double newValue)
76 {
77  if(!m_InternalUpdate)
78  {
79  updateValue(newValue/100.0);
80  }
81 };
82 
84  OnAbsValueChanged(double newValue)
85 {
86  if(!m_InternalUpdate)
87  {
88  updateValue(newValue/this->m_ReferenceDose);
89  }
90 };
91 
93  OnSliderChanged(int newValue)
94 {
95  if(!m_InternalUpdate)
96  {
97  updateValue(newValue/100.0);
98  }
99 };
100 
102  OnVisibleClicked(bool checked)
103 {
104  this->m_IsoDoseLevel->SetVisibleIsoLine(checked);
106 };
107 
109  OnColorChanged(QColor color)
110 {
112  doseColor.SetRed(color.redF());
113  doseColor.SetGreen(color.greenF());
114  doseColor.SetBlue(color.blueF());
115  this->m_IsoDoseLevel->SetColor(doseColor);
116  emit ColorChanged(this->m_IsoDoseLevel);
117 };
118 
121 {
122  m_InternalUpdate = true;
123 
124  mitk::DoseValueRel oldValue = this->m_IsoDoseLevel->GetDoseValue();
125  this->m_IsoDoseLevel->SetDoseValue(newDose);
126  this->sbAbsValue->setValue(newDose*this->m_ReferenceDose);
127  this->sbRelValue->setValue(newDose*100);
128  this->doseSlider->setValue(newDose*100);
129 
130  m_InternalUpdate = false;
131 
132  emit ValueChanged(this->m_IsoDoseLevel,oldValue);
133 };
134 
137 {
138  updateValue(this->m_IsoDoseLevel->GetDoseValue());
139 
140  this->checkVisibleIso->setChecked(this->m_IsoDoseLevel->GetVisibleIsoLine());
141 
142  QColor color;
143  color.setRgbF(this->m_IsoDoseLevel->GetColor().GetRed(),this->m_IsoDoseLevel->GetColor().GetGreen(),this->m_IsoDoseLevel->GetColor().GetBlue());
144  this->colorBtn->setColor(color);
145 };
mitk::DoseValueAbs getReferenceDose() const
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)
mitk::IsoDoseLevel * getIsoDoseLevel() const
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.
double DoseValueAbs
Represents absolute dose values (in Gy).
static Pointer New()
double DoseValueRel
Represents relative dose values (in %).
mitk::IsoDoseLevel::Pointer m_IsoDoseLevel