Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkODFDetailsWidget.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 "QmitkODFDetailsWidget.h"
18 
19 #include <qwt_scale_engine.h>
20 
22  : QmitkPlotWidget(parent)
23 {
24  QFrame* canvas = qobject_cast<QFrame*>(m_Plot->canvas());
25  if (canvas)
26  {
27  canvas->setLineWidth(0);
28  canvas->setContentsMargins(0,0,0,0);
29  }
30 
31  auto scale = new QwtLinearScaleEngine();
32  m_Plot->setAxisScaleEngine(0, scale);
33 
34  m_Plot->setAxisScale ( 0, -0.5, 0.5 );
35 }
36 
38 {
39 }
40 
42 {
43  this->Clear();
44 
45  std::vector<double> xVals;
46  std::vector<double> yVals;
47  float max = itk::NumericTraits<float>::NonpositiveMin();
49 
50  for (int i=0; i<QBALL_ODFSIZE; i++){
51  xVals.push_back(i);
52  yVals.push_back(odf[i]);
53  if (odf[i]>max)
54  max = odf[i];
55  if (odf[i]<min)
56  min = odf[i];
57  }
58 
59  if(min>0)
60  m_Plot->setAxisScale ( 0, 0, max );
61  else
62  m_Plot->setAxisScale ( 0, min, max );
63 
64  int curveId = this->InsertCurve( "ODF Values" );
65  this->SetCurveData( curveId, xVals, yVals );
66  this->SetCurvePen( curveId, QPen(Qt::blue, 0.5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin) );
67  this->Replot();
68 }
69 
void SetParameters(itk::OrientationDistributionFunction< double, QBALL_ODFSIZE > odf)
void SetCurvePen(unsigned int curveId, const QPen &pen)
Represents an ODF for Q-Ball imaging.
unsigned int InsertCurve(const char *title, QColor color=QColor(Qt::black))
bool SetCurveData(unsigned int curveId, const DataVector &xValues, const DataVector &yValues)
#define QBALL_ODFSIZE
static T max(T x, T y)
Definition: svm.cpp:70
static T min(T x, T y)
Definition: svm.cpp:67