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

#include <qxrdintegrator.h>

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

Public Types

enum  { RadialIntegrateTTH, RadialIntegrateQ, RadialIntegrateR, RadialIntegrateNone }
 
enum  { PolarIntegrateNone, PolarIntegrateChi }
 

Public Slots

void clearAccumulator (QString resPath)
 
void prepareAccumulator (QString resPath, int nImages)
 
void completeAccumulator (QString path)
 
void saveAccumulator (QString resPath, QString &fileName, QString filter)
 
void appendIntegration (QString resPath, QcepDoubleImageDataPtr dimg, QcepMaskDataPtr mask=QcepMaskDataPtr())
 
void appendIntegration (QString resPath, QcepIntegratedDataPtr integ)
 
void appendIntegration (QcepDoubleImageDataPtr res, QcepDoubleImageDataPtr dimg, QcepMaskDataPtr mask=QcepMaskDataPtr())
 
void appendIntegration (QcepDoubleImageDataPtr res, QcepIntegratedDataPtr integ)
 
QcepIntegratedDataPtr performIntegration (QcepIntegratedDataPtr integ, QcepDoubleImageDataPtr dimg, QcepMaskDataPtr mask)
 
QcepIntegratedDataPtr performIntegration (QcepDoubleImageDataPtr dimg, QcepMaskDataPtr mask=QcepMaskDataPtr())
 
QcepIntegratedDataPtr sliceLine (QcepIntegratedDataPtr integ, QcepDoubleImageDataPtr dimg, double x0, double y0, double x1, double y1, double width)
 
QcepIntegratedDataPtr slicePolygon (QcepIntegratedDataPtr integ, QcepDoubleImageDataPtr dimg, QVector< QPointF > poly, double width)
 
void integrateVsR ()
 
void integrateVsQ ()
 
void integrateVsTTH ()
 
void onIntegrationParametersChanged ()
 
QcepInt32ImageDataPtr cachedGeometry ()
 
QcepDoubleImageDataPtr cachedIntensity ()
 
QString defaultUserGeometryScript ()
 
QString defaultUserAbsorptionScript ()
 
- 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

 QxrdIntegrator (QcepSettingsSaverWPtr saver, QxrdExperimentWPtr exp, QxrdCenterFinderWPtr cfw)
 
virtual ~QxrdIntegrator ()
 
QxrdDataProcessorWPtr dataProcessor () const
 
QxrdExperimentWPtr experiment () const
 
double XValue (double x, double y) const
 
double XValue (QPointF pt) const
 
double XValue (double x, double y, int xUnits, QxrdCenterFinderPtr cf, double xc, double yc, double dst, double nrg, double pxl, double pxh, double rot, double cosr, double sinr, double cosb, double sinb, double cosa, double sina) const
 
QString XLabel () const
 
- 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)
 

Static Public Member Functions

static QScriptValue toScriptValue (QScriptEngine *engine, const QxrdIntegratorPtr &proc)
 
static void fromScriptValue (const QScriptValue &obj, QxrdIntegratorPtr &proc)
 
- Static Public Member Functions inherited from QcepObject
static int allocatedObjects ()
 
static int deletedObjects ()
 
static QSet< QcepObject * > allocatedObjectsSet ()
 
static QString addSlashes (QString str)
 

Properties

int oversample
 
double integrationStep
 
int integrationNSteps
 
double integrationMinimum
 
double integrationMaximum
 
int integrationXUnits
 
bool enableGeometricCorrections
 
bool enablePolarizationCorrections
 
double polarization
 
bool enableAbsorptionCorrections
 
double attenuationLength
 
int enableUserGeometry
 
QString userGeometryScript
 
QString userGeometryFunction
 
int enableUserAbsorption
 
QString userAbsorptionScript
 
QString userAbsorptionFunction
 
double scalingFactor
 
bool selfNormalization
 
double selfNormalizationMinimum
 
double selfNormalizationMaximum
 
- Properties inherited from QcepObject
QString name
 

Private Attributes

QMutex m_Mutex
 
QcepSettingsSaverWPtr m_Saver
 
QxrdExperimentWPtr m_Experiment
 
QxrdCenterFinderWPtr m_CenterFinder
 
QxrdIntegratorCachePtr m_IntegratorCache
 

Detailed Description

Definition at line 23 of file qxrdintegrator.h.

Member Enumeration Documentation

anonymous enum
Enumerator
RadialIntegrateTTH 
RadialIntegrateQ 
RadialIntegrateR 
RadialIntegrateNone 

Definition at line 99 of file qxrdintegrator.h.

anonymous enum
Enumerator
PolarIntegrateNone 
PolarIntegrateChi 

Definition at line 103 of file qxrdintegrator.h.

Constructor & Destructor Documentation

QxrdIntegrator::QxrdIntegrator ( QcepSettingsSaverWPtr  saver,
QxrdExperimentWPtr  exp,
QxrdCenterFinderWPtr  cfw 
)

Definition at line 23 of file qxrdintegrator.cpp.

References DEBUG_CONSTRUCTORS, m_CenterFinder, onIntegrationParametersChanged(), QxrdCenterFinder::parameterChanged(), qcepDebug(), QcepDoubleProperty::valueChanged(), QcepIntProperty::valueChanged(), QcepBoolProperty::valueChanged(), and QcepStringProperty::valueChanged().

24  : QcepObject("integrator", NULL),
25  m_Oversample(saver, this, "oversample", 1, "Oversampling for Integration"),
26  m_IntegrationStep(saver, this, "integrationStep", 0.001, "Integration Step Size"),
27  m_IntegrationNSteps(saver, this, "integrationNSteps", 0, "Integration Number of Steps"),
28  m_IntegrationMinimum(saver, this, "integrationMinimum", 0, "Integration Minimum"),
29  m_IntegrationMaximum(saver, this, "integrationMaximum", 100000, "Integration Maximum"),
30  m_IntegrationXUnits(saver, this, "integrationXUnits", RadialIntegrateTTH, "X Units for Integration (0 = TTH, 1 = Q, 2 = R)"),
31  m_EnableGeometricCorrections(saver, this, "enableGeometricCorrections", false, "Enable Geometric Corrections (tilt and distance) in Integration"),
32  m_EnablePolarizationCorrections(saver, this, "enablePolarizationCorrections", false, "Enable Polarization Corrections in Integration"),
33  m_Polarization(saver, this, "polarization", 1.0, "Beam Polarization Factor"),
34  m_EnableAbsorptionCorrections(saver, this, "enableAbsorptionCorrections", false, "Enable Absorption Correction in Integration"),
35  m_AttenuationLength(saver, this, "attenuationLength", 0, "Attenuation Length (mm)"),
36  m_EnableUserGeometry(saver, this, "enableUserGeometry", 0, "Apply user-defined geometry function in integration"),
37  m_UserGeometryScript(saver, this, "userGeometryScript", defaultUserGeometryScript(), "Script to define user defined geometry functions"),
38  m_UserGeometryFunction(saver, this, "userGeometryFunction", "userGeometry", "Name of user defined geometry function"),
39  m_EnableUserAbsorption(saver, this, "enableUserAbsorption", 0, "Apply user-defined geometry function in integration"),
40  m_UserAbsorptionScript(saver, this, "userAbsorptionScript", defaultUserAbsorptionScript(), "Script to define user defined absorption functions"),
41  m_UserAbsorptionFunction(saver, this, "userAbsorptionFunction", "userAbsorb1", "Name of user defined absorption function"),
42  m_ScalingFactor(saver, this, "scalingFactor", 1.0, "Scaling factor for integrated intensity"),
43  m_SelfNormalization(saver, this, "selfNormalization", false, "Normalize result based on average value within specified range"),
44  m_SelfNormalizationMinimum(saver, this, "selfNormalizationMinimum", 0, "Self Normalization Range Minimum"),
45  m_SelfNormalizationMaximum(saver, this, "selfNormalizationMaximum", 0, "Self Normalization Range Maximum"),
46  m_Saver(saver),
47  m_Experiment(exp),
48  m_CenterFinder(cfw),
50 {
52  printf("QxrdIntegrator::QxrdIntegrator(%p)\n", this);
53  }
54 
55  connect(this->prop_Oversample(), &QcepIntProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
56  connect(this->prop_IntegrationStep(), &QcepDoubleProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
57  connect(this->prop_IntegrationNSteps(), &QcepIntProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
58  connect(this->prop_IntegrationMinimum(), &QcepDoubleProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
59  connect(this->prop_IntegrationMaximum(), &QcepDoubleProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
60  connect(this->prop_IntegrationXUnits(), &QcepIntProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
61 
62  connect(prop_EnableGeometricCorrections(), &QcepBoolProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
63  connect(prop_EnablePolarizationCorrections(), &QcepBoolProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
64  connect(prop_Polarization(), &QcepDoubleProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
65  connect(prop_EnableAbsorptionCorrections(), &QcepBoolProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
66  connect(prop_AttenuationLength(), &QcepDoubleProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
67 
68  connect(prop_EnableUserGeometry(), &QcepIntProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
69  connect(prop_UserGeometryScript(), &QcepStringProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
70  connect(prop_UserGeometryFunction(), &QcepStringProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
71 
72  connect(prop_EnableUserAbsorption(), &QcepIntProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
73  connect(prop_UserAbsorptionScript(), &QcepStringProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
74  connect(prop_UserAbsorptionFunction(), &QcepStringProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
75 
76  connect(prop_ScalingFactor(), &QcepDoubleProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
77  connect(prop_SelfNormalization(), &QcepBoolProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
78  connect(prop_SelfNormalizationMinimum(), &QcepDoubleProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
79  connect(prop_SelfNormalizationMaximum(), &QcepDoubleProperty::valueChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
80 
82 
83  if (cf) {
84  connect(cf.data(), &QxrdCenterFinder::parameterChanged, this, &QxrdIntegrator::onIntegrationParametersChanged, Qt::DirectConnection);
85  }
86 }
QSharedPointer< QxrdCenterFinder > QxrdCenterFinderPtr
QxrdExperimentWPtr m_Experiment
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void valueChanged(QString val, int index)
void onIntegrationParametersChanged()
QString defaultUserGeometryScript()
QxrdCenterFinderWPtr m_CenterFinder
QcepObject(QString name, QcepObject *parent)
Definition: qcepobject.cpp:16
void parameterChanged()
QcepSettingsSaverWPtr m_Saver
void valueChanged(double val, int index)
void valueChanged(int val, int index)
QString defaultUserAbsorptionScript()
QxrdIntegratorCachePtr m_IntegratorCache
void valueChanged(bool val, int index)

Here is the call graph for this function:

QxrdIntegrator::~QxrdIntegrator ( )
virtual

Definition at line 88 of file qxrdintegrator.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

89 {
90 #ifndef QT_NO_DEBUG
91  printf("Deleting integrator\n");
92 #endif
93 
95  printf("QxrdIntegrator::~QxrdIntegrator(%p)\n", this);
96  }
97 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

Member Function Documentation

void QxrdIntegrator::appendIntegration ( QString  resPath,
QcepDoubleImageDataPtr  dimg,
QcepMaskDataPtr  mask = QcepMaskDataPtr() 
)
slot

Definition at line 410 of file qxrdintegrator.cpp.

References m_Experiment.

Referenced by appendIntegration().

411 {
413 
414  if (expt) {
415  QcepDatasetModelPtr ds = expt->dataset();
416 
417  if (ds) {
418  QcepDoubleImageDataPtr data = ds->image(resPath);
419 
420  if (!data) {
421  data = ds->newImage(resPath);
422  }
423 
424  if (data) {
425  appendIntegration(data, dimg, mask);
426  }
427  }
428  }
429 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
void appendIntegration(QString resPath, QcepDoubleImageDataPtr dimg, QcepMaskDataPtr mask=QcepMaskDataPtr())
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the caller graph for this function:

void QxrdIntegrator::appendIntegration ( QString  resPath,
QcepIntegratedDataPtr  integ 
)
slot

Definition at line 387 of file qxrdintegrator.cpp.

References appendIntegration(), m_Experiment, and QcepObject::printMessage().

388 {
390 
391  if (expt) {
392  QcepDatasetModelPtr ds = expt->dataset();
393 
394  if (ds) {
395  QcepDoubleImageDataPtr data = ds->image(resPath);
396 
397  if (!data) {
398  data = ds->newImage(resPath);
399  }
400 
401  if (data) {
402  appendIntegration(data, integ);
403  } else {
404  printMessage(tr("Unable to accumulate integrated data into %1").arg(resPath));
405  }
406  }
407  }
408 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
void appendIntegration(QString resPath, QcepDoubleImageDataPtr dimg, QcepMaskDataPtr mask=QcepMaskDataPtr())
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime()) const
Definition: qcepobject.cpp:84
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdIntegrator::appendIntegration ( QcepDoubleImageDataPtr  res,
QcepDoubleImageDataPtr  dimg,
QcepMaskDataPtr  mask = QcepMaskDataPtr() 
)
slot

Definition at line 431 of file qxrdintegrator.cpp.

References appendIntegration(), and performIntegration().

432 {
433  QcepIntegratedDataPtr integ = performIntegration(dimg, mask);
434 
435  appendIntegration(res, integ);
436 }
QcepIntegratedDataPtr performIntegration(QcepIntegratedDataPtr integ, QcepDoubleImageDataPtr dimg, QcepMaskDataPtr mask)
QSharedPointer< QcepIntegratedData > QcepIntegratedDataPtr
void appendIntegration(QString resPath, QcepDoubleImageDataPtr dimg, QcepMaskDataPtr mask=QcepMaskDataPtr())

Here is the call graph for this function:

void QxrdIntegrator::appendIntegration ( QcepDoubleImageDataPtr  res,
QcepIntegratedDataPtr  integ 
)
slot

Definition at line 438 of file qxrdintegrator.cpp.

439 {
440  if (res && integ) {
441  int width = res->get_Width();
442  int ht = res->get_Height();
443  int npts = integ->size();
444 
445  res->resize(npts, ht+1);
446 
447  for (int i=0; i<npts; i++) {
448  res->setValue(i, ht, integ->y(i));
449  }
450 
451  emit res->dataObjectChanged();
452  }
453 }
QcepInt32ImageDataPtr QxrdIntegrator::cachedGeometry ( )
slot

Definition at line 347 of file qxrdintegrator.cpp.

References m_IntegratorCache.

348 {
349  if (m_IntegratorCache) {
350  return m_IntegratorCache->cachedGeometry();
351  } else {
352  return QcepInt32ImageDataPtr();
353  }
354 }
QSharedPointer< QcepInt32ImageData > QcepInt32ImageDataPtr
QxrdIntegratorCachePtr m_IntegratorCache
QcepDoubleImageDataPtr QxrdIntegrator::cachedIntensity ( )
slot

Definition at line 356 of file qxrdintegrator.cpp.

References m_IntegratorCache.

357 {
358  if (m_IntegratorCache) {
359  return m_IntegratorCache->cachedIntensity();
360  } else {
361  return QcepDoubleImageDataPtr();
362  }
363 }
QxrdIntegratorCachePtr m_IntegratorCache
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr
void QxrdIntegrator::clearAccumulator ( QString  resPath)
slot

Definition at line 455 of file qxrdintegrator.cpp.

References m_Experiment.

456 {
458 
459  if (expt) {
460  QcepDatasetModelPtr ds = expt->dataset();
461 
462  if (ds) {
463  QcepDoubleImageDataPtr data = ds->image(resPath);
464 
465  if (!data) {
466  data = ds->newImage(resPath);
467  }
468 
469  if (data) {
470  data->resize(0, 0);
471  }
472  }
473  }
474 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr
void QxrdIntegrator::completeAccumulator ( QString  path)
slot

Definition at line 493 of file qxrdintegrator.cpp.

494 {
495 }
QxrdDataProcessorWPtr QxrdIntegrator::dataProcessor ( ) const

Definition at line 99 of file qxrdintegrator.cpp.

References m_Experiment.

100 {
102 
103  if (expt) {
104  return expt->dataProcessor();
105  } else {
106  return QxrdDataProcessorWPtr();
107  }
108 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
QWeakPointer< QxrdDataProcessor > QxrdDataProcessorWPtr
QString QxrdIntegrator::defaultUserAbsorptionScript ( )
slot

Definition at line 376 of file qxrdintegrator.cpp.

377 {
378  QFile def(":/qxrdexampleuserabsorption.js");
379 
380  if (def.open(QFile::ReadOnly)) {
381  return def.readAll();
382  } else {
383  return "Couldn't open resource file";
384  }
385 }
QString QxrdIntegrator::defaultUserGeometryScript ( )
slot

Definition at line 365 of file qxrdintegrator.cpp.

366 {
367  QFile def(":/qxrdexampleusergeometry.js");
368 
369  if (def.open(QFile::ReadOnly)) {
370  return def.readAll();
371  } else {
372  return "Couldn't open resource file";
373  }
374 }
QxrdExperimentWPtr QxrdIntegrator::experiment ( ) const

Definition at line 110 of file qxrdintegrator.cpp.

References m_Experiment.

111 {
112  return m_Experiment;
113 }
QxrdExperimentWPtr m_Experiment
void QxrdIntegrator::fromScriptValue ( const QScriptValue &  obj,
QxrdIntegratorPtr proc 
)
static

Definition at line 519 of file qxrdintegrator.cpp.

520 {
521  QObject *qobj = obj.toQObject();
522 
523  if (qobj) {
524  QxrdIntegrator *f = qobject_cast<QxrdIntegrator*>(qobj);
525 
526  if (f) {
527  proc = QxrdIntegratorPtr(f);
528  }
529  }
530 }
QSharedPointer< QxrdIntegrator > QxrdIntegratorPtr
void QxrdIntegrator::integrateVsQ ( )
slot

Definition at line 332 of file qxrdintegrator.cpp.

References RadialIntegrateQ.

Referenced by QxrdWindow::initialize().

333 {
334  set_IntegrationXUnits(RadialIntegrateQ);
335 }

Here is the caller graph for this function:

void QxrdIntegrator::integrateVsR ( )
slot

Definition at line 337 of file qxrdintegrator.cpp.

References RadialIntegrateR.

Referenced by QxrdWindow::initialize().

338 {
339  set_IntegrationXUnits(RadialIntegrateR);
340 }

Here is the caller graph for this function:

void QxrdIntegrator::integrateVsTTH ( )
slot

Definition at line 342 of file qxrdintegrator.cpp.

References RadialIntegrateTTH.

Referenced by QxrdWindow::initialize().

343 {
344  set_IntegrationXUnits(RadialIntegrateTTH);
345 }

Here is the caller graph for this function:

void QxrdIntegrator::onIntegrationParametersChanged ( )
slot

Definition at line 115 of file qxrdintegrator.cpp.

References DEBUG_INTEGRATOR, m_Experiment, m_IntegratorCache, and qcepDebug().

Referenced by QxrdIntegrator().

116 {
119 
120  if (expt) {
121  expt->printMessage("Integration parameters changed");
122  }
123  }
124 
126 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
QSharedPointer< QxrdIntegratorCache > QxrdIntegratorCachePtr
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdIntegratorCachePtr m_IntegratorCache

Here is the call graph for this function:

Here is the caller graph for this function:

QcepIntegratedDataPtr QxrdIntegrator::performIntegration ( QcepIntegratedDataPtr  integ,
QcepDoubleImageDataPtr  dimg,
QcepMaskDataPtr  mask 
)
slot

Definition at line 139 of file qxrdintegrator.cpp.

References DEBUG_INTEGRATOR, m_CenterFinder, m_Experiment, m_IntegratorCache, and qcepDebug().

Referenced by appendIntegration(), QxrdDataProcessorThreaded::integrateSaveAndDisplay(), and performIntegration().

140 {
143 
144  if (expt) {
145  expt->printMessage(tr("QxrdIntegrator::performIntegration(\"%1\")")
146  .arg(dimg->get_FileName()));
147  }
148  }
149 
150  QThread::currentThread()->setObjectName("performIntegration");
151 
153 
154  if (cache == NULL ||
155  dimg->get_Width() != cache->get_NCols() ||
156  dimg->get_Height() != cache->get_NRows()) {
157 
158  cache = QxrdIntegratorCachePtr(
160  (QxrdIntegratorWPtr) sharedFromThis(),
162  m_CenterFinder));
163 
164  m_IntegratorCache = cache;
165  }
166 
167  cache->performIntegration(integ, dimg, mask, true);
168 
169  return integ;
170 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
QSharedPointer< QxrdIntegratorCache > QxrdIntegratorCachePtr
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdCenterFinderWPtr m_CenterFinder
QWeakPointer< QxrdPolarTransform > QxrdPolarTransformWPtr
QWeakPointer< QxrdIntegrator > QxrdIntegratorWPtr
QxrdIntegratorCachePtr m_IntegratorCache

Here is the call graph for this function:

Here is the caller graph for this function:

QcepIntegratedDataPtr QxrdIntegrator::performIntegration ( QcepDoubleImageDataPtr  dimg,
QcepMaskDataPtr  mask = QcepMaskDataPtr() 
)
slot

Definition at line 128 of file qxrdintegrator.cpp.

References QcepAllocator::AlwaysAllocate, QcepAllocator::newIntegratedData(), and performIntegration().

129 {
131 
132  if (res) {
133  return performIntegration(res, dimg, mask);
134  } else {
135  return res;
136  }
137 }
static QcepIntegratedDataPtr newIntegratedData(AllocationStrategy strat, QcepDoubleImageDataPtr image, QcepObject *parent)
QcepIntegratedDataPtr performIntegration(QcepIntegratedDataPtr integ, QcepDoubleImageDataPtr dimg, QcepMaskDataPtr mask)
QSharedPointer< QcepIntegratedData > QcepIntegratedDataPtr

Here is the call graph for this function:

void QxrdIntegrator::prepareAccumulator ( QString  resPath,
int  nImages 
)
slot

Definition at line 476 of file qxrdintegrator.cpp.

References m_Experiment.

477 {
479 
480  if (expt) {
481  QcepDatasetModelPtr ds = expt->dataset();
482 
483  if (ds) {
484  QcepDoubleImageDataPtr data = ds->image(resPath);
485 
486  if (!data) {
487  data = ds->newImage(resPath);
488  }
489  }
490  }
491 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr
void QxrdIntegrator::saveAccumulator ( QString  resPath,
QString &  fileName,
QString  filter 
)
slot

Definition at line 497 of file qxrdintegrator.cpp.

References m_Experiment.

498 {
500 
501  if (expt) {
502  QcepDatasetModelPtr ds = expt->dataset();
503 
504  if (ds) {
505  QcepDoubleImageDataPtr data = ds->image(resPath);
506 
507  if (data) {
508  data -> saveData(fileName, filter);
509  }
510  }
511  }
512 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr
QcepIntegratedDataPtr QxrdIntegrator::sliceLine ( QcepIntegratedDataPtr  integ,
QcepDoubleImageDataPtr  dimg,
double  x0,
double  y0,
double  x1,
double  y1,
double  width 
)
slot

Definition at line 253 of file qxrdintegrator.cpp.

References m_Experiment, and slicePolygon().

254 {
255  try {
256  QVector<QPointF> poly;
257  poly.append(QPointF(x0,y0));
258  poly.append(QPointF(x1,y1));
259 
260  return slicePolygon(integ, image, poly, width);
261  }
262 
263  catch (...) {
265 
266  if (expt) {
267  expt->printMessage("QxrdIntegrator::sliceLine failed");
268  }
269  }
270 
271  return QcepIntegratedDataPtr();
272 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QcepIntegratedDataPtr slicePolygon(QcepIntegratedDataPtr integ, QcepDoubleImageDataPtr dimg, QVector< QPointF > poly, double width)
QxrdExperimentWPtr m_Experiment
QSharedPointer< QcepIntegratedData > QcepIntegratedDataPtr

Here is the call graph for this function:

QcepIntegratedDataPtr QxrdIntegrator::slicePolygon ( QcepIntegratedDataPtr  integ,
QcepDoubleImageDataPtr  dimg,
QVector< QPointF >  poly,
double  width 
)
slot

Definition at line 274 of file qxrdintegrator.cpp.

References m_Experiment.

Referenced by sliceLine(), and QxrdDataProcessorThreaded::slicePolygon().

275 {
276  QThread::currentThread()->setObjectName("slicePolygon");
277 
278  if (integ && image) {
279  double length = 0;
280 
281  if (poly.size() >= 2) {
282  QPointF p0 = poly[0];
283 
284  for (int i=1; i<poly.size(); i++) {
285  QPointF p1 = poly[i];
286  double dx = p1.x() - p0.x();
287  double dy = p1.y() - p0.y();
288  length += sqrt(dx*dx + dy*dy);
289  p0=p1;
290  }
291 
292  p0 = poly[0];
293  double r = 0;
294  double r0 = 0;
295 
296  // QVector<double> xs,ys;
297  integ -> resize(0);
298 
299  for (int i=1; i<poly.size(); i++) {
300  QPointF p1 = poly[i];
301  double dx = p1.x() - p0.x();
302  double dy = p1.y() - p0.y();
303  double len = sqrt(dx*dx + dy*dy);
304 
305  if (len > 0) {
306  for (; r<len; r+=1) {
307  double x = p0.x() + r*dx/len;
308  double y = p0.y() + r*dy/len;
309 
310  integ -> append(r+r0, image->value((int) x, (int) y));
311  }
312  }
313 
314  p0 = p1;
315  r0 += len;
316  r -= len;
317  }
318  //
319  // emit newIntegrationAvailable(image->get_Title(),xs,ys);
320  }
321  } else {
323 
324  if (expt) {
325  expt->printMessage("QxrdIntegrator::slicePolygon failed");
326  }
327  }
328 
329  return integ;
330 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment

Here is the caller graph for this function:

QScriptValue QxrdIntegrator::toScriptValue ( QScriptEngine *  engine,
const QxrdIntegratorPtr proc 
)
static

Definition at line 514 of file qxrdintegrator.cpp.

515 {
516  return engine->newQObject(proc.data());
517 }
QString QxrdIntegrator::XLabel ( ) const

Definition at line 232 of file qxrdintegrator.cpp.

References RadialIntegrateQ, RadialIntegrateR, and RadialIntegrateTTH.

233 {
234  QString label = "";
235 
236  switch(get_IntegrationXUnits()) {
237  case RadialIntegrateTTH:
238  label = "2 Theta (deg)";
239  break;
240 
241  case RadialIntegrateQ:
242  label = "Q";
243  break;
244 
245  case RadialIntegrateR:
246  label = "r (mm)";
247  break;
248  }
249 
250  return label;
251 }
double QxrdIntegrator::XValue ( double  x,
double  y 
) const

Definition at line 177 of file qxrdintegrator.cpp.

References m_CenterFinder, RadialIntegrateQ, RadialIntegrateR, and RadialIntegrateTTH.

Referenced by XValue().

178 {
179  double xVal = 0;
180 
182 
183  if (cf) {
184  switch(get_IntegrationXUnits()) {
185  case RadialIntegrateTTH:
186  xVal = cf->getTTH(x,y);
187  break;
188 
189  case RadialIntegrateQ:
190  xVal = cf->getQ(x,y);
191  break;
192 
193  case RadialIntegrateR:
194  xVal = cf->getR(x,y);
195  break;
196  }
197  }
198 
199  return xVal;
200 }
QSharedPointer< QxrdCenterFinder > QxrdCenterFinderPtr
QxrdCenterFinderWPtr m_CenterFinder

Here is the caller graph for this function:

double QxrdIntegrator::XValue ( QPointF  pt) const

Definition at line 172 of file qxrdintegrator.cpp.

References XValue().

173 {
174  return XValue(pt.x(), pt.y());
175 }
double XValue(double x, double y) const

Here is the call graph for this function:

double QxrdIntegrator::XValue ( double  x,
double  y,
int  xUnits,
QxrdCenterFinderPtr  cf,
double  xc,
double  yc,
double  dst,
double  nrg,
double  pxl,
double  pxh,
double  rot,
double  cosr,
double  sinr,
double  cosb,
double  sinb,
double  cosa,
double  sina 
) const

Definition at line 202 of file qxrdintegrator.cpp.

References RadialIntegrateQ, RadialIntegrateR, and RadialIntegrateTTH.

211 {
212  double xVal = 0;
213  double junk;
214 
215  switch(xUnits) {
216  case RadialIntegrateTTH:
217  xVal = cf->getTwoTheta(xc,yc,dst,x,y,pxl,pxh,cosb,sinb,cosr,sinr);
218  break;
219 
220  case RadialIntegrateQ:
221  cf->getQChi(xc,yc,dst,nrg,x,y,pxl,pxh,rot,cosb,sinb,cosa,sina,cosr,sinr,&xVal, &junk);
222  break;
223 
224  case RadialIntegrateR:
225  xVal = cf->getRadius(xc,yc,dst,x,y,pxl,pxh,cosb,sinb,cosr,sinr);
226  break;
227  }
228 
229  return xVal;
230 }

Member Data Documentation

QxrdCenterFinderWPtr QxrdIntegrator::m_CenterFinder
private

Definition at line 158 of file qxrdintegrator.h.

Referenced by performIntegration(), QxrdIntegrator(), and XValue().

QxrdExperimentWPtr QxrdIntegrator::m_Experiment
private
QxrdIntegratorCachePtr QxrdIntegrator::m_IntegratorCache
private
QMutex QxrdIntegrator::m_Mutex
mutableprivate

Definition at line 155 of file qxrdintegrator.h.

QcepSettingsSaverWPtr QxrdIntegrator::m_Saver
private

Definition at line 156 of file qxrdintegrator.h.

Property Documentation

double QxrdIntegrator::attenuationLength
readwrite

Definition at line 62 of file qxrdintegrator.h.

bool QxrdIntegrator::enableAbsorptionCorrections
readwrite

Definition at line 59 of file qxrdintegrator.h.

bool QxrdIntegrator::enableGeometricCorrections
readwrite

Definition at line 50 of file qxrdintegrator.h.

bool QxrdIntegrator::enablePolarizationCorrections
readwrite

Definition at line 53 of file qxrdintegrator.h.

int QxrdIntegrator::enableUserAbsorption
readwrite

Definition at line 74 of file qxrdintegrator.h.

int QxrdIntegrator::enableUserGeometry
readwrite

Definition at line 65 of file qxrdintegrator.h.

double QxrdIntegrator::integrationMaximum
readwrite

Definition at line 44 of file qxrdintegrator.h.

double QxrdIntegrator::integrationMinimum
readwrite

Definition at line 41 of file qxrdintegrator.h.

int QxrdIntegrator::integrationNSteps
readwrite

Definition at line 38 of file qxrdintegrator.h.

double QxrdIntegrator::integrationStep
readwrite

Definition at line 35 of file qxrdintegrator.h.

int QxrdIntegrator::integrationXUnits
readwrite

Definition at line 47 of file qxrdintegrator.h.

int QxrdIntegrator::oversample
readwrite

Definition at line 32 of file qxrdintegrator.h.

double QxrdIntegrator::polarization
readwrite

Definition at line 56 of file qxrdintegrator.h.

double QxrdIntegrator::scalingFactor
readwrite

Definition at line 83 of file qxrdintegrator.h.

bool QxrdIntegrator::selfNormalization
readwrite

Definition at line 86 of file qxrdintegrator.h.

double QxrdIntegrator::selfNormalizationMaximum
readwrite

Definition at line 92 of file qxrdintegrator.h.

double QxrdIntegrator::selfNormalizationMinimum
readwrite

Definition at line 89 of file qxrdintegrator.h.

QString QxrdIntegrator::userAbsorptionFunction
readwrite

Definition at line 80 of file qxrdintegrator.h.

QString QxrdIntegrator::userAbsorptionScript
readwrite

Definition at line 77 of file qxrdintegrator.h.

QString QxrdIntegrator::userGeometryFunction
readwrite

Definition at line 71 of file qxrdintegrator.h.

QString QxrdIntegrator::userGeometryScript
readwrite

Definition at line 68 of file qxrdintegrator.h.


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