5 #include "qtconcurrentrun.h"
12 m_Source(saver, this,
"source",
"Polar/image",
"Source for normalization operation"),
13 m_Destination(saver, this,
"destination",
"Polar/normed",
"Destination for normalization operation"),
14 m_Integrated(saver, this,
"integrated",
"Polar/integrated",
"Integrated result"),
15 m_ColumnScan(saver, this,
"columnScan",
"Polar/columnScan",
"Data Column Scan result"),
16 m_SelfNormalize(saver, this,
"selfNormalize", false,
"Self-Normalize integrated curves"),
17 m_SelfNormalizeMin(saver, this,
"selfNormalizeMin", 0,
"Self-Normalize Range Minimum"),
18 m_SelfNormalizeMax(saver, this,
"selfNormalizeMax", 0,
"Self-Normalize Range Maximum"),
36 if (get_Destination().length()>0) {
37 dst = ds->image(get_Destination());
40 dst = ds->newImage(get_Destination());
46 if (get_Integrated().length()>0) {
47 integ = ds->integratedData(get_Integrated());
50 integ = ds->newIntegratedData(get_Integrated(), 0);
56 if (get_ColumnScan().length()>0) {
57 cols = ds->columnScan(get_ColumnScan());
60 cols = ds->newColumnScan(get_ColumnScan());
64 if (img && dst && integ && cols) {
65 int nCols = img->get_Width();
66 int nRows = img->get_Height();
68 dst->resize(nCols, nRows);
71 cols->appendColumn(img->get_HLabel());
72 cols->appendColumn(
"avg");
73 cols->appendColumn(
"amp");
74 cols->appendColumn(
"amp/avg");
75 cols->resizeRows(nCols);
79 dst->set_HStart(img->get_HStart());
80 dst->set_HStep(img->get_HStep());
81 dst->set_HUnits(img->get_HUnits());
82 dst->set_HLabel(img->get_HLabel());
84 dst->set_VStart(img->get_VStart());
85 dst->set_VStep(img->get_VStep());
86 dst->set_VUnits(img->get_VUnits());
87 dst->set_VLabel(img->get_VLabel());
89 dst->set_Title(img->get_Title());
90 cols->set_Title(img->get_Title());
91 integ->set_Title(img->get_Title());
93 QVector< QFuture<void> > res;
95 for (
int i=0; i<nCols; i++) {
99 for (
int i=0; i<nCols; i++) {
100 res[i].waitForFinished();
103 for (
int i=0; i<nCols; i++) {
104 integ->setValue(i, cols->value(0,i), cols->value(1,i));
107 if (get_SelfNormalize()) {
108 integ->selfNormalize(get_SelfNormalizeMin(), get_SelfNormalizeMax());
114 proc->displayIntegratedData(integ);
130 int nRows = dst->get_Height();
131 double vStart = dst->get_VStart();
132 double vStep = dst->get_VStep();
134 for (
int i=0; i<nRows; i++) {
135 double x = vStart + i*vStep;
136 dst->setValue(col, i, avg+amp*cos(2.0*x*M_PI/180.0));
142 integ->setValue(0, col, img->hValue(col));
143 integ->setValue(1, col, avg);
144 integ->setValue(2, col, amp);
145 integ->setValue(3, col, amp/avg);
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdPolarNormalization(QcepSettingsSaverWPtr saver, QxrdExperimentWPtr exp)
QSharedPointer< QcepDataColumnScan > QcepDataColumnScanPtr
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QWeakPointer< QxrdExperiment > QxrdExperimentWPtr
QSharedPointer< QcepIntegratedData > QcepIntegratedDataPtr
QcepSettingsSaverWPtr m_Saver
QxrdExperimentWPtr m_Experiment
void executeCol(QcepDataColumnScanPtr integ, QcepDoubleImageDataPtr dst, QcepDoubleImageDataPtr img, int col)
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr