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

#include <qxrdgeneratetestimage.h>

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

Public Slots

void setDimension (int nc, int nr)
 
void setCenter (double cx, double cy)
 
void setDistance (double l, double pw, double ph)
 
void setEnergy (double energy)
 
void setTiltAngles (double alpha, double beta, double gamma)
 
void setChiRange (double chiMin, double chiMax)
 
void clearRings ()
 
void appendRing (double tth, double intensity, double width)
 
void generateImage ()
 
void generateTTHImage ()
 
void generateChiImage ()
 
- Public Slots inherited from QcepObject
virtual void printLine (QString line)
 
virtual void printMessage (QString msg, QDateTime dt=QDateTime::currentDateTime()) const
 
virtual void criticalMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual void statusMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual QString settingsScript ()
 
QString scriptValueLiteral (QVariant v)
 

Public Member Functions

 QxrdGenerateTestImage (QcepSettingsSaverWPtr saver)
 
void setProcessor (QxrdDataProcessorWPtr proc)
 
- Public Member Functions inherited from QcepObject
 QcepObject (QString name, QcepObject *parent)
 
virtual ~QcepObject ()
 
virtual void writeSettings (QSettings *set, QString section)
 
virtual void readSettings (QSettings *set, QString section)
 
QString get_Name () const
 
void set_Name (QString name)
 

Properties

int nRows
 
int nCols
 
double centerX
 
double centerY
 
double distance
 
double energy
 
double pixelWidth
 
double pixelHeight
 
double alpha
 
double beta
 
double gamma
 
double chiMin
 
double chiMax
 
QcepDoubleList ringTTH
 
QcepDoubleList ringIntensity
 
QcepDoubleList ringWidth
 
- Properties inherited from QcepObject
QString name
 

Private Attributes

QxrdDataProcessorWPtr m_Processor
 
QxrdDetectorGeometryPtr m_Geometry
 

Additional Inherited Members

- Static Public Member Functions inherited from QcepObject
static int allocatedObjects ()
 
static int deletedObjects ()
 
static QSet< QcepObject * > allocatedObjectsSet ()
 
static QString addSlashes (QString str)
 

Detailed Description

Definition at line 15 of file qxrdgeneratetestimage.h.

Constructor & Destructor Documentation

QxrdGenerateTestImage::QxrdGenerateTestImage ( QcepSettingsSaverWPtr  saver)

Definition at line 12 of file qxrdgeneratetestimage.cpp.

12  :
13  QcepObject("testImage", NULL),
14  m_Processor(),
15  m_Geometry(new QxrdDetectorGeometry("testGeometry", NULL)),
16  m_NRows(saver, this, "nRows", 2048, "Number of Rows"),
17  m_NCols(saver, this, "nCols", 2048, "Number of Cols"),
18  m_CenterX(saver, this, "centerX", 1024, "X Center"),
19  m_CenterY(saver, this, "centerY", 1024, "Y Center"),
20  m_Distance(saver, this, "distance", 1000, "Detector - Sample Distance (in mm)"),
21  m_Energy(saver, this, "energy", 22000, "Beam Energy (in eV)"),
22  m_PixelWidth(saver, this, "pixelWidth", 10, "Pixel Width (in um)"),
23  m_PixelHeight(saver, this, "pixelHeight", 10, "Pixel Height (in um)"),
24  m_Alpha(saver, this, "alpha", 0, "Alpha"),
25  m_Beta(saver, this, "beta", 0, "Beta"),
26  m_Gamma(saver, this, "gamma", 0, "Gamma"),
27  m_ChiMin(saver, this, "chiMin", 0, "Chi Min"),
28  m_ChiMax(saver, this, "chiMax", 360, "Chi Max"),
29  m_RingTTH(saver, this, "ringTTH", QcepDoubleList(), "TTH values of rings"),
30  m_RingIntensity(saver, this, "ringIntensity", QcepDoubleList(), "Intensities of rings"),
31  m_RingWidth(saver, this, "ringWidth", QcepDoubleList(), "Widths of Rings")
32 {
33 }
QxrdDetectorGeometryPtr m_Geometry
QList< double > QcepDoubleList
Definition: qcepmacros.h:28
QcepObject(QString name, QcepObject *parent)
Definition: qcepobject.cpp:16
QxrdDataProcessorWPtr m_Processor

Member Function Documentation

void QxrdGenerateTestImage::appendRing ( double  tth,
double  intensity,
double  width 
)
slot

Definition at line 84 of file qxrdgeneratetestimage.cpp.

85 {
86  m_RingTTH.appendValue(tth);
87  m_RingIntensity.appendValue(intensity);
88  m_RingWidth.appendValue(width);
89 }
void QxrdGenerateTestImage::clearRings ( )
slot

Definition at line 77 of file qxrdgeneratetestimage.cpp.

78 {
79  m_RingTTH.clear();
80  m_RingIntensity.clear();
81  m_RingWidth.clear();
82 }
void QxrdGenerateTestImage::generateChiImage ( )
slot

Definition at line 205 of file qxrdgeneratetestimage.cpp.

References alpha, QcepAllocator::AlwaysAllocate, beta, distance, m_Geometry, m_Processor, and QcepAllocator::newDoubleImage().

206 {
208 
209  img->clear();
210 
211  int col, row, ncols = get_NCols(), nrows = get_NRows();
212 
213  double xc = get_CenterX();
214  double yc = get_CenterY();
215  double distance = get_Distance();
216  double pixWidth = get_PixelWidth();
217  double pixHeight = get_PixelHeight();
218  double alpha = get_Alpha();
219  double cos_alpha = cos(alpha*M_PI/180.0);
220  double sin_alpha = sin(alpha*M_PI/180.0);
221  double beta = get_Beta();
222  double cos_beta = cos(beta*M_PI/180.0);
223  double sin_beta = sin(beta*M_PI/180.0);
224  double rotation = get_Gamma();
225  double cos_rotation = cos(rotation*M_PI/180.0);
226  double sin_rotation = sin(rotation*M_PI/180.0);
227 
228  double twoTheta, chi;
229 
230  for (row = 0; row < nrows; row++) {
231  for (col = 0; col < ncols; col++) {
232  m_Geometry -> getTwoThetaChi(xc,yc,distance,col,row,
233  pixWidth, pixHeight,
234  rotation, cos_beta, sin_beta,
235  cos_alpha, sin_alpha,
236  cos_rotation, sin_rotation,
237  &twoTheta, &chi);
238 
239  img->setValue(col,row,chi);
240  }
241  }
242 
244 
245  if (proc) {
246  proc -> newData(img, QcepMaskDataPtr());
247  }
248 }
QxrdDetectorGeometryPtr m_Geometry
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
static QcepDoubleImageDataPtr newDoubleImage(AllocationStrategy strat, int width, int height, QcepObject *parent)
QxrdDataProcessorWPtr m_Processor
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdGenerateTestImage::generateImage ( )
slot

Definition at line 91 of file qxrdgeneratetestimage.cpp.

References alpha, beta, chiMax, chiMin, distance, m_Geometry, m_Processor, and ringTTH.

92 {
94  get_NCols(),
95  get_NRows(),
96  0,
97  this));
98 
99  img->clear();
100 
101  int col, row, ncols = get_NCols(), nrows = get_NRows();
102 
103  double xc = get_CenterX();
104  double yc = get_CenterY();
105  double distance = get_Distance();
106  double pixWidth = get_PixelWidth();
107  double pixHeight = get_PixelHeight();
108  double alpha = get_Alpha();
109  double cos_alpha = cos(alpha*M_PI/180.0);
110  double sin_alpha = sin(alpha*M_PI/180.0);
111  double beta = get_Beta();
112  double cos_beta = cos(beta*M_PI/180.0);
113  double sin_beta = sin(beta*M_PI/180.0);
114  double rotation = get_Gamma();
115  double cos_rotation = cos(rotation*M_PI/180.0);
116  double sin_rotation = sin(rotation*M_PI/180.0);
117 
118  double twoTheta, chi;
119  double chiMin = get_ChiMin();
120  double chiMax = get_ChiMax();
121 
122  int nrings = get_RingTTH().length();
123 
124  for (row = 0; row < nrows; row++) {
125  for (col = 0; col < ncols; col++) {
126  m_Geometry -> getTwoThetaChi(xc,yc,distance,col,row,
127  pixWidth, pixHeight,
128  rotation, cos_beta, sin_beta,
129  cos_alpha, sin_alpha,
130  cos_rotation, sin_rotation,
131  &twoTheta, &chi);
132 
133  if (chiMin <= chi && chi <= chiMax) {
134  double sum = 0;
135 
136  for (int i = 0; i<nrings; i++) {
137  double ringTTH = get_RingTTH()[i];
138  double ringInt = get_RingIntensity()[i];
139  double ringWdt = get_RingWidth()[i];
140 
141  double nsigma = fabs((ringTTH-twoTheta)/ringWdt);
142 
143  if (nsigma < 5) {
144  sum += ringInt*exp(-nsigma*nsigma);
145  }
146  }
147 
148  img->setValue(col,row,sum);
149  }
150  }
151  }
152 
154 
155  if (proc) {
156  proc -> newData(img, QcepMaskDataPtr());
157  }
158 }
QxrdDetectorGeometryPtr m_Geometry
QcepImageData< double > QcepDoubleImageData
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QSharedPointer< QcepSettingsSaver > QcepSettingsSaverPtr
QxrdDataProcessorWPtr m_Processor
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr
void QxrdGenerateTestImage::generateTTHImage ( )
slot

Definition at line 160 of file qxrdgeneratetestimage.cpp.

References alpha, QcepAllocator::AlwaysAllocate, beta, distance, m_Geometry, m_Processor, and QcepAllocator::newDoubleImage().

161 {
163 
164  img->clear();
165 
166  int col, row, ncols = get_NCols(), nrows = get_NRows();
167 
168  double xc = get_CenterX();
169  double yc = get_CenterY();
170  double distance = get_Distance();
171  double pixWidth = get_PixelWidth();
172  double pixHeight = get_PixelHeight();
173  double alpha = get_Alpha();
174  double cos_alpha = cos(alpha*M_PI/180.0);
175  double sin_alpha = sin(alpha*M_PI/180.0);
176  double beta = get_Beta();
177  double cos_beta = cos(beta*M_PI/180.0);
178  double sin_beta = sin(beta*M_PI/180.0);
179  double rotation = get_Gamma();
180  double cos_rotation = cos(rotation*M_PI/180.0);
181  double sin_rotation = sin(rotation*M_PI/180.0);
182 
183  double twoTheta, chi;
184 
185  for (row = 0; row < nrows; row++) {
186  for (col = 0; col < ncols; col++) {
187  m_Geometry -> getTwoThetaChi(xc,yc,distance,col,row,
188  pixWidth, pixHeight,
189  rotation, cos_beta, sin_beta,
190  cos_alpha, sin_alpha,
191  cos_rotation, sin_rotation,
192  &twoTheta, &chi);
193 
194  img->setValue(col,row,twoTheta);
195  }
196  }
197 
199 
200  if (proc) {
201  proc -> newData(img, QcepMaskDataPtr());
202  }
203 }
QxrdDetectorGeometryPtr m_Geometry
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
static QcepDoubleImageDataPtr newDoubleImage(AllocationStrategy strat, int width, int height, QcepObject *parent)
QxrdDataProcessorWPtr m_Processor
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdGenerateTestImage::setCenter ( double  cx,
double  cy 
)
slot

Definition at line 46 of file qxrdgeneratetestimage.cpp.

47 {
48  set_CenterX(cx);
49  set_CenterY(cy);
50 }
void QxrdGenerateTestImage::setChiRange ( double  chiMin,
double  chiMax 
)
slot

Definition at line 71 of file qxrdgeneratetestimage.cpp.

72 {
73  set_ChiMin(chiMin);
74  set_ChiMax(chiMax);
75 }
void QxrdGenerateTestImage::setDimension ( int  nc,
int  nr 
)
slot

Definition at line 40 of file qxrdgeneratetestimage.cpp.

41 {
42  set_NRows(nr);
43  set_NCols(nc);
44 }
void QxrdGenerateTestImage::setDistance ( double  l,
double  pw,
double  ph 
)
slot

Definition at line 52 of file qxrdgeneratetestimage.cpp.

53 {
54  set_Distance(l);
55  set_PixelWidth(pw);
56  set_PixelHeight(ph);
57 }
void QxrdGenerateTestImage::setEnergy ( double  energy)
slot

Definition at line 59 of file qxrdgeneratetestimage.cpp.

60 {
61  set_Energy(energy);
62 }
void QxrdGenerateTestImage::setProcessor ( QxrdDataProcessorWPtr  proc)

Definition at line 35 of file qxrdgeneratetestimage.cpp.

References m_Processor.

36 {
37  m_Processor = proc;
38 }
QxrdDataProcessorWPtr m_Processor
void QxrdGenerateTestImage::setTiltAngles ( double  alpha,
double  beta,
double  gamma 
)
slot

Definition at line 64 of file qxrdgeneratetestimage.cpp.

65 {
66  set_Alpha(alpha);
67  set_Beta(beta);
68  set_Gamma(gamma);
69 }

Member Data Documentation

QxrdDetectorGeometryPtr QxrdGenerateTestImage::m_Geometry
private

Definition at line 40 of file qxrdgeneratetestimage.h.

Referenced by generateChiImage(), generateImage(), and generateTTHImage().

QxrdDataProcessorWPtr QxrdGenerateTestImage::m_Processor
private

Property Documentation

double QxrdGenerateTestImage::alpha
readwrite

Definition at line 67 of file qxrdgeneratetestimage.h.

Referenced by generateChiImage(), generateImage(), and generateTTHImage().

double QxrdGenerateTestImage::beta
readwrite

Definition at line 70 of file qxrdgeneratetestimage.h.

Referenced by generateChiImage(), generateImage(), and generateTTHImage().

double QxrdGenerateTestImage::centerX
readwrite

Definition at line 49 of file qxrdgeneratetestimage.h.

double QxrdGenerateTestImage::centerY
readwrite

Definition at line 52 of file qxrdgeneratetestimage.h.

double QxrdGenerateTestImage::chiMax
readwrite

Definition at line 79 of file qxrdgeneratetestimage.h.

Referenced by generateImage().

double QxrdGenerateTestImage::chiMin
readwrite

Definition at line 76 of file qxrdgeneratetestimage.h.

Referenced by generateImage().

double QxrdGenerateTestImage::distance
readwrite

Definition at line 55 of file qxrdgeneratetestimage.h.

Referenced by generateChiImage(), generateImage(), and generateTTHImage().

double QxrdGenerateTestImage::energy
readwrite

Definition at line 58 of file qxrdgeneratetestimage.h.

double QxrdGenerateTestImage::gamma
readwrite

Definition at line 73 of file qxrdgeneratetestimage.h.

int QxrdGenerateTestImage::nCols
readwrite

Definition at line 46 of file qxrdgeneratetestimage.h.

int QxrdGenerateTestImage::nRows
readwrite

Definition at line 43 of file qxrdgeneratetestimage.h.

double QxrdGenerateTestImage::pixelHeight
readwrite

Definition at line 64 of file qxrdgeneratetestimage.h.

double QxrdGenerateTestImage::pixelWidth
readwrite

Definition at line 61 of file qxrdgeneratetestimage.h.

QcepDoubleList QxrdGenerateTestImage::ringIntensity
readwrite

Definition at line 85 of file qxrdgeneratetestimage.h.

QcepDoubleList QxrdGenerateTestImage::ringTTH
readwrite

Definition at line 82 of file qxrdgeneratetestimage.h.

Referenced by generateImage().

QcepDoubleList QxrdGenerateTestImage::ringWidth
readwrite

Definition at line 88 of file qxrdgeneratetestimage.h.


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