Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
QmitkResidualAnalysisWidget.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 
18 
19 #include <QPen>
20 
21 #include <qwt_legend.h>
22 #include <qwt_plot_picker.h>
23 #include <qwt_picker_machine.h>
24 
25 
27  : QmitkPlotWidget(parent)
28 {
29  m_PlotPicker = new QwtPlotPicker(m_Plot->canvas());
30  m_PlotPicker->setStateMachine(new QwtPickerDragPointMachine());
31  m_PlotPicker->setTrackerMode(QwtPicker::ActiveOnly);
32 }
33 
34 
35 
37 {
38  delete m_PlotPicker;
39 }
40 
41 
43 {
44  this->Clear();
45  this->SetPlotTitle("mean residual per volume");
46  QPen pen( Qt::SolidLine );
47  pen.setWidth(1);
48 
49 
50  // Create values for x-axis
51  std::vector<double> xAxis;
52  for(unsigned int i=0; i<m_Means.size(); ++i)
53  {
54  xAxis.push_back((double)i);
55  }
56 
57  pen.setColor(Qt::black);
58  int curveId = this->InsertCurve( "Mean" );
59  this->SetCurveData( curveId, xAxis, m_Means );
60  this->SetCurvePen( curveId, pen );
61  this->SetCurveStyle( curveId, QwtPlotCurve::Dots);
62 
63  pen.setColor(Qt::blue);
64  curveId = this->InsertCurve( "Q1" );
65  this->SetCurveData( curveId, xAxis, m_Q1 );
66  this->SetCurvePen( curveId, pen );
67  this->SetCurveStyle( curveId, QwtPlotCurve::Dots);
68 
69  pen.setColor(Qt::red);
70  curveId = this->InsertCurve( "Q3" );
71  this->SetCurveData( curveId, xAxis, m_Q3 );
72  this->SetCurvePen( curveId, pen );
73  this->SetCurveStyle( curveId, QwtPlotCurve::Dots);
74 
75 
76  this->m_Plot->setAxisTitle(0, "Residual");
77  this->m_Plot->setAxisTitle(3, "DWI Volume");
78 
79 
80  auto legend = new QwtLegend;
81  this->SetLegend(legend, QwtPlot::RightLegend, 0.5);
82 
83  this->Replot();
84 
85 }
86 
88 {
89  this->Clear();
90 
91 
92  this->SetPlotTitle("Percentage of outliers");
93  QPen pen( Qt::SolidLine );
94  pen.setWidth(1);
95 
96 
97  // Create values for x-axis
98  std::vector<double> xAxis;
99  for(unsigned int i=0; i<m_PercentagesOfOutliers.size(); ++i)
100  {
101  xAxis.push_back((double)i);
102  }
103 
104  pen.setColor(Qt::black);
105  int curveId = this->InsertCurve( "Outliers" );
106  this->SetCurveData( curveId, xAxis, m_PercentagesOfOutliers );
107  this->SetCurvePen( curveId, pen );
108  //this->SetCurveStyle( curveId, QwtPlotCurve::Fitted);
109 
110  this->m_Plot->setAxisTitle(0, "Percentage of outliers");
111  this->m_Plot->setAxisTitle(3, "DWI Volume");
112 
113  auto legend = new QwtLegend;
114  this->SetLegend(legend, QwtPlot::RightLegend, 0.5);
115 
116  this->Replot();
117 }
void SetPlotTitle(const QwtText &qwt_title)
void SetCurveStyle(unsigned int curveId, const QwtPlotCurve::CurveStyle style)
void SetCurvePen(unsigned int curveId, const QPen &pen)
unsigned int InsertCurve(const char *title, QColor color=QColor(Qt::black))
bool SetCurveData(unsigned int curveId, const DataVector &xValues, const DataVector &yValues)
void SetLegend(QwtLegend *legend, QwtPlot::LegendPosition pos=QwtPlot::RightLegend, double ratio=-1)
std::vector< double > m_PercentagesOfOutliers