3 #define _USE_MATH_DEFINES
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")
80 m_RingIntensity.clear();
86 m_RingTTH.appendValue(tth);
87 m_RingIntensity.appendValue(intensity);
88 m_RingWidth.appendValue(width);
101 int col, row, ncols = get_NCols(), nrows = get_NRows();
103 double xc = get_CenterX();
104 double yc = get_CenterY();
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);
118 double twoTheta, chi;
119 double chiMin = get_ChiMin();
120 double chiMax = get_ChiMax();
122 int nrings = get_RingTTH().length();
124 for (row = 0; row < nrows; row++) {
125 for (col = 0; col < ncols; col++) {
126 m_Geometry -> getTwoThetaChi(xc,yc,distance,col,row,
128 rotation, cos_beta, sin_beta,
129 cos_alpha, sin_alpha,
130 cos_rotation, sin_rotation,
133 if (chiMin <= chi && chi <= chiMax) {
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];
141 double nsigma = fabs((ringTTH-twoTheta)/ringWdt);
144 sum += ringInt*exp(-nsigma*nsigma);
148 img->setValue(col,row,sum);
166 int col, row, ncols = get_NCols(), nrows = get_NRows();
168 double xc = get_CenterX();
169 double yc = get_CenterY();
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);
183 double twoTheta, chi;
185 for (row = 0; row < nrows; row++) {
186 for (col = 0; col < ncols; col++) {
187 m_Geometry -> getTwoThetaChi(xc,yc,distance,col,row,
189 rotation, cos_beta, sin_beta,
190 cos_alpha, sin_alpha,
191 cos_rotation, sin_rotation,
194 img->setValue(col,row,twoTheta);
211 int col, row, ncols = get_NCols(), nrows = get_NRows();
213 double xc = get_CenterX();
214 double yc = get_CenterY();
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);
228 double twoTheta, chi;
230 for (row = 0; row < nrows; row++) {
231 for (col = 0; col < ncols; col++) {
232 m_Geometry -> getTwoThetaChi(xc,yc,distance,col,row,
234 rotation, cos_beta, sin_beta,
235 cos_alpha, sin_alpha,
236 cos_rotation, sin_rotation,
239 img->setValue(col,row,chi);
QxrdDetectorGeometryPtr m_Geometry
QcepImageData< double > QcepDoubleImageData
QWeakPointer< QxrdDataProcessor > QxrdDataProcessorWPtr
void setDistance(double l, double pw, double ph)
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
void setChiRange(double chiMin, double chiMax)
void appendRing(double tth, double intensity, double width)
void setProcessor(QxrdDataProcessorWPtr proc)
static QcepDoubleImageDataPtr newDoubleImage(AllocationStrategy strat, int width, int height, QcepObject *parent)
void setTiltAngles(double alpha, double beta, double gamma)
QxrdGenerateTestImage(QcepSettingsSaverWPtr saver)
void setDimension(int nc, int nr)
QList< double > QcepDoubleList
void setEnergy(double energy)
QSharedPointer< QcepSettingsSaver > QcepSettingsSaverPtr
QxrdDataProcessorWPtr m_Processor
void setCenter(double cx, double cy)
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr