QXRD  0.11.16
Public Slots | Public Member Functions | Private Member Functions | Private Attributes | List of all members
QxrdSliceDialog Class Reference

#include <qxrdslicedialog.h>

Inheritance diagram for QxrdSliceDialog:
Inheritance graph
[legend]
Collaboration diagram for QxrdSliceDialog:
Collaboration graph
[legend]

Public Slots

void slicePolygon (QVector< QPointF > poly)
 

Public Member Functions

 QxrdSliceDialog (QxrdSliceDialogSettingsWPtr settings, QWidget *parent)
 
virtual ~QxrdSliceDialog ()
 
void onProcessedImageAvailable (QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow)
 

Private Member Functions

void reslice ()
 

Private Attributes

QxrdSliceDialogSettingsWPtr m_SliceDialogSettings
 
QcepDoubleImageDataPtr m_Image
 

Detailed Description

Definition at line 11 of file qxrdslicedialog.h.

Constructor & Destructor Documentation

QxrdSliceDialog::QxrdSliceDialog ( QxrdSliceDialogSettingsWPtr  settings,
QWidget *  parent 
)
explicit

Definition at line 8 of file qxrdslicedialog.cpp.

References DEBUG_CONSTRUCTORS, m_SliceDialogSettings, and qcepDebug().

8  :
9  QDockWidget(parent),
10  m_SliceDialogSettings(settings)
11 {
13  printf("QxrdSliceDialog::QxrdSliceDialog(%p)\n", this);
14  }
15 
16  setupUi(this);
17 
19 
20  if (set) {
21  m_SlicePlot->init(set->slicePlotSettings());
22  }
23 }
QxrdSliceDialogSettingsWPtr m_SliceDialogSettings
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QSharedPointer< QxrdSliceDialogSettings > QxrdSliceDialogSettingsPtr

Here is the call graph for this function:

QxrdSliceDialog::~QxrdSliceDialog ( )
virtual

Definition at line 25 of file qxrdslicedialog.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

26 {
28  printf("QxrdSliceDialog::~QxrdSliceDialog(%p)\n", this);
29  }
30 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

Member Function Documentation

void QxrdSliceDialog::onProcessedImageAvailable ( QcepDoubleImageDataPtr  image,
QcepMaskDataPtr  overflow 
)

Definition at line 32 of file qxrdslicedialog.cpp.

References m_Image, and reslice().

33 {
34  m_Image = image;
35 
36  reslice();
37 }
QcepDoubleImageDataPtr m_Image

Here is the call graph for this function:

void QxrdSliceDialog::reslice ( )
private

Definition at line 50 of file qxrdslicedialog.cpp.

References m_Image, and m_SliceDialogSettings.

Referenced by onProcessedImageAvailable(), and slicePolygon().

51 {
52  m_SlicePlot->detachItems(QwtPlotItem::Rtti_PlotCurve);
53  m_SlicePlot->detachItems(QwtPlotItem::Rtti_PlotMarker);
54 
56 
57  if (set && m_Image) {
58  QVector<double> xp,yp;
59  QString title = m_Image->get_Title();
60 
61  double length = 0;
62 
63  QcepPolygon poly = set->get_SlicePolygon();
64 
65  if (poly.size() >= 2) {
66  QPointF p0 = poly[0];
67 
68  for (int i=1; i<poly.size(); i++) {
69  QPointF p1 = poly[i];
70  double dx = p1.x() - p0.x();
71  double dy = p1.y() - p0.y();
72  length += sqrt(dx*dx + dy*dy);
73  p0=p1;
74  }
75 
76  p0 = poly[0];
77  double r = 0;
78  double r0 = 0;
79 
80  title += tr(" [%1,%2]").arg(p0.x()).arg(p0.y());
81 
82  for (int i=1; i<poly.size(); i++) {
83  QPointF p1 = poly[i];
84  double dx = p1.x() - p0.x();
85  double dy = p1.y() - p0.y();
86  double len = sqrt(dx*dx + dy*dy);
87 
88  if (len > 0) {
89  for (; r<len; r+=1) {
90  double x = p0.x() + r*dx/len;
91  double y = p0.y() + r*dy/len;
92 
93  xp.append(r+r0);
94  yp.append(m_Image->value((int) x, (int) y));
95  }
96  }
97 
98  p0 = p1;
99  r0 += len;
100  r -= len;
101  }
102 
103  if (poly.size() > 2) {
104  title += "...";
105  } else {
106  title += "-";
107  }
108 
109  QPointF p1 = poly.last();
110  title += tr("[%1,%2]").arg(p1.x()).arg(p1.y());
111 
112  QwtPlotCurve *pc = new QwtPlotPiecewiseCurve(m_SlicePlot, title);
113 
114  pc->setSamples(xp, yp);
115 
116  pc->attach(m_SlicePlot);
117 
118  m_SlicePlot->updateZoomer();
119  m_SlicePlot->replot();
120  }
121  }
122 }
QxrdSliceDialogSettingsWPtr m_SliceDialogSettings
A class which draws piecewise curves.
QVector< QPointF > QcepPolygon
Definition: qcepmacros.h:37
QcepDoubleImageDataPtr m_Image
QSharedPointer< QxrdSliceDialogSettings > QxrdSliceDialogSettingsPtr

Here is the caller graph for this function:

void QxrdSliceDialog::slicePolygon ( QVector< QPointF >  poly)
slot

Definition at line 39 of file qxrdslicedialog.cpp.

References m_SliceDialogSettings, and reslice().

Referenced by QxrdWindow::initialize().

40 {
42 
43  if (set) {
44  set->set_SlicePolygon(poly);
45  }
46 
47  reslice();
48 }
QxrdSliceDialogSettingsWPtr m_SliceDialogSettings
QSharedPointer< QxrdSliceDialogSettings > QxrdSliceDialogSettingsPtr

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

QcepDoubleImageDataPtr QxrdSliceDialog::m_Image
private

Definition at line 29 of file qxrdslicedialog.h.

Referenced by onProcessedImageAvailable(), and reslice().

QxrdSliceDialogSettingsWPtr QxrdSliceDialog::m_SliceDialogSettings
private

Definition at line 28 of file qxrdslicedialog.h.

Referenced by QxrdSliceDialog(), reslice(), and slicePolygon().


The documentation for this class was generated from the following files: