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

#include <qxrdrasterdata.h>

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

Public Member Functions

 QxrdRasterData (QcepImageDataBasePtr img=QcepImageDataBasePtr(), int interp=1, QwtInterval range=QwtInterval(0, 40000))
 
double value (double x, double y) const
 
QwtInterval range () const
 
void setDisplayedRange (double min, double max)
 
double minValue ()
 
double maxValue ()
 
void setInterpolate (int interp)
 
int interpolate ()
 
QwtInterval percentileRange (double lowpct, double highpct)
 
int width () const
 
int height () const
 
const QcepImageDataBasePtr data () const
 
int interp () const
 
QPointF optimizePeakPosition (QPointF pt) const
 

Private Attributes

QcepImageDataBasePtr m_Data
 
int m_NRows
 
int m_NCols
 
QwtInterval m_Range
 
int m_Interpolate
 

Detailed Description

Definition at line 10 of file qxrdrasterdata.h.

Constructor & Destructor Documentation

QxrdRasterData::QxrdRasterData ( QcepImageDataBasePtr  img = QcepImageDataBasePtr(),
int  interp = 1,
QwtInterval  range = QwtInterval(0,40000) 
)

Definition at line 6 of file qxrdrasterdata.cpp.

References DEBUG_IMAGES, g_Application, HEXARG, m_NCols, m_NRows, QcepApplication::printMessage(), and qcepDebug().

7  : QwtRasterData(),
8  m_Data(img),
9  m_NRows((img ? img->get_Height(): 0)),
10  m_NCols((img ? img->get_Width() : 0)),
11  m_Range(range),
13 {
14  if (qcepDebug(DEBUG_IMAGES)) {
15  if (g_Application) {
16  g_Application->printMessage(QObject::tr("QxrdRasterData::QxrdRasterData(%1,%2) [%3]")
17  .HEXARG(img.data()).arg(interp).HEXARG(this));
18  }
19  }
20 
21  setInterval(Qt::XAxis, QwtInterval(0.0, m_NCols));
22  setInterval(Qt::YAxis, QwtInterval(0.0, m_NRows));
23  setInterval(Qt::ZAxis, range);
24 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QwtInterval range() const
int interp() const
QcepImageDataBasePtr m_Data
#define HEXARG(a)
Definition: qcepdebug.h:50
QwtInterval m_Range
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
QcepApplication * g_Application

Here is the call graph for this function:

Member Function Documentation

const QcepImageDataBasePtr QxrdRasterData::data ( ) const
inline

Definition at line 33 of file qxrdrasterdata.h.

References m_Data.

33 { return m_Data; }
QcepImageDataBasePtr m_Data
int QxrdRasterData::height ( ) const

Definition at line 116 of file qxrdrasterdata.cpp.

References m_NRows.

Referenced by QxrdImagePlot::onMaskedImageAvailable(), and QxrdImagePlot::onProcessedImageAvailable().

117 {
118  return m_NRows;
119 }

Here is the caller graph for this function:

int QxrdRasterData::interp ( ) const
inline

Definition at line 34 of file qxrdrasterdata.h.

References m_Interpolate.

Referenced by setInterpolate().

34 { return m_Interpolate; }

Here is the caller graph for this function:

int QxrdRasterData::interpolate ( )

Definition at line 33 of file qxrdrasterdata.cpp.

References m_Interpolate.

34 {
35  return m_Interpolate;
36 }
double QxrdRasterData::maxValue ( )

Definition at line 88 of file qxrdrasterdata.cpp.

References m_Data.

Referenced by QxrdImagePlot::recalculateDisplayedRange().

89 {
90  if (m_Data) {
91  return m_Data->maxValue();
92  } else {
93  return 0;
94  }
95 }
QcepImageDataBasePtr m_Data

Here is the caller graph for this function:

double QxrdRasterData::minValue ( )

Definition at line 79 of file qxrdrasterdata.cpp.

References m_Data.

Referenced by QxrdImagePlot::recalculateDisplayedRange().

80 {
81  if (m_Data) {
82  return m_Data->minValue();
83  } else {
84  return 0;
85  }
86 }
QcepImageDataBasePtr m_Data

Here is the caller graph for this function:

QPointF QxrdRasterData::optimizePeakPosition ( QPointF  pt) const

Definition at line 121 of file qxrdrasterdata.cpp.

References value().

Referenced by QxrdImagePlot::trackerTextF().

122 {
123  int rad = 10;
124  int ix = pt.x();
125  int iy = pt.y();
126  int first = 1;
127 
128  double max;
129  int maxx = 0, maxy = 0;
130 
131  for (int j=iy-rad; j<iy+rad; j++) {
132  for (int i=ix-rad; i<ix+rad; i++) {
133  double val=value(i,j);
134 
135  if (first) {
136  max = val; maxx = i; maxy = j;
137  first = 0;
138  } else if (val > max) {
139  max = val; maxx = i; maxy = j;
140  }
141  }
142  }
143 
144  return QPointF(maxx, maxy);
145 }
double value(double x, double y) const

Here is the call graph for this function:

Here is the caller graph for this function:

QwtInterval QxrdRasterData::percentileRange ( double  lowpct,
double  highpct 
)

Definition at line 97 of file qxrdrasterdata.cpp.

References m_Data.

Referenced by QxrdImagePlot::recalculateDisplayedRange().

98 {
99  QwtInterval res;
100 
101  if (m_Data) {
102  QPointF r = m_Data->percentileRange(lowpct, highpct);
103 
104  res.setMinValue(r.x());
105  res.setMaxValue(r.y());
106  }
107 
108  return res;
109 }
QcepImageDataBasePtr m_Data

Here is the caller graph for this function:

QwtInterval QxrdRasterData::range ( ) const

Definition at line 67 of file qxrdrasterdata.cpp.

References m_Range.

68 {
69  return m_Range;
70 }
QwtInterval m_Range
void QxrdRasterData::setDisplayedRange ( double  min,
double  max 
)

Definition at line 72 of file qxrdrasterdata.cpp.

References m_Range.

Referenced by QxrdImagePlot::recalculateDisplayedRange().

73 {
74  m_Range = QwtInterval(min, max);
75 
76  setInterval(Qt::ZAxis, m_Range);
77 }
QwtInterval m_Range

Here is the caller graph for this function:

void QxrdRasterData::setInterpolate ( int  interp)

Definition at line 26 of file qxrdrasterdata.cpp.

References interp(), and m_Interpolate.

Referenced by QxrdImagePlot::onInterpolateChanged().

27 {
28 // printf("%p->QxrdRasterData::setInterpolate(%d)\n", this, interp);
29 
31 }
int interp() const

Here is the call graph for this function:

Here is the caller graph for this function:

double QxrdRasterData::value ( double  x,
double  y 
) const

Definition at line 38 of file qxrdrasterdata.cpp.

References m_Data, m_Interpolate, m_NCols, and m_NRows.

Referenced by optimizePeakPosition(), and QxrdImagePlot::trackerTextF().

39 {
40  if (m_Data) {
41  if (x < 0 || x > m_NCols) return 0;
42  if (y < 0 || y > m_NRows) return 0;
43 
44  if (m_Interpolate) {
45  int ix = ((int) x), iy = ((int) y);
46  double dx = x-ix, dy = y-iy;
47 
48  double f00 = m_Data->getImageData((ix) , (iy));
49  double f10 = m_Data->getImageData((ix+1) , (iy));
50  double f01 = m_Data->getImageData((ix) , (iy+1));
51  double f11 = m_Data->getImageData((ix+1) , (iy+1));
52 
53  double f0 = f00*(1-dx)+f10*dx;
54  double f1 = f01*(1-dx)+f11*dx;
55 
56  double f = f0*(1-dy)+f1*dy;
57 
58  return f;
59  } else {
60  return m_Data->getImageData(((int) qRound(x)) , ((int) qRound(y)));
61  }
62  } else {
63  return 0;
64  }
65 }
QcepImageDataBasePtr m_Data

Here is the caller graph for this function:

int QxrdRasterData::width ( ) const

Definition at line 111 of file qxrdrasterdata.cpp.

References m_NCols.

Referenced by QxrdImagePlot::onMaskedImageAvailable(), and QxrdImagePlot::onProcessedImageAvailable().

112 {
113  return m_NCols;
114 }

Here is the caller graph for this function:

Member Data Documentation

QcepImageDataBasePtr QxrdRasterData::m_Data
private

Definition at line 39 of file qxrdrasterdata.h.

Referenced by data(), maxValue(), minValue(), percentileRange(), and value().

int QxrdRasterData::m_Interpolate
private

Definition at line 43 of file qxrdrasterdata.h.

Referenced by interp(), interpolate(), setInterpolate(), and value().

int QxrdRasterData::m_NCols
private

Definition at line 41 of file qxrdrasterdata.h.

Referenced by QxrdRasterData(), value(), and width().

int QxrdRasterData::m_NRows
private

Definition at line 40 of file qxrdrasterdata.h.

Referenced by height(), QxrdRasterData(), and value().

QwtInterval QxrdRasterData::m_Range
private

Definition at line 42 of file qxrdrasterdata.h.

Referenced by range(), and setDisplayedRange().


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