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

#include <qxrdacquisition.h>

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

Public Slots

void propertyList ()
 
void Message (QString cmd)
 
void dynamicProperties ()
 
void updateSaveTimes ()
 
void printMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void criticalMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void statusMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void clearDropped ()
 
void shutdown ()
 
void onBufferSizeChanged (int newMB)
 
void doAcquire ()
 
void doAcquireDark ()
 
bool sanityCheckCommon ()
 
bool sanityCheckAcquire ()
 
bool sanityCheckAcquireDark ()
 
virtual void onExposureTimeChanged ()
 
void appendDetector (int detType)
 
void appendDetectorProxy (QxrdDetectorProxyPtr proxy)
 
void clearDetectors ()
 
void configureDetector (int i)
 
void openDetectorControlWindow (int i)
 
QxrdDetectorThreadPtr detectorThread (int n)
 
QxrdDetectorPtr detector (int n)
 
QString currentFileBase (int detNum, QString extension="")
 
double scalerValue (int i)
 
- Public Slots inherited from QxrdAcquisitionInterface
void acquire ()
 
void acquireDark ()
 
void cancel ()
 
void trigger ()
 
int acquisitionStatus (double time)
 
virtual void doAcquire ()=0
 
virtual void doAcquireDark ()=0
 
virtual bool sanityCheckAcquire ()=0
 
virtual bool sanityCheckAcquireDark ()=0
 
- 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)
 

Signals

void detectorStateChanged ()
 
void extraInputsChanged ()
 
- Signals inherited from QxrdAcquisitionInterface
void acquiredFrame (QString fileName, int iphase, int nphases, int isum, int nsum, int igroup, int ngroup)
 
void acquireStarted ()
 
void acquireComplete ()
 

Public Member Functions

 QxrdAcquisition (QcepSettingsSaverWPtr saver, QxrdExperimentWPtr doc, QxrdDataProcessorWPtr proc, QcepAllocatorWPtr allocator)
 
 ~QxrdAcquisition ()
 
void initialize ()
 
void setWindow (QxrdWindowWPtr win)
 
virtual void setupExposureMenu (QDoubleSpinBox *cb)
 
void readSettings (QSettings *settings, QString section)
 
void writeSettings (QSettings *settings, QString section)
 
void copyDynamicProperties (QObject *dest)
 
int currentPhase (int frameNumber)
 
void indicateDroppedFrame (int n)
 
virtual QxrdAcquisitionDialogPtr controlPanel (QxrdWindowWPtr win)
 
QcepAllocatorWPtr allocator () const
 
QxrdSynchronizedAcquisitionPtr synchronizedAcquisition () const
 
QxrdAcquisitionExtraInputsPtr acquisitionExtraInputs () const
 
void setNIDAQPlugin (QxrdNIDAQPluginInterfacePtr nidaqPlugin)
 
QxrdNIDAQPluginInterfacePtr nidaqPlugin () const
 
QxrdAcquisitionScalerModelPtr acquisitionScalerModel () const
 
- Public Member Functions inherited from QxrdAcquisitionInterface
 QxrdAcquisitionInterface (QcepSettingsSaverWPtr saver, QxrdExperimentWPtr doc, QxrdDataProcessorWPtr proc, QcepAllocatorWPtr allocator)
 
 ~QxrdAcquisitionInterface ()
 
QxrdAcquisitionParameterPackPtr acquisitionParameterPack ()
 
QxrdDarkAcquisitionParameterPackPtr darkAcquisitionParameterPack ()
 
- Public Member Functions inherited from QcepObject
 QcepObject (QString name, QcepObject *parent)
 
virtual ~QcepObject ()
 
QString get_Name () const
 
void set_Name (QString name)
 

Protected Slots

void onIdleTimeout ()
 

Protected Member Functions

void acquisition (int isDark)
 
void copyParameters (int isDark)
 
void getFileBaseAndName (QString filePattern, QString extent, int detNum, int fileIndex, int phase, int nphases, QString &fileBase, QString &fileName)
 
QxrdExperimentWPtr experiment ()
 
QxrdDataProcessorWPtr dataProcessor ()
 
QxrdAcquisitionPtr myself ()
 

Properties

QString qxrdVersion
 
QString qtVersion
 
int detectorCount
 
int lastAcquired
 
int fileIndex
 
int fileIndexWidth
 
int filePhaseWidth
 
int fileOverflowWidth
 
int detectorNumberWidth
 
QString fileBase
 
int overflowLevel
 
double raw16SaveTime
 
double raw32SaveTime
 
double rawSaveTime
 
double darkSaveTime
 
QString userComment1
 
QString userComment2
 
QString userComment3
 
QString userComment4
 
QcepDoubleList normalization
 
int droppedFrames
 
bool liveViewAtIdle
 
bool acquisitionCancelsLiveView
 
bool retryDropped
 
QcepDoubleVector scalerValues
 
- Properties inherited from QxrdAcquisitionInterface
int cancelling
 
int triggered
 
double exposureTime
 
int skippedExposuresAtStart
 
int phasesInGroup
 
int currentPhase
 
int summedExposures
 
int darkSummedExposures
 
int currentSummation
 
int skippedExposures
 
int preTriggerFiles
 
int postTriggerFiles
 
int currentFile
 
QString filePattern
 
- Properties inherited from QcepObject
QString name
 

Private Member Functions

virtual void stopIdling ()
 
virtual void startIdling ()
 
void accumulateAcquiredImage (QcepInt16ImageDataPtr image, QcepInt32ImageDataPtr accum, QcepMaskDataPtr overflow)
 
void accumulateAcquiredImage (QcepInt32ImageDataPtr image, QcepInt32ImageDataPtr accum, QcepMaskDataPtr overflow)
 
void accumulateAcquiredImage (QcepImageDataBasePtr image, QcepInt32ImageDataPtr accum, QcepMaskDataPtr overflow)
 
void processImage (const QxrdProcessArgs &args)
 
void processImage (QString filePattern, QString extent, int fileIndex, int phase, int nPhases, bool trig, QcepInt32ImageDataPtr image, QcepMaskDataPtr overflow)
 
void processAcquiredImage (QString filePattern, QString extent, int fileIndex, int phase, int nPhases, bool trig, QcepInt32ImageDataPtr image, QcepMaskDataPtr overflow)
 
void processDarkImage (QString filePattern, QString extent, int fileIndex, QcepInt32ImageDataPtr image, QcepMaskDataPtr overflow)
 
int cancelling ()
 

Private Attributes

QMutex m_Mutex
 
QxrdSynchronizedAcquisitionPtr m_SynchronizedAcquisition
 
QxrdAcquisitionExtraInputsPtr m_AcquisitionExtraInputs
 
QxrdExperimentWPtr m_Experiment
 
QxrdWindowWPtr m_Window
 
QcepAllocatorWPtr m_Allocator
 
QxrdDataProcessorWPtr m_DataProcessor
 
QxrdAcquisitionDialogPtr m_ControlPanel
 
QTimer m_IdleTimer
 
QAtomicInt m_Idling
 
QVector< QxrdDetectorThreadPtrm_DetectorThreads
 
QVector< QxrdDetectorPtrm_Detectors
 
QxrdAcquisitionScalerModelPtr m_ScalerModel
 

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)
 
- Protected Attributes inherited from QxrdAcquisitionInterface
QcepSettingsSaverWPtr m_Saver
 
QMutex m_Acquiring
 
QWaitCondition m_StatusWaiting
 

Detailed Description

Definition at line 35 of file qxrdacquisition.h.

Constructor & Destructor Documentation

QxrdAcquisition::QxrdAcquisition ( QcepSettingsSaverWPtr  saver,
QxrdExperimentWPtr  doc,
QxrdDataProcessorWPtr  proc,
QcepAllocatorWPtr  allocator 
)

Definition at line 25 of file qxrdacquisition.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

29  : QxrdAcquisitionInterface(saver, doc, proc, allocator),
30  m_QxrdVersion(QcepSettingsSaverWPtr(), this,"qxrdVersion",STR(QXRD_VERSION), "QXRD Version Number"),
31  m_QtVersion(QcepSettingsSaverWPtr(), this,"qtVersion",qVersion(), "QT Version Number"),
32  m_DetectorCount(m_Saver, this, "detectorCount", 0, "Number of Detectors"),
33  m_LastAcquired(QcepSettingsSaverWPtr(), this, "lastAcquired", 0, "Internal Acquisition Flag"),
34  m_FileIndex(saver, this,"fileIndex",0, "File Index"),
35  m_FileIndexWidth(saver, this, "fileIndexWidth", 5, "Digits in File Index Field"),
36  m_FilePhaseWidth(saver, this, "filePhaseWidth", 3, "Digits in Phase Number Field"),
37  m_FileOverflowWidth(saver, this, "fileOverflowWidth", 5, "Digits in Overflow Index Field"),
38  m_DetectorNumberWidth(saver, this, "detectorNumberWidth", 2, "Digits in detector number field"),
39  m_FileBase(saver, this,"fileBase","", "File Base"),
40  m_OverflowLevel(saver, this, "overflowLevel", 65500, "Overflow level (per exposure)"),
41  m_Raw16SaveTime(saver, this,"raw16SaveTime", 0.1, "Time to save 16 bit images"),
42  m_Raw32SaveTime(saver, this,"raw32SaveTime", 0.2, "Time to save 32 bit images"),
43  m_RawSaveTime(saver, this,"rawSaveTime", 0.2, "Time to save raw images"),
44  m_DarkSaveTime(saver, this,"darkSaveTime", 0.2, "Time to save dark images"),
45  m_UserComment1(saver, this,"userComment1","", "User Comment 1"),
46  m_UserComment2(saver, this,"userComment2","", "User Comment 2"),
47  m_UserComment3(saver, this,"userComment3","", "User Comment 3"),
48  m_UserComment4(saver, this,"userComment4","", "User Comment 4"),
49  m_Normalization(saver, this, "normalization", QcepDoubleList(), "Normalization Values"),
50  m_DroppedFrames(QcepSettingsSaverWPtr(), this,"droppedFrames",0, "Number of Dropped Frames"),
51  m_LiveViewAtIdle(saver, this, "liveViewAtIdle", false, "Live View during Idle"),
52  m_AcquisitionCancelsLiveView(saver, this, "acquisitionCancelsLiveView", true, "Acquisition operations cancel live view"),
53  m_RetryDropped(saver, this, "retryDropped", false, "Automatically retry dropped frames during acquisition"),
54  m_ScalerValues(QcepSettingsSaverWPtr(), this, "scalerValues", QcepDoubleVector(), "Scaler Values"),
55  m_Mutex(QMutex::Recursive),
58  m_Experiment(doc),
59  m_Window(),
61  m_DataProcessor(proc),
62  m_ControlPanel(NULL),
63  m_Idling(1)
64 {
66  printf("QxrdAcquisition::QxrdAcquisition(%p)\n", this);
67  }
68 }
QxrdWindowWPtr m_Window
QxrdSynchronizedAcquisitionPtr m_SynchronizedAcquisition
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdDataProcessorWPtr m_DataProcessor
QxrdAcquisitionInterface(QcepSettingsSaverWPtr saver, QxrdExperimentWPtr doc, QxrdDataProcessorWPtr proc, QcepAllocatorWPtr allocator)
#define STR(s)
Definition: qcepmacros.h:16
QVector< double > QcepDoubleVector
Definition: qcepmacros.h:19
QList< double > QcepDoubleList
Definition: qcepmacros.h:28
QxrdExperimentWPtr m_Experiment
QcepAllocatorWPtr allocator() const
QAtomicInt m_Idling
QcepAllocatorWPtr m_Allocator
QxrdAcquisitionDialogPtr m_ControlPanel
QxrdAcquisitionExtraInputsPtr m_AcquisitionExtraInputs
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr

Here is the call graph for this function:

QxrdAcquisition::~QxrdAcquisition ( )

Definition at line 134 of file qxrdacquisition.cpp.

References DEBUG_APP, DEBUG_CONSTRUCTORS, printMessage(), and qcepDebug().

135 {
136 #ifndef QT_NO_DEBUG
137  printf("Deleting acquisition\n");
138 #endif
139 
141  printf("QxrdAcquisition::~QxrdAcquisition(%p)\n", this);
142  }
143 
144  if (qcepDebug(DEBUG_APP)) {
145  printMessage("QxrdAcquisition::~QxrdAcquisition");
146  }
147 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Member Function Documentation

void QxrdAcquisition::accumulateAcquiredImage ( QcepInt16ImageDataPtr  image,
QcepInt32ImageDataPtr  accum,
QcepMaskDataPtr  overflow 
)
private

Definition at line 576 of file qxrdacquisition.cpp.

References DEBUG_ACQUIRE, printMessage(), and qcepDebug().

Referenced by accumulateAcquiredImage(), doAcquire(), and doAcquireDark().

577 {
578  if (image && accum && overflow) {
579  long nPixels = image->get_Height()*image->get_Width();
580  int ovflwlvl = get_OverflowLevel();
581  quint16* src = image->data();
582  quint32* dst = accum->data();
583  short int* ovf = overflow->data();
584  int nsummed = accum->get_SummedExposures();
585 
586  if (nsummed == 0) {
587  if (qcepDebug(DEBUG_ACQUIRE)) {
588  printMessage(tr("Frame %1 saved").arg(nsummed));
589  }
590 
591  for (long i=0; i<nPixels; i++) {
592  quint16 val = *src++;
593 
594  if (val>ovflwlvl) {
595  *ovf++ = 1;
596  } else {
597  *ovf++ = 0;
598  }
599 
600  *dst++ = val;
601  }
602 
603  accum->set_Normalization(image->get_Normalization());
604  accum->set_ExtraInputs(image->get_ExtraInputs());
605  accum->set_SummedExposures(1);
606  accum->set_ImageSequenceNumber(image->get_ImageSequenceNumber());
607  } else {
608  if (qcepDebug(DEBUG_ACQUIRE)) {
609  printMessage(tr("Frame %1 summed").arg(nsummed));
610  }
611 
612  for (long i=0; i<nPixels; i++) {
613  quint16 val = *src++;
614 
615  if (val>ovflwlvl) {
616  *ovf++ += 1;
617  } else {
618  ovf++;
619  }
620 
621  *dst++ += val;
622  }
623 
624  accum->prop_Normalization() -> incValue(image->get_Normalization());
625  accum->prop_ExtraInputs() -> incValue(image->get_ExtraInputs());
626  accum->prop_SummedExposures() -> incValue(1);
627  accum->prop_ImageSequenceNumber() -> incValue(image->get_ImageSequenceNumber());
628  }
629  }
630 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdAcquisition::accumulateAcquiredImage ( QcepInt32ImageDataPtr  image,
QcepInt32ImageDataPtr  accum,
QcepMaskDataPtr  overflow 
)
private

Definition at line 632 of file qxrdacquisition.cpp.

References DEBUG_ACQUIRE, printMessage(), and qcepDebug().

633 {
634  if (image && accum && overflow) {
635  long nPixels = image->get_Height()*image->get_Width();
636  int ovflwlvl = get_OverflowLevel();
637  quint32* src = image->data();
638  quint32* dst = accum->data();
639  short int* ovf = overflow->data();
640  int nsummed = accum->get_SummedExposures();
641 
642  if (nsummed == 0) {
643  if (qcepDebug(DEBUG_ACQUIRE)) {
644  printMessage(tr("Frame %1 saved").arg(nsummed));
645  }
646 
647  for (long i=0; i<nPixels; i++) {
648  quint32 val = *src++;
649 
650  if (val>ovflwlvl) {
651  *ovf++ = 1;
652  } else {
653  *ovf++ = 0;
654  }
655 
656  *dst++ = val;
657  }
658 
659  accum->set_Normalization(image->get_Normalization());
660  accum->set_ExtraInputs(image->get_ExtraInputs());
661  accum->set_SummedExposures(1);
662  accum->set_ImageSequenceNumber(image->get_ImageSequenceNumber());
663  } else {
664  if (qcepDebug(DEBUG_ACQUIRE)) {
665  printMessage(tr("Frame %1 summed").arg(nsummed));
666  }
667 
668  for (long i=0; i<nPixels; i++) {
669  quint32 val = *src++;
670 
671  if (val>ovflwlvl) {
672  *ovf++ += 1;
673  } else {
674  ovf++;
675  }
676 
677  *dst++ += val;
678  }
679 
680  accum->prop_Normalization() -> incValue(image->get_Normalization());
681  accum->prop_ExtraInputs() -> incValue(image->get_ExtraInputs());
682  accum->prop_SummedExposures() -> incValue(1);
683  accum->prop_ImageSequenceNumber() -> incValue(image->get_ImageSequenceNumber());
684  }
685  }
686 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

void QxrdAcquisition::accumulateAcquiredImage ( QcepImageDataBasePtr  image,
QcepInt32ImageDataPtr  accum,
QcepMaskDataPtr  overflow 
)
private

Definition at line 559 of file qxrdacquisition.cpp.

References accumulateAcquiredImage(), and printMessage().

560 {
561  QcepInt16ImageDataPtr img16 = qSharedPointerCast<QcepInt16ImageData>(image);
562 
563  if (img16) {
564  accumulateAcquiredImage(img16, accum, overflow);
565  } else {
566  QcepInt32ImageDataPtr img32 = qSharedPointerCast<QcepInt32ImageData>(image);
567 
568  if (img32) {
569  accumulateAcquiredImage(img32, accum, overflow);
570  } else {
571  printMessage("type conversion failed in QxrdAcquisition::accumulateAcquiredImage");
572  }
573  }
574 }
void accumulateAcquiredImage(QcepInt16ImageDataPtr image, QcepInt32ImageDataPtr accum, QcepMaskDataPtr overflow)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QcepInt32ImageData > QcepInt32ImageDataPtr
QSharedPointer< QcepInt16ImageData > QcepInt16ImageDataPtr

Here is the call graph for this function:

void QxrdAcquisition::acquisition ( int  isDark)
protected
QxrdAcquisitionExtraInputsPtr QxrdAcquisition::acquisitionExtraInputs ( ) const

Definition at line 911 of file qxrdacquisition.cpp.

References m_AcquisitionExtraInputs.

Referenced by doAcquire().

912 {
914 }
QxrdAcquisitionExtraInputsPtr m_AcquisitionExtraInputs

Here is the caller graph for this function:

QxrdAcquisitionScalerModelPtr QxrdAcquisition::acquisitionScalerModel ( ) const

Definition at line 159 of file qxrdacquisition.cpp.

References m_ScalerModel.

160 {
161  return m_ScalerModel;
162 }
QxrdAcquisitionScalerModelPtr m_ScalerModel
QcepAllocatorWPtr QxrdAcquisition::allocator ( ) const

Definition at line 433 of file qxrdacquisition.cpp.

References m_Allocator.

434 {
435  return m_Allocator;
436 }
QcepAllocatorWPtr m_Allocator
void QxrdAcquisition::appendDetector ( int  detType)
slot

Definition at line 303 of file qxrdacquisition.cpp.

References experiment(), m_Detectors, m_DetectorThreads, QxrdAcquisitionInterface::m_Saver, and myself().

304 {
305  if (QThread::currentThread() != thread()) {
306  QMetaObject::invokeMethod(this, "appendDetector", Qt::BlockingQueuedConnection,
307  Q_ARG(int, detType));
308  } else {
309  int nDet = get_DetectorCount();
310 
311  QxrdDetectorThreadPtr detThread =
313  experiment(),
314  myself(),
315  detType,
316  nDet,
317  this));
318 
319  if (detThread) {
320  detThread->start();
321 
322  QxrdDetectorPtr det = detThread->detector();
323 
324  if (det) {
325  m_DetectorThreads.append(detThread);
326  m_Detectors.append(det);
327 
328  set_DetectorCount(m_Detectors.count());
329  }
330  }
331  }
332 }
QVector< QxrdDetectorPtr > m_Detectors
QxrdExperimentWPtr experiment()
QxrdAcquisitionPtr myself()
QVector< QxrdDetectorThreadPtr > m_DetectorThreads
QSharedPointer< QxrdDetectorThread > QxrdDetectorThreadPtr
QSharedPointer< QxrdDetector > QxrdDetectorPtr

Here is the call graph for this function:

void QxrdAcquisition::appendDetectorProxy ( QxrdDetectorProxyPtr  proxy)
slot

Definition at line 334 of file qxrdacquisition.cpp.

References detector(), experiment(), m_Detectors, m_DetectorThreads, QxrdAcquisitionInterface::m_Saver, and myself().

335 {
336  if (QThread::currentThread() != thread()) {
337  QMetaObject::invokeMethod(this, "appendDetectorProxy", Qt::BlockingQueuedConnection,
338  Q_ARG(QxrdDetectorProxyPtr, proxy));
339  } else {
340  if (proxy) {
341  QxrdDetectorThreadPtr detThread = proxy->detectorThread();
342  QxrdDetectorPtr detector = proxy->detector();
343 
344  int nDet = get_DetectorCount();
345 
346  if (detThread==NULL || detector==NULL) {
347  int detType = proxy->detectorType();
348 
349  detThread =
351  experiment(),
352  myself(),
353  detType,
354  nDet,
355  this));
356  detThread->start();
357 
358  detector = detThread->detector();
359  }
360 
361  m_DetectorThreads.append(detThread);
362  m_Detectors.append(detector);
363 
364  set_DetectorCount(m_Detectors.count());
365 
366  detector->pullPropertiesfromProxy(proxy);
367  }
368  }
369 }
QSharedPointer< QxrdDetectorProxy > QxrdDetectorProxyPtr
QVector< QxrdDetectorPtr > m_Detectors
QxrdExperimentWPtr experiment()
QxrdDetectorPtr detector(int n)
QxrdAcquisitionPtr myself()
QVector< QxrdDetectorThreadPtr > m_DetectorThreads
QSharedPointer< QxrdDetectorThread > QxrdDetectorThreadPtr
QSharedPointer< QxrdDetector > QxrdDetectorPtr

Here is the call graph for this function:

int QxrdAcquisition::cancelling ( )
private

Definition at line 916 of file qxrdacquisition.cpp.

References printMessage(), and statusMessage().

Referenced by doAcquire(), and doAcquireDark().

917 {
918  int res = get_Cancelling();
919 
920  if (res) {
921  printMessage(tr("Cancelling acquisition"));
922  statusMessage(tr("Cancelling acquisition"));
923  }
924 
925  return res;
926 }
void statusMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdAcquisition::clearDetectors ( )
slot

Definition at line 371 of file qxrdacquisition.cpp.

References m_Detectors.

372 {
373  if (QThread::currentThread() != thread()) {
374  QMetaObject::invokeMethod(this, "clearDetectors", Qt::BlockingQueuedConnection);
375  } else {
376  m_Detectors.resize(0);
377 
378  set_DetectorCount(0);
379  }
380 }
QVector< QxrdDetectorPtr > m_Detectors
void QxrdAcquisition::clearDropped ( )
slot

Definition at line 537 of file qxrdacquisition.cpp.

Referenced by QxrdAcquisitionDialog::QxrdAcquisitionDialog().

538 {
539  prop_DroppedFrames() -> setValue(0);
540 }

Here is the caller graph for this function:

void QxrdAcquisition::configureDetector ( int  i)
slot

Definition at line 515 of file qxrdacquisition.cpp.

References detector(), detectorThread(), myself(), and printMessage().

Referenced by QxrdWindow::populateConfigureDetectorMenu().

516 {
517  printMessage(tr("Configure Detector %1").arg(i));
518 
519  QxrdDetectorPtr det = detector(i);
520 
522 
523  if (proxy && proxy->configureDetector()) {
524  det->pullPropertiesfromProxy(proxy);
525  }
526 }
QSharedPointer< QxrdDetectorProxy > QxrdDetectorProxyPtr
QxrdDetectorPtr detector(int n)
QxrdDetectorThreadPtr detectorThread(int n)
QxrdAcquisitionPtr myself()
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QxrdDetector > QxrdDetectorPtr

Here is the call graph for this function:

Here is the caller graph for this function:

QxrdAcquisitionDialogPtr QxrdAcquisition::controlPanel ( QxrdWindowWPtr  win)
virtual

Definition at line 869 of file qxrdacquisition.cpp.

References m_ControlPanel, m_DataProcessor, m_Experiment, m_Window, and myself().

870 {
871  if (win) {
872  m_Window = win;
873 
875  m_Window,
876  myself(),
878  m_Window.data());
879 
880  return m_ControlPanel;
881  } else {
882  return NULL;
883  }
884 }
QxrdWindowWPtr m_Window
QxrdDataProcessorWPtr m_DataProcessor
QxrdAcquisitionPtr myself()
QxrdExperimentWPtr m_Experiment
QxrdAcquisitionDialogPtr m_ControlPanel

Here is the call graph for this function:

void QxrdAcquisition::copyDynamicProperties ( QObject *  dest)

Definition at line 203 of file qxrdacquisition.cpp.

References QcepObject::name.

Referenced by processImage().

204 {
205  if (dest) {
206  QByteArray name;
207 
208  foreach(name, dynamicPropertyNames()) {
209  dest -> setProperty(name.data(), property(name.data()));
210  }
211  }
212 }
QString name
Definition: qcepobject.h:49

Here is the caller graph for this function:

void QxrdAcquisition::copyParameters ( int  isDark)
protected
void QxrdAcquisition::criticalMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
slot

Definition at line 406 of file qxrdacquisition.cpp.

References m_Experiment.

Referenced by doAcquireDark(), sanityCheckAcquire(), sanityCheckAcquireDark(), and sanityCheckCommon().

407 {
409 
410  if (exp) {
411  exp->criticalMessage(msg, ts);
412  }
413 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment

Here is the caller graph for this function:

QString QxrdAcquisition::currentFileBase ( int  detNum,
QString  extension = "" 
)
slot

Definition at line 688 of file qxrdacquisition.cpp.

References detector(), fileBase, and getFileBaseAndName().

689 {
690  QString fileBase, fileName;
691 
692  QxrdDetectorPtr det = detector(detNum);
693  QString extent;
694 
695  if (extension.length()) {
696  extent = extension;
697  } else if (det) {
698  extent = det->get_Extension();
699  } else {
700  extent = "tif";
701  }
702 
704  get_FilePattern(),
705  extent,
706  detNum,
707  get_CurrentFile(),
708  get_CurrentPhase(),
709  get_PhasesInGroup(),
710  fileBase, fileName);
711 
712  return fileBase;
713 }
void getFileBaseAndName(QString filePattern, QString extent, int detNum, int fileIndex, int phase, int nphases, QString &fileBase, QString &fileName)
QxrdDetectorPtr detector(int n)
QSharedPointer< QxrdDetector > QxrdDetectorPtr

Here is the call graph for this function:

int QxrdAcquisition::currentPhase ( int  frameNumber)
QxrdDataProcessorWPtr QxrdAcquisition::dataProcessor ( )
protected

Definition at line 154 of file qxrdacquisition.cpp.

References m_DataProcessor.

155 {
156  return m_DataProcessor;
157 }
QxrdDataProcessorWPtr m_DataProcessor
QxrdDetectorPtr QxrdAcquisition::detector ( int  n)
slot

Definition at line 387 of file qxrdacquisition.cpp.

References m_Detectors.

Referenced by appendDetectorProxy(), configureDetector(), currentFileBase(), doAcquire(), doAcquireDark(), getFileBaseAndName(), onIdleTimeout(), openDetectorControlWindow(), sanityCheckCommon(), and shutdown().

388 {
389  return m_Detectors.value(n);
390 }
QVector< QxrdDetectorPtr > m_Detectors

Here is the caller graph for this function:

void QxrdAcquisition::detectorStateChanged ( )
signal

Referenced by QxrdDetector::initialize(), and QxrdAcquisitionScalerModel::QxrdAcquisitionScalerModel().

Here is the caller graph for this function:

QxrdDetectorThreadPtr QxrdAcquisition::detectorThread ( int  n)
slot

Definition at line 382 of file qxrdacquisition.cpp.

References m_DetectorThreads.

Referenced by configureDetector().

383 {
384  return m_DetectorThreads.value(n);
385 }
QVector< QxrdDetectorThreadPtr > m_DetectorThreads

Here is the caller graph for this function:

void QxrdAcquisition::doAcquire ( )
slot

Definition at line 928 of file qxrdacquisition.cpp.

References accumulateAcquiredImage(), QxrdAcquisitionInterface::acquireComplete(), QxrdAcquisitionInterface::acquiredFrame(), acquisitionExtraInputs(), QxrdAcquisitionInterface::acquisitionParameterPack(), QcepAllocator::AllocateFromReserve, QxrdAcquisitionInterface::cancel(), cancelling(), DEBUG_ACQUIRETIME, detector(), fileBase, fileIndex, getFileBaseAndName(), indicateDroppedFrame(), QxrdAcquisitionInterface::m_Acquiring, QcepAllocator::newInt32Image(), QcepAllocator::newMask(), printMessage(), processAcquiredImage(), qcepDebug(), startIdling(), statusMessage(), stopIdling(), and synchronizedAcquisition().

929 {
931 
932  if (parmsp) {
933  QTime acqTimer;
934  acqTimer.start();
935 
936  stopIdling();
937 
938  QString fileBase = parmsp->fileBase();
939  int fileIndex = get_FileIndex();
940  double exposure = parmsp->exposure();
941  int nsummed = parmsp->nsummed();
942  int preTrigger = parmsp->preTrigger();
943  int postTrigger = parmsp->postTrigger();
944  int nphases = parmsp->nphases();
945  int skipBefore = parmsp->skipBefore();
946 
947  if (skipBefore <= 0) {
948  if (get_LastAcquired() != 1) {
949  skipBefore = 1;
950  }
951  }
952 
953  set_LastAcquired(1);
954 
955  int skipBetween = parmsp->skipBetween();
956  int nPreTriggered = 0;
957 
958  if (preTrigger <= 0) {
959  set_Triggered(true);
960  }
961 
962  int nDet = 0;
963  QVector<QxrdDetectorPtr> dets;
964  QVector<QxrdDetectorProcessorPtr> procs;
965  QVector<QVector<QVector<QcepInt32ImageDataPtr> > >res;
966  QVector<QVector<QVector<QcepMaskDataPtr> > > ovf;
967 
968  for (int i=0; i<get_DetectorCount(); i++) {
969  QxrdDetectorPtr det = detector(i);
970 
971  if (det && det->isEnabled()) {
972  nDet++;
973  dets.append(det);
974  procs.append(det->processor());
975 
976  res.resize(nDet);
977  ovf.resize(nDet);
978 
979  res[nDet-1].resize(nphases);
980  ovf[nDet-1].resize(nphases);
981 
982  for (int p=0; p<nphases; p++) {
983  res[nDet-1][p].resize(preTrigger+1);
984  ovf[nDet-1][p].resize(preTrigger+1);
985  }
986  }
987  }
988 
989 
990  if (synchronizedAcquisition()) {
991  synchronizedAcquisition()->prepareForAcquisition(parmsp);
992  }
993 
994  if (acquisitionExtraInputs()) {
995  acquisitionExtraInputs()->prepareForAcquisition(parmsp);
996  }
997 
998  for (int d=0; d<nDet; d++) {
999  dets[d] -> beginAcquisition(exposure);
1000  }
1001 
1002  printMessage(tr("acquire(\"%1\", %2, %3, %4, %5, %6) // fileIndex = %7")
1003  .arg(fileBase).arg(exposure).arg(nsummed).arg(postTrigger).arg(preTrigger).arg(nphases).arg(fileIndex));
1004 
1005 
1006  set_CurrentPhase(0);
1007  set_CurrentSummation(-1);
1008  set_CurrentFile(fileIndex);
1009 
1010  for (int i=0; i<skipBefore; i++) {
1011  if (cancelling()) goto cancel;
1013  printMessage(tr("Skipping %1 of %2").arg(i+1).arg(skipBefore));
1014  }
1015 
1016  for (int d=0; d<nDet; d++) {
1017  dets[d]->beginFrame();
1018  }
1019 
1020  for (int d=0; d<nDet; d++) {
1021  dets[d]->acquireFrame();
1022  }
1023  }
1024 
1025  for (int i=0; i<postTrigger; i += (get_Triggered() ? 1:0)) {
1026  if (cancelling()) goto cancel;
1027 
1028  set_CurrentFile(fileIndex);
1029 
1030  if (i != 0) {
1031  for (int k=0; k<skipBetween; k++) {
1032  if (cancelling()) goto cancel;
1034  printMessage(tr("Skipping %1 of %2").arg(k+1).arg(skipBetween));
1035  }
1036 
1037  for (int d=0; d<nDet; d++) {
1038  dets[d]->acquireFrame();
1039  }
1040 
1042  printMessage(tr("Frame after %1 msec").arg(acqTimer.restart()));
1043  }
1044  }
1045  }
1046 
1047  if (cancelling()) goto cancel;
1048 
1049  for (int s=0; s<nsummed;) {
1050  set_CurrentSummation(s);
1051 
1052  for (int p=0; p<nphases; p++) {
1053  set_CurrentPhase(p);
1054 
1055  for (int d=0; d<nDet; d++) {
1056  QxrdDetectorPtr det = dets[d];
1057 
1058  det->beginFrame();
1059  }
1060 
1061  for (int d=0; d<nDet; d++) {
1062  QxrdDetectorPtr det = dets[d];
1063  int nCols = det->get_NCols();
1064  int nRows = det->get_NRows();
1065 
1066  if (res[d][p][0] == NULL) {
1068  nCols, nRows, this);
1069 
1070  res[d][p][0] = nres;
1071 
1072  if (nres == NULL) {
1074  printMessage("Dropped frame allocation...");
1075  }
1077  } else {
1078  QString fb, fn;
1080  printMessage(tr("Newly allocated image number %1").arg(nres->get_ImageNumber()));
1081  }
1082 
1083  nres -> set_SummedExposures(0);
1084 
1085  getFileBaseAndName(fileBase, det->get_Extension(),
1086  det->get_DetectorNumber(),
1087  fileIndex, p, nphases, fb, fn);
1088 
1089  nres -> set_FileBase(fb);
1090  nres -> set_FileName(fn);
1091  }
1092  }
1093 
1094  if (ovf[d][p][0] == NULL) {
1096  nCols, nRows, 0, this);
1097  ovf[d][p][0] = novf;
1098 
1099  if (novf == NULL) {
1101  printMessage("Dropped mask frame allocation...");
1102  }
1104  } else {
1106  printMessage(tr("Newly allocated mask number %1").arg(novf->get_ImageNumber()));
1107  }
1108  }
1109 
1110  if (novf) ovf[d][p][0] -> set_SummedExposures(0);
1111  }
1112 
1113  if (res[d][p][0]) {
1114  emit acquiredFrame(res[d][p][0]->get_FileBase(),
1115  p, nphases,
1116  s, nsummed,
1117  i, postTrigger);
1118  }
1119 
1120  QcepImageDataBasePtr img = det -> acquireFrame();
1121 
1122  if (img && res[d][p][0] && ovf[d][p][0]) {
1123  accumulateAcquiredImage(img, res[d][p][0], ovf[d][p][0]);
1124  } else if (!cancelling()){
1126  }
1127 
1129  printMessage(tr("accumulateAcquiredImage %1 msec idx:%2 post:%3 sum: %4 ph:%5")
1130  .arg(acqTimer.restart())
1131  .arg(fileIndex)
1132  .arg(i)
1133  .arg(s)
1134  .arg(p)
1135  );
1136  }
1137 
1138  if (cancelling()) goto saveCancel;
1139  }
1140  }
1141 
1142  if (get_RetryDropped()) {
1143  int minSum = nsummed+10;
1144 
1145  for (int p=0; p<nphases; p++) {
1146  for (int d=0; d<nDet; d++) {
1147  if (res[d][p][0]) {
1148  int ns = res[d][p][0]->get_SummedExposures();
1149 
1150  if (ns < minSum) {
1151  minSum = ns;
1152  }
1153  } else {
1154  minSum = 0;
1155  }
1156  }
1157  }
1158 
1160  printMessage(tr("i = %1, Minsum = %2, s = %3, nsummed = %4").arg(i).arg(minSum).arg(s).arg(nsummed));
1161  }
1162 
1163  if (minSum == nsummed+10) {
1165  printMessage("No acquired images allocated");
1166  }
1167  // s = s+1;
1168  } else {
1169  s = minSum;
1170  }
1171  } else {
1172  s = s+1;
1173  }
1174  }
1175 
1176 saveCancel:
1177  if (get_Triggered()) {
1178  int nPre = qMin(preTrigger, nPreTriggered);
1179 
1180  for (int ii=nPre; ii >= 1; ii--) {
1181  for (int p=0; p<nphases; p++) {
1182  for (int d=0; d<nDet; d++) {
1183 
1184  procs[d] -> processAcquiredImage(res[d][p][ii], ovf[d][p][ii], fileIndex, p, nphases, false);
1185 
1187  printMessage(tr("processAcquiredImage(line %1) %2 msec idx:%3 pre:%4 ph:%5")
1188  .arg(__LINE__)
1189  .arg(acqTimer.restart())
1190  .arg(fileIndex)
1191  .arg(ii)
1192  .arg(p)
1193  );
1194  }
1195 
1196  res[d][p].pop_back();
1197  ovf[d][p].pop_back();
1198  }
1199  }
1200 
1201  fileIndex++;
1202  set_FileIndex(fileIndex);
1203  }
1204 
1205  nPreTriggered = 0;
1206 
1207  for (int p=0; p<nphases; p++) {
1208  for (int d=0; d<nDet; d++) {
1209  procs[d] -> processAcquiredImage(res[d][p][0], ovf[d][p][0], fileIndex, p, nphases, true);
1210 
1212  printMessage(tr("processAcquiredImage(line %1) %2 msec idx:%3 pre:%4 ph:%5")
1213  .arg(__LINE__)
1214  .arg(acqTimer.restart())
1215  .arg(fileIndex)
1216  .arg(i)
1217  .arg(p)
1218  );
1219  }
1220 
1221  res[d][p][0] = QcepInt32ImageDataPtr();
1222  ovf[d][p][0] = QcepMaskDataPtr();
1223  }
1224  }
1225  fileIndex++;
1226  set_FileIndex(fileIndex);
1227  } else {
1228  nPreTriggered++;
1229  for (int p=0; p<nphases; p++) {
1230  for (int d=0; d<nDet; d++) {
1231  res[d][p].push_front(QcepInt32ImageDataPtr());
1232  ovf[d][p].push_front(QcepMaskDataPtr());
1233  res[d][p].pop_back();
1234  ovf[d][p].pop_back();
1235  }
1236  }
1237  }
1238  }
1239 
1240  statusMessage(tr("Acquisition complete"));
1241  printMessage(tr("Acquisition complete"));
1242 
1243 cancel:
1244  if (synchronizedAcquisition()) {
1245  synchronizedAcquisition()->finishedAcquisition();
1246  }
1247 
1248  for (int d=0; d<nDet; d++) {
1249  dets[d]->endAcquisition();
1250  }
1251 
1252  QVector<double> scalers;
1253 
1254  scalers.append(get_FileIndex()-1);
1255 
1256  if (acquisitionExtraInputs()) {
1257  scalers += acquisitionExtraInputs()->evaluateChannels();
1258  }
1259 
1260  for (int d=0; d<nDet; d++) {
1261  scalers += dets[d]->scalerCounts();
1262  }
1263 
1264  set_ScalerValues(scalers);
1265 
1266  startIdling();
1267  }
1268 
1269  m_Acquiring.unlock();
1270 
1271  emit acquireComplete();
1272 }
void indicateDroppedFrame(int n)
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void getFileBaseAndName(QString filePattern, QString extent, int detNum, int fileIndex, int phase, int nphases, QString &fileBase, QString &fileName)
void acquiredFrame(QString fileName, int iphase, int nphases, int isum, int nsum, int igroup, int ngroup)
void statusMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
virtual void stopIdling()
QxrdDetectorPtr detector(int n)
virtual void startIdling()
QxrdSynchronizedAcquisitionPtr synchronizedAcquisition() const
QxrdAcquisitionParameterPackPtr acquisitionParameterPack()
void accumulateAcquiredImage(QcepInt16ImageDataPtr image, QcepInt32ImageDataPtr accum, QcepMaskDataPtr overflow)
void processAcquiredImage(QString filePattern, QString extent, int fileIndex, int phase, int nPhases, bool trig, QcepInt32ImageDataPtr image, QcepMaskDataPtr overflow)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QxrdAcquisitionExtraInputsPtr acquisitionExtraInputs() const
QSharedPointer< QcepInt32ImageData > QcepInt32ImageDataPtr
QSharedPointer< QxrdAcquisitionParameterPack > QxrdAcquisitionParameterPackPtr
QSharedPointer< QxrdDetector > QxrdDetectorPtr
static QcepMaskDataPtr newMask(AllocationStrategy strat, int width, int height, int def, QcepObject *parent)
QSharedPointer< QcepImageDataBase > QcepImageDataBasePtr
QSharedPointer< QcepMaskData > QcepMaskDataPtr
static QcepInt32ImageDataPtr newInt32Image(AllocationStrategy strat, int width, int height, QcepObject *parent)

Here is the call graph for this function:

void QxrdAcquisition::doAcquireDark ( )
slot

Definition at line 1274 of file qxrdacquisition.cpp.

References accumulateAcquiredImage(), QxrdAcquisitionInterface::acquireComplete(), QxrdAcquisitionInterface::acquiredFrame(), QcepAllocator::AllocateFromReserve, QxrdAcquisitionInterface::cancel(), cancelling(), criticalMessage(), QxrdAcquisitionInterface::darkAcquisitionParameterPack(), DEBUG_ACQUIRETIME, detector(), fileBase, fileIndex, getFileBaseAndName(), indicateDroppedFrame(), QxrdAcquisitionInterface::m_Acquiring, QcepAllocator::newInt32Image(), QcepAllocator::newMask(), printMessage(), qcepDebug(), startIdling(), statusMessage(), stopIdling(), and synchronizedAcquisition().

1275 {
1277 
1278  if (parmsp) {
1279  stopIdling();
1280 
1281  QString fileBase = parmsp->fileBase();
1282  int fileIndex = get_FileIndex();
1283  double exposure = parmsp->exposure();
1284  int nsummed = parmsp->nsummed();
1285  int skipBefore = parmsp->skipBefore();
1286 
1287  if (skipBefore <= 0) {
1288  if (get_LastAcquired() != -1) {
1289  skipBefore = 1;
1290  }
1291  }
1292 
1293  set_LastAcquired(-1);
1294 
1295  printMessage(tr("acquireDark(\"%1\", %2, %3) // fileIndex = %4")
1296  .arg(fileBase).arg(exposure).arg(nsummed).arg(fileIndex));
1297 
1298  int nDet = 0;
1299  QVector<QxrdDetectorPtr> dets;
1300  QVector<QxrdDetectorProcessorPtr> procs;
1301  QVector<QcepInt32ImageDataPtr> res;
1302  QVector<QcepMaskDataPtr> overflow;
1303 
1304  set_CurrentPhase(-1);
1305  set_CurrentSummation(0);
1306  set_CurrentFile(fileIndex);
1307 
1308  for (int i=0; i<get_DetectorCount(); i++) {
1309  QxrdDetectorPtr det = detector(i);
1310 
1311  if (det && det->isEnabled()) {
1312  nDet++;
1313  dets.append(det);
1314  procs.append(det->processor());
1315 
1317  det->get_NCols(), det->get_NRows(), this);
1318 
1319  res.append(img);
1320 
1322  det->get_NCols(), det->get_NRows(),0, this);
1323 
1324  overflow.append(msk);
1325  }
1326  }
1327 
1328  if (synchronizedAcquisition()) {
1329  synchronizedAcquisition()->prepareForDarkAcquisition(parmsp);
1330  }
1331 
1332  QString fb, fn;
1333 
1334  for (int d=0; d<nDet; d++) {
1335  if (res[d] == NULL || overflow[d] == NULL) {
1336  criticalMessage("Insufficient memory for acquisition operation");
1337  goto cancel;
1338  }
1339  }
1340 
1341  for (int d=0; d<nDet; d++) {
1342  dets[d] -> beginAcquisition(exposure);
1343  }
1344 
1345  for (int d=0; d<nDet; d++) {
1346  QxrdDetectorPtr det = dets[d];
1347 
1348  getFileBaseAndName(fileBase, det->get_Extension(), det->get_DetectorNumber(), fileIndex, -1, 1, fb, fn);
1349 
1350  res[d] -> set_FileBase(fb);
1351  res[d] -> set_FileName(fn);
1352  }
1353 
1354  for (int i=0; i<skipBefore; i++) {
1355  if (cancelling()) goto cancel;
1356 
1357  set_CurrentSummation(-1);
1358 
1359  for (int d=0; d<nDet; d++) {
1360  dets[i] -> beginFrame();
1361  }
1362 
1364  printMessage(tr("Skipping %1 of %2").arg(i+1).arg(skipBefore));
1365  }
1366 
1367  for (int d=0; d<nDet; d++) {
1368  dets[i] -> acquireFrame();
1369  }
1370  }
1371 
1372  for (int i=0; i<nsummed;) {
1373  if (cancelling()) goto cancel;
1374 
1375  set_CurrentSummation(i);
1376 
1377  for (int d=0; d<nDet; d++) {
1378  dets[d] -> beginFrame();
1379  }
1380 
1381  for (int d=0; d<nDet; d++) {
1382  emit acquiredFrame(res[d]->get_FileBase(), 0, 1, i, nsummed, 0, 1);
1383 
1384  QcepImageDataBasePtr img =
1385  dets[d] -> acquireFrame();
1386 
1387  if (img) {
1388  accumulateAcquiredImage(img, res[d], overflow[d]);
1389  } else {
1390  if (!cancelling()){
1392  } else {
1393  goto cancel;
1394  }
1395  }
1396  }
1397 
1398  if (get_RetryDropped()) {
1399  int minSum = nsummed+10;
1400 
1401  for (int d=0; d<nDet; d++) {
1402  if (res[d]) {
1403  int ns = res[d]->get_SummedExposures();
1404 
1405  if (ns < minSum) {
1406  minSum = ns;
1407  }
1408  } else {
1409  minSum = 0;
1410  }
1411  }
1412 
1413  i = minSum;
1414  } else{
1415  i = i+1;
1416  }
1417  }
1418 
1419  //saveCancel:
1420 
1421  for (int d=0; d<nDet; d++) {
1422  procs[d]->processDarkImage(res[d], overflow[d], fileIndex);
1423  }
1424 
1425  statusMessage(tr("Acquisition complete"));
1426  printMessage(tr("Acquisition complete"));
1427 
1428 cancel:
1429  if (synchronizedAcquisition()) {
1430  synchronizedAcquisition()->finishedAcquisition();
1431  }
1432 
1433  startIdling();
1434  }
1435 
1436  m_Acquiring.unlock();
1437 
1438  emit acquireComplete();
1439 }
void indicateDroppedFrame(int n)
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void getFileBaseAndName(QString filePattern, QString extent, int detNum, int fileIndex, int phase, int nphases, QString &fileBase, QString &fileName)
void acquiredFrame(QString fileName, int iphase, int nphases, int isum, int nsum, int igroup, int ngroup)
void statusMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
virtual void stopIdling()
QxrdDetectorPtr detector(int n)
virtual void startIdling()
QxrdSynchronizedAcquisitionPtr synchronizedAcquisition() const
void accumulateAcquiredImage(QcepInt16ImageDataPtr image, QcepInt32ImageDataPtr accum, QcepMaskDataPtr overflow)
QxrdDarkAcquisitionParameterPackPtr darkAcquisitionParameterPack()
QSharedPointer< QxrdDarkAcquisitionParameterPack > QxrdDarkAcquisitionParameterPackPtr
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QcepInt32ImageData > QcepInt32ImageDataPtr
void criticalMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QxrdDetector > QxrdDetectorPtr
static QcepMaskDataPtr newMask(AllocationStrategy strat, int width, int height, int def, QcepObject *parent)
QSharedPointer< QcepImageDataBase > QcepImageDataBasePtr
QSharedPointer< QcepMaskData > QcepMaskDataPtr
static QcepInt32ImageDataPtr newInt32Image(AllocationStrategy strat, int width, int height, QcepObject *parent)

Here is the call graph for this function:

void QxrdAcquisition::dynamicProperties ( )
slot

Definition at line 192 of file qxrdacquisition.cpp.

References g_Application, QcepObject::name, and QcepApplication::printMessage().

193 {
194  QByteArray name;
195 
196  if (g_Application) {
197  foreach(name, dynamicPropertyNames()) {
198  g_Application->printMessage(tr("acquisition.%1\n").arg(name.data()));
199  }
200  }
201 }
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
QcepApplication * g_Application
QString name
Definition: qcepobject.h:49

Here is the call graph for this function:

QxrdExperimentWPtr QxrdAcquisition::experiment ( )
protected

Definition at line 149 of file qxrdacquisition.cpp.

References m_Experiment.

Referenced by appendDetector(), appendDetectorProxy(), and readSettings().

150 {
151  return m_Experiment;
152 }
QxrdExperimentWPtr m_Experiment

Here is the caller graph for this function:

void QxrdAcquisition::extraInputsChanged ( )
signal

Referenced by initialize(), and QxrdAcquisitionScalerModel::QxrdAcquisitionScalerModel().

Here is the caller graph for this function:

void QxrdAcquisition::getFileBaseAndName ( QString  filePattern,
QString  extent,
int  detNum,
int  fileIndex,
int  phase,
int  nphases,
QString &  fileBase,
QString &  fileName 
)
protected

Definition at line 715 of file qxrdacquisition.cpp.

References detector().

Referenced by currentFileBase(), doAcquire(), doAcquireDark(), and processImage().

716 {
717  int width = get_FileIndexWidth();
718  int detWidth = get_DetectorNumberWidth();
719  QxrdDetectorPtr det(detector(detNum));
720 
721  if (det) {
722  QxrdDetectorProcessorPtr proc(det->processor());
723  int nDet = get_DetectorCount();
724 
725  if (proc) {
726  if (nphases == 0 || phase < 0) {
727  if (nDet <= 1) {
728  fileBase = tr("%1-%2.dark.%3")
729  .arg(filePattern).arg(fileIndex,width,10,QChar('0')).arg(extent);
730  } else {
731  fileBase = tr("%1-%2-%3.dark.%4")
732  .arg(filePattern).arg(detNum,detWidth,10,QChar('0')).arg(fileIndex,width,10,QChar('0')).arg(extent);
733  }
734 
735  fileName = proc -> filePathInDarkOutputDirectory(fileBase);
736  } else {
737  if (nphases > 1) {
738  int phswidth = get_FilePhaseWidth();
739  if (nDet <= 1) {
740  fileBase = tr("%1-%2-%3.%4")
741  .arg(filePattern).arg(fileIndex,width,10,QChar('0')).arg(phase,phswidth,10,QChar('0')).arg(extent);
742  } else {
743  fileBase = tr("%1-%2-%3-%4.%5")
744  .arg(filePattern).arg(detNum,detWidth,10,QChar('0')).arg(fileIndex,width,10,QChar('0'))
745  .arg(phase,phswidth,10,QChar('0')).arg(extent);
746  }
747  } else {
748  if (nDet <= 1) {
749  fileBase = tr("%1-%2.%3")
750  .arg(filePattern).arg(fileIndex,width,10,QChar('0')).arg(extent);
751  } else {
752  fileBase = tr("%1-%2-%3.%4")
753  .arg(filePattern).arg(detNum,detWidth,10,QChar('0')).arg(fileIndex,width,10,QChar('0')).arg(extent);
754  }
755  }
756  fileName = proc -> filePathInRawOutputDirectory(fileBase);
757  }
758  }
759  }
760 }
QxrdDetectorPtr detector(int n)
QSharedPointer< QxrdDetectorProcessor > QxrdDetectorProcessorPtr
QSharedPointer< QxrdDetector > QxrdDetectorPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdAcquisition::indicateDroppedFrame ( int  n)

Definition at line 542 of file qxrdacquisition.cpp.

References m_Allocator, printMessage(), and statusMessage().

Referenced by doAcquire(), and doAcquireDark().

543 {
545 
546  if (alloc) {
547  QString msg = tr("Frame %1 dropped [%2/%3 MB Used]")
548  .arg(n)
549  .arg(alloc->allocatedMemoryMB())
550  .arg(alloc->maximumMemoryMB());
551 
552  statusMessage(msg);
553  printMessage(msg);
554 
555  prop_DroppedFrames() -> incValue(1);
556  }
557 }
void statusMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QcepAllocator > QcepAllocatorPtr
QcepAllocatorWPtr m_Allocator

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdAcquisition::initialize ( )
virtual

Reimplemented from QxrdAcquisitionInterface.

Definition at line 81 of file qxrdacquisition.cpp.

References QxrdAcquisitionExtraInputs::channelCountChanged(), DEBUG_APP, extraInputsChanged(), QxrdAcquisitionInterface::initialize(), m_AcquisitionExtraInputs, m_Allocator, m_Experiment, m_IdleTimer, QxrdAcquisitionInterface::m_Saver, m_ScalerModel, m_SynchronizedAcquisition, myself(), onBufferSizeChanged(), onExposureTimeChanged(), onIdleTimeout(), printMessage(), qcepDebug(), updateSaveTimes(), QcepDoubleProperty::valueChanged(), and QcepIntProperty::valueChanged().

82 {
84 
85  connect(prop_Raw16SaveTime(), &QcepDoubleProperty::valueChanged, this, &QxrdAcquisition::updateSaveTimes);
86  connect(prop_Raw32SaveTime(), &QcepDoubleProperty::valueChanged, this, &QxrdAcquisition::updateSaveTimes);
87  connect(prop_SummedExposures(), &QcepIntProperty::valueChanged, this, &QxrdAcquisition::updateSaveTimes);
88  connect(prop_DarkSummedExposures(), &QcepIntProperty::valueChanged, this, &QxrdAcquisition::updateSaveTimes);
89 
90 // m_FileIndex.setDebug(1);
91 
93 
94  if (qcepDebug(DEBUG_APP)) {
95  printMessage("QxrdAcquisition::QxrdAcquisition");
96  }
97 
100 
104 
107 
108  connect(prop_ExposureTime(), &QcepDoubleProperty::valueChanged,
110 
111  if (alloc) {
112  if (sizeof(void*) == 4) {
113  connect(alloc->prop_TotalBufferSizeMB32(), &QcepIntProperty::valueChanged,
115  onBufferSizeChanged(alloc->get_TotalBufferSizeMB32());
116  } else {
117  connect(alloc->prop_TotalBufferSizeMB64(), &QcepIntProperty::valueChanged,
119  onBufferSizeChanged(alloc->get_TotalBufferSizeMB64());
120  }
121  }
122 
123 // connect(&m_Watcher, &QFutureWatcherBase::finished, this, &QxrdAcquisition::onAcquireComplete);
124  connect(&m_IdleTimer, &QTimer::timeout, this, &QxrdAcquisition::onIdleTimeout);
125 
126  m_IdleTimer.start(1000);
127 
128  QxrdAcquisitionPtr myself = qSharedPointerDynamicCast<QxrdAcquisition>(sharedFromThis());
129 
131  new QxrdAcquisitionScalerModel(myself));
132 }
QxrdSynchronizedAcquisitionPtr m_SynchronizedAcquisition
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionScalerModelPtr m_ScalerModel
QSharedPointer< QxrdAcquisitionScalerModel > QxrdAcquisitionScalerModelPtr
QSharedPointer< QxrdSynchronizedAcquisition > QxrdSynchronizedAcquisitionPtr
QSharedPointer< QxrdAcquisitionExtraInputs > QxrdAcquisitionExtraInputsPtr
void extraInputsChanged()
QxrdAcquisitionPtr myself()
QxrdExperimentWPtr m_Experiment
virtual void onExposureTimeChanged()
void onBufferSizeChanged(int newMB)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QcepAllocator > QcepAllocatorPtr
void valueChanged(double val, int index)
QcepAllocatorWPtr m_Allocator
void valueChanged(int val, int index)
QxrdAcquisitionExtraInputsPtr m_AcquisitionExtraInputs

Here is the call graph for this function:

void QxrdAcquisition::Message ( QString  cmd)
slot

Definition at line 1475 of file qxrdacquisition.cpp.

References m_Experiment.

1476 {
1478 
1479  if (expt) {
1480  expt->statusMessage(msg);
1481  }
1482 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
QxrdAcquisitionPtr QxrdAcquisition::myself ( )
protected

Definition at line 70 of file qxrdacquisition.cpp.

Referenced by appendDetector(), appendDetectorProxy(), configureDetector(), controlPanel(), initialize(), and readSettings().

71 {
72  QxrdAcquisitionPtr me = qSharedPointerCast<QxrdAcquisition>(sharedFromThis());
73 
74 // if (me == NULL) {
75 // printf("QxrdAcquisition::myself returns NULL\n");
76 // }
77 
78  return me;
79 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr

Here is the caller graph for this function:

QxrdNIDAQPluginInterfacePtr QxrdAcquisition::nidaqPlugin ( ) const

Definition at line 897 of file qxrdacquisition.cpp.

References m_SynchronizedAcquisition.

898 {
901  } else {
903  }
904 }
QxrdSynchronizedAcquisitionPtr m_SynchronizedAcquisition
QSharedPointer< QxrdNIDAQPluginInterface > QxrdNIDAQPluginInterfacePtr
QxrdNIDAQPluginInterfacePtr nidaqPlugin() const
void QxrdAcquisition::onBufferSizeChanged ( int  newMB)
slot

Definition at line 424 of file qxrdacquisition.cpp.

References m_Allocator.

Referenced by initialize().

425 {
427 
428  if (alloc) {
429  alloc -> changedSizeMB(newMB);
430  }
431 }
QSharedPointer< QcepAllocator > QcepAllocatorPtr
QcepAllocatorWPtr m_Allocator

Here is the caller graph for this function:

void QxrdAcquisition::onExposureTimeChanged ( )
virtualslot

Definition at line 508 of file qxrdacquisition.cpp.

References m_Detectors.

Referenced by initialize().

509 {
510  foreach (QxrdDetectorPtr det, m_Detectors) {
511  det->onExposureTimeChanged();
512  }
513 }
QVector< QxrdDetectorPtr > m_Detectors
QSharedPointer< QxrdDetector > QxrdDetectorPtr

Here is the caller graph for this function:

void QxrdAcquisition::onIdleTimeout ( )
protectedslot

Definition at line 1456 of file qxrdacquisition.cpp.

References detector(), and m_Idling.

Referenced by initialize().

1457 {
1458  if (m_Idling.fetchAndAddOrdered(0)) {
1459  for (int i=0; i<get_DetectorCount(); i++) {
1460  QxrdDetectorPtr det = detector(i);
1461 
1462  if (det && det->isEnabled()) {
1463  QcepImageDataBasePtr res = det -> acquireFrameIfAvailable();
1464 
1465  QxrdDetectorProcessorPtr proc = det->processor();
1466 
1467  if (proc) {
1468  proc->processIdleImage(res);
1469  }
1470  }
1471  }
1472  }
1473 }
QxrdDetectorPtr detector(int n)
QSharedPointer< QxrdDetectorProcessor > QxrdDetectorProcessorPtr
QAtomicInt m_Idling
QSharedPointer< QxrdDetector > QxrdDetectorPtr
QSharedPointer< QcepImageDataBase > QcepImageDataBasePtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdAcquisition::openDetectorControlWindow ( int  i)
slot

Definition at line 528 of file qxrdacquisition.cpp.

References detector().

Referenced by QxrdWindow::populateDetectorControlWindowsMenu().

529 {
530  QxrdDetectorPtr det = detector(i);
531 
532  if (det) {
533  det->openControlWindow();
534  }
535 }
QxrdDetectorPtr detector(int n)
QSharedPointer< QxrdDetector > QxrdDetectorPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdAcquisition::printMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
slot

Definition at line 397 of file qxrdacquisition.cpp.

References m_Experiment.

Referenced by accumulateAcquiredImage(), cancelling(), configureDetector(), doAcquire(), doAcquireDark(), indicateDroppedFrame(), initialize(), processAcquiredImage(), processImage(), shutdown(), and ~QxrdAcquisition().

398 {
400 
401  if (exp) {
402  exp->printMessage(msg, ts);
403  }
404 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment

Here is the caller graph for this function:

void QxrdAcquisition::processAcquiredImage ( QString  filePattern,
QString  extent,
int  fileIndex,
int  phase,
int  nPhases,
bool  trig,
QcepInt32ImageDataPtr  image,
QcepMaskDataPtr  overflow 
)
private

Definition at line 848 of file qxrdacquisition.cpp.

References DEBUG_ACQUIRETIME, printMessage(), processImage(), and qcepDebug().

Referenced by doAcquire().

849 {
850  // printf("processAcquiredImage(""%s"",%d,%d,img,ovf)\n", qPrintable(filePattern), fileIndex, phase);
851 
852  // processImage(filePattern, fileIndex, phase, nPhases, trig, image, overflow);
853 
855  printMessage(tr("QxrdAcquisition::processAcquiredImage %1 %2 %3 (%4)").arg(filePattern).arg(fileIndex).arg(phase).arg((image?image->get_ImageNumber():-1)));
856  }
857 
858  QtConcurrent::run(this, &QxrdAcquisition::processImage,
859  QxrdProcessArgs(filePattern, extent, fileIndex, phase, nPhases, trig, image, overflow));
860 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void processImage(const QxrdProcessArgs &args)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdAcquisition::processDarkImage ( QString  filePattern,
QString  extent,
int  fileIndex,
QcepInt32ImageDataPtr  image,
QcepMaskDataPtr  overflow 
)
private

Definition at line 862 of file qxrdacquisition.cpp.

References processImage().

863 {
864  // printf("processDarkImage(""%s"",%d,img,ovf)\n", qPrintable(filePattern), fileIndex);
865 
866  processImage(filePattern, extent, fileIndex, -1, 0, true, image, overflow);
867 }
void processImage(const QxrdProcessArgs &args)

Here is the call graph for this function:

void QxrdAcquisition::processImage ( const QxrdProcessArgs args)
private

Definition at line 833 of file qxrdacquisition.cpp.

References DEBUG_ACQUIRETIME, QxrdProcessArgs::m_Extension, QxrdProcessArgs::m_FileIndex, QxrdProcessArgs::m_FilePattern, QxrdProcessArgs::m_Image, QxrdProcessArgs::m_NPhases, QxrdProcessArgs::m_Overflow, QxrdProcessArgs::m_Phase, QxrdProcessArgs::m_Trig, printMessage(), and qcepDebug().

Referenced by processAcquiredImage(), and processDarkImage().

834 {
835 // QThread::currentThread()->setObjectName("processImage");
836 
838  printMessage(tr("QxrdAcquisition::processImage %1 %2 start").arg(args.m_FilePattern).arg(args.m_FileIndex));
839  }
840 
841  processImage(args.m_FilePattern, args.m_Extension, args.m_FileIndex, args.m_Phase, args.m_NPhases, args.m_Trig, args.m_Image, args.m_Overflow);
842 
844  printMessage(tr("QxrdAcquisition::processImage %1 %2 end").arg(args.m_FilePattern).arg(args.m_FileIndex));
845  }
846 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepInt32ImageDataPtr m_Image
void processImage(const QxrdProcessArgs &args)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QcepMaskDataPtr m_Overflow

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdAcquisition::processImage ( QString  filePattern,
QString  extent,
int  fileIndex,
int  phase,
int  nPhases,
bool  trig,
QcepInt32ImageDataPtr  image,
QcepMaskDataPtr  overflow 
)
private

Definition at line 762 of file qxrdacquisition.cpp.

References copyDynamicProperties(), DEBUG_ACQUIRE, DEBUG_ACQUIRETIME, fileBase, getFileBaseAndName(), m_DataProcessor, printMessage(), qcepDebug(), QcepImageDataBase::Raw32Data, and QcepImageDataBase::secondsSinceEpoch().

763 {
764  if (image) {
766  printMessage(tr("processAcquiredImage(%1,%2) %3 summed exposures")
767  .arg(fileIndex).arg(phase).arg(image->get_SummedExposures()));
768  }
769 
770  QString fileName;
771  QString fileBase;
772 
773  getFileBaseAndName(filePattern, extent, 0, fileIndex, phase, nPhases, fileBase, fileName);
774 
776  printMessage(tr("Fn: %1, Fi: %2, Phs: %3")
777  .arg(fileName).arg(fileIndex).arg(phase));
778  }
779 
780  set_FileBase(fileBase);
781  // m_DataProcessor -> set_FileName(fileName);
782 
783  QFileInfo finfo(fileName);
784 
785  QDateTime now = QDateTime::currentDateTime();
786  double msec = QcepImageDataBase::secondsSinceEpoch();
787 
788  image -> set_FileBase(fileBase);
789  image -> set_FileName(fileName);
790  image -> set_Title(finfo.fileName());
791  image -> set_ExposureTime(get_ExposureTime());
792  image -> set_DateTime(now);
793  image -> set_TimeStamp(msec);
794  image -> set_HBinning(1);
795  image -> set_VBinning(1);
796  image -> set_DataType(QcepInt32ImageData::Raw32Data);
797  image -> set_UserComment1(get_UserComment1());
798  image -> set_UserComment2(get_UserComment2());
799  image -> set_UserComment3(get_UserComment3());
800  image -> set_UserComment4(get_UserComment4());
801  image -> set_ObjectSaved(false);
802  image -> set_Triggered(trig);
803  image -> set_Normalization(get_Normalization());
804 
805  copyDynamicProperties(image.data());
806 
807  if (nPhases == 0) {
809  printMessage(tr("32 bit Dark Image acquired"));
810  }
811 
812  image -> set_ImageNumber(-1);
813  image -> set_PhaseNumber(-1);
814  image -> set_NPhases(0);
815  } else {
817  printMessage(tr("32 bit Image %1 acquired").arg(fileIndex));
818  }
819 
820  image -> set_ImageNumber(fileIndex);
821  image -> set_PhaseNumber(phase);
822  image -> set_NPhases(nPhases);
823  }
824 
826 
827  if (processor) {
828  processor -> acquiredInt32Image(image, overflow);
829  }
830  }
831 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdDataProcessorWPtr m_DataProcessor
void getFileBaseAndName(QString filePattern, QString extent, int detNum, int fileIndex, int phase, int nphases, QString &fileBase, QString &fileName)
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
void copyDynamicProperties(QObject *dest)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
static double secondsSinceEpoch()

Here is the call graph for this function:

void QxrdAcquisition::propertyList ( )
slot

Definition at line 1484 of file qxrdacquisition.cpp.

References g_Application, m_Mutex, QcepObject::name, and QcepApplication::printMessage().

1485 {
1486  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
1487 
1488  const QMetaObject *meta = metaObject();
1489 
1490  int count = meta->propertyCount();
1491  int offset = 1; /*meta->propertyOffset();*/
1492 
1493  for (int i=offset; i<count; i++) {
1494  QMetaProperty metaproperty = meta->property(i);
1495 
1496  const char *name = metaproperty.name();
1497  QVariant value = property(name);
1498 
1499  if (g_Application) {
1500  g_Application->printMessage(tr("Property %1: %2 = %3").arg(i).arg(name).arg(value.toString()));
1501  }
1502  }
1503 
1504  QList<QByteArray> dynProps = dynamicPropertyNames();
1505 
1506  foreach(QByteArray name, dynProps) {
1507  g_Application->printMessage(tr("Dynamic Property %1 = %2").arg(QString(name)).arg(property(name).toString()));
1508  }
1509 }
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
QcepApplication * g_Application
QString name
Definition: qcepobject.h:49

Here is the call graph for this function:

void QxrdAcquisition::readSettings ( QSettings *  settings,
QString  section 
)
virtual

Reimplemented from QcepObject.

Definition at line 243 of file qxrdacquisition.cpp.

References experiment(), g_Application, m_AcquisitionExtraInputs, m_Detectors, m_DetectorThreads, m_Mutex, QxrdAcquisitionInterface::m_Saver, m_SynchronizedAcquisition, myself(), and QcepObject::readSettings().

244 {
245  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
246 
247  QcepObject::readSettings(settings, section);
248 
250  m_SynchronizedAcquisition->readSettings(settings, section+"/sync");
251  }
252 
254  m_AcquisitionExtraInputs->readSettings(settings, section+"/extrainputs");
255  }
256 
257  int n = settings->beginReadArray(section+"/detectors");
258 
259  m_DetectorThreads.resize(n);
260  m_Detectors.resize(n);
261 
262  for (int i=0; i<n; i++) {
263  settings->setArrayIndex(i);
264 
265  int detType = settings->value("detectorType", 0).toInt();
266 
267  QxrdDetectorThreadPtr detThread =
269  experiment(),
270  myself(),
271  detType,
272  i,
273  this));
274 
275  if (detThread) {
276  detThread->start();
277 
278  QxrdDetectorPtr det = detThread->detector();
279 
280  if (det) {
281  // det->initialize();
282  det->readSettings(settings, "");
283 
284  m_DetectorThreads[i] = detThread;
285  m_Detectors[i] = det;
286 
287  QxrdApplication *app = qobject_cast<QxrdApplication*>(g_Application);
288 
289  if (app && app->get_StartDetectors() == 0) {
290  det->set_Enabled(false);
291  }
292 
293  det->startOrStop(det->isEnabled());
294  }
295  }
296  }
297 
298  set_DetectorCount(m_Detectors.count());
299 
300  settings->endArray();
301 }
QVector< QxrdDetectorPtr > m_Detectors
QxrdSynchronizedAcquisitionPtr m_SynchronizedAcquisition
QxrdExperimentWPtr experiment()
virtual void readSettings(QSettings *set, QString section)
Definition: qcepobject.cpp:119
QxrdAcquisitionPtr myself()
QVector< QxrdDetectorThreadPtr > m_DetectorThreads
QcepApplication * g_Application
QSharedPointer< QxrdDetectorThread > QxrdDetectorThreadPtr
QSharedPointer< QxrdDetector > QxrdDetectorPtr
QxrdAcquisitionExtraInputsPtr m_AcquisitionExtraInputs

Here is the call graph for this function:

bool QxrdAcquisition::sanityCheckAcquire ( )
slot

Definition at line 468 of file qxrdacquisition.cpp.

References criticalMessage(), and sanityCheckCommon().

469 {
470  bool res = false;
471 
472  if (sanityCheckCommon() == false) {
473  } else if (get_PreTriggerFiles() < 0) {
474  criticalMessage("pretrigger files cannot be < 0");
475  } else if (get_PostTriggerFiles() < 0) {
476  criticalMessage("posttrigger files cannot be < 0");
477  } else if (get_PreTriggerFiles() + get_PostTriggerFiles() <= 0) {
478  criticalMessage("pre+post trigger files must be >= 1");
479  } else if (get_SummedExposures() <= 0) {
480  criticalMessage("Summed exposures must be >= 1");
481  } else if (get_SkippedExposures() < 0) {
482  criticalMessage("Skipped exposures must be >= 0");
483  } else if (get_ExposureTime() <= 0) {
484  criticalMessage("Exposure time must be > 0");
485  } else {
486  res = true;
487  }
488 
489  return res;
490 }
void criticalMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

bool QxrdAcquisition::sanityCheckAcquireDark ( )
slot

Definition at line 492 of file qxrdacquisition.cpp.

References criticalMessage(), and sanityCheckCommon().

493 {
494  bool res = false;
495 
496  if (sanityCheckCommon() == false) {
497  } else if (get_DarkSummedExposures() <= 0) {
498  criticalMessage("Dark summed exposures must be >= 0");
499  } else if (get_ExposureTime() <= 0) {
500  criticalMessage("Exposure time must be > 0");
501  } else {
502  res = true;
503  }
504 
505  return res;
506 }
void criticalMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

bool QxrdAcquisition::sanityCheckCommon ( )
slot

Definition at line 438 of file qxrdacquisition.cpp.

References criticalMessage(), and detector().

Referenced by sanityCheckAcquire(), and sanityCheckAcquireDark().

439 {
440  if (get_DetectorCount() == 0) {
441  criticalMessage("No Detectors are configured");
442  return false;
443  }
444 
445  int ndet = 0;
446 
447  for (int i=0; i<get_DetectorCount(); i++) {
448  QxrdDetectorPtr det = detector(i);
449 
450  if (det && det->isEnabled()) {
451  ndet++;
452  }
453  }
454 
455  if (ndet == 0) {
456  criticalMessage("No detectors are enabled");
457  return false;
458  }
459 
460  if (get_FilePattern() == "") {
461  criticalMessage("No save file name has been provided");
462  return false;
463  }
464 
465  return true;
466 }
QxrdDetectorPtr detector(int n)
void criticalMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QxrdDetector > QxrdDetectorPtr

Here is the call graph for this function:

Here is the caller graph for this function:

double QxrdAcquisition::scalerValue ( int  i)
slot

Definition at line 1515 of file qxrdacquisition.cpp.

1516 {
1517  return get_ScalerValues().value(i);
1518 }
void QxrdAcquisition::setNIDAQPlugin ( QxrdNIDAQPluginInterfacePtr  nidaqPlugin)

Definition at line 886 of file qxrdacquisition.cpp.

References m_AcquisitionExtraInputs, and m_SynchronizedAcquisition.

887 {
890  }
891 
894  }
895 }
QxrdSynchronizedAcquisitionPtr m_SynchronizedAcquisition
void setNIDAQPlugin(QxrdNIDAQPluginInterfacePtr nidaqPlugin)
QxrdAcquisitionExtraInputsPtr m_AcquisitionExtraInputs
QxrdNIDAQPluginInterfacePtr nidaqPlugin() const
void QxrdAcquisition::setupExposureMenu ( QDoubleSpinBox *  cb)
virtual

Definition at line 1511 of file qxrdacquisition.cpp.

1512 {
1513 }
void QxrdAcquisition::setWindow ( QxrdWindowWPtr  win)

Definition at line 392 of file qxrdacquisition.cpp.

References m_Window.

393 {
394  m_Window = win;
395 }
QxrdWindowWPtr m_Window
void QxrdAcquisition::shutdown ( )
slot

Definition at line 164 of file qxrdacquisition.cpp.

References DEBUG_APP, detector(), printMessage(), and qcepDebug().

165 {
166  if (qcepDebug(DEBUG_APP)) {
167  printMessage("QxrdAcquisition::shutdown()");
168  }
169 
170  for (int i=0; i<get_DetectorCount(); i++) {
171  detector(i) -> shutdownAcquisition();
172  }
173 
174  thread()->exit();
175 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdDetectorPtr detector(int n)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

void QxrdAcquisition::startIdling ( )
privatevirtual

Definition at line 1451 of file qxrdacquisition.cpp.

References m_Idling.

Referenced by doAcquire(), and doAcquireDark().

1452 {
1453  m_Idling.fetchAndStoreOrdered(1);
1454 }
QAtomicInt m_Idling

Here is the caller graph for this function:

void QxrdAcquisition::statusMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
slot

Definition at line 415 of file qxrdacquisition.cpp.

References m_Experiment.

Referenced by cancelling(), doAcquire(), doAcquireDark(), and indicateDroppedFrame().

416 {
418 
419  if (exp) {
420  exp->statusMessage(msg, ts);
421  }
422 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment

Here is the caller graph for this function:

void QxrdAcquisition::stopIdling ( )
privatevirtual

Definition at line 1441 of file qxrdacquisition.cpp.

References m_Idling.

Referenced by doAcquire(), and doAcquireDark().

1442 {
1443  m_Idling.fetchAndStoreOrdered(0);
1444 // flushImageQueue();
1445 
1446  if (get_AcquisitionCancelsLiveView()) {
1447  set_LiveViewAtIdle(false);
1448  }
1449 }
QAtomicInt m_Idling

Here is the caller graph for this function:

QxrdSynchronizedAcquisitionPtr QxrdAcquisition::synchronizedAcquisition ( ) const

Definition at line 906 of file qxrdacquisition.cpp.

References m_SynchronizedAcquisition.

Referenced by doAcquire(), and doAcquireDark().

907 {
909 }
QxrdSynchronizedAcquisitionPtr m_SynchronizedAcquisition

Here is the caller graph for this function:

void QxrdAcquisition::updateSaveTimes ( )
slot

Definition at line 177 of file qxrdacquisition.cpp.

Referenced by initialize().

178 {
179  if (get_SummedExposures() <= 1) {
180  set_RawSaveTime(get_Raw16SaveTime());
181  } else {
182  set_RawSaveTime(get_Raw32SaveTime());
183  }
184 
185  if (get_DarkSummedExposures() <= 1) {
186  set_DarkSaveTime(get_Raw16SaveTime());
187  } else {
188  set_DarkSaveTime(get_Raw32SaveTime());
189  }
190 }

Here is the caller graph for this function:

void QxrdAcquisition::writeSettings ( QSettings *  settings,
QString  section 
)
virtual

Reimplemented from QcepObject.

Definition at line 214 of file qxrdacquisition.cpp.

References m_AcquisitionExtraInputs, m_Detectors, m_Mutex, m_SynchronizedAcquisition, and QcepObject::writeSettings().

215 {
216  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
217 
218  QcepObject::writeSettings(settings, section);
219 
221  m_SynchronizedAcquisition->writeSettings(settings, section+"/sync");
222  }
223 
225  m_AcquisitionExtraInputs->writeSettings(settings, section+"/extrainputs");
226  }
227 
228  settings->beginWriteArray(section+"/detectors");
229 
230  for (int i=0; i<m_Detectors.count(); i++) {
231  settings->setArrayIndex(i);
232 
233  QxrdDetectorPtr det = m_Detectors.value(i);
234 
235  if (det) {
236  det->writeSettings(settings, "");
237  }
238  }
239 
240  settings->endArray();
241 }
QVector< QxrdDetectorPtr > m_Detectors
QxrdSynchronizedAcquisitionPtr m_SynchronizedAcquisition
virtual void writeSettings(QSettings *set, QString section)
Definition: qcepobject.cpp:114
QSharedPointer< QxrdDetector > QxrdDetectorPtr
QxrdAcquisitionExtraInputsPtr m_AcquisitionExtraInputs

Here is the call graph for this function:

Member Data Documentation

QxrdAcquisitionExtraInputsPtr QxrdAcquisition::m_AcquisitionExtraInputs
private
QcepAllocatorWPtr QxrdAcquisition::m_Allocator
private
QxrdAcquisitionDialogPtr QxrdAcquisition::m_ControlPanel
private

Definition at line 231 of file qxrdacquisition.h.

Referenced by controlPanel().

QxrdDataProcessorWPtr QxrdAcquisition::m_DataProcessor
private

Definition at line 229 of file qxrdacquisition.h.

Referenced by controlPanel(), dataProcessor(), and processImage().

QVector<QxrdDetectorPtr> QxrdAcquisition::m_Detectors
private
QVector<QxrdDetectorThreadPtr> QxrdAcquisition::m_DetectorThreads
private
QxrdExperimentWPtr QxrdAcquisition::m_Experiment
private
QTimer QxrdAcquisition::m_IdleTimer
private

Definition at line 233 of file qxrdacquisition.h.

Referenced by initialize().

QAtomicInt QxrdAcquisition::m_Idling
private

Definition at line 234 of file qxrdacquisition.h.

Referenced by onIdleTimeout(), startIdling(), and stopIdling().

QMutex QxrdAcquisition::m_Mutex
mutableprivate

Definition at line 221 of file qxrdacquisition.h.

Referenced by propertyList(), readSettings(), and writeSettings().

QxrdAcquisitionScalerModelPtr QxrdAcquisition::m_ScalerModel
private

Definition at line 239 of file qxrdacquisition.h.

Referenced by acquisitionScalerModel(), and initialize().

QxrdSynchronizedAcquisitionPtr QxrdAcquisition::m_SynchronizedAcquisition
private
QxrdWindowWPtr QxrdAcquisition::m_Window
private

Definition at line 227 of file qxrdacquisition.h.

Referenced by controlPanel(), and setWindow().

Property Documentation

bool QxrdAcquisition::acquisitionCancelsLiveView
readwrite

Definition at line 211 of file qxrdacquisition.h.

double QxrdAcquisition::darkSaveTime
readwrite

Definition at line 187 of file qxrdacquisition.h.

int QxrdAcquisition::detectorCount
readwrite

Definition at line 151 of file qxrdacquisition.h.

int QxrdAcquisition::detectorNumberWidth
readwrite

Definition at line 169 of file qxrdacquisition.h.

int QxrdAcquisition::droppedFrames
readwrite

Definition at line 205 of file qxrdacquisition.h.

QString QxrdAcquisition::fileBase
readwrite

Definition at line 172 of file qxrdacquisition.h.

Referenced by currentFileBase(), doAcquire(), doAcquireDark(), and processImage().

int QxrdAcquisition::fileIndex
readwrite

Definition at line 157 of file qxrdacquisition.h.

Referenced by doAcquire(), and doAcquireDark().

int QxrdAcquisition::fileIndexWidth
readwrite

Definition at line 160 of file qxrdacquisition.h.

int QxrdAcquisition::fileOverflowWidth
readwrite

Definition at line 166 of file qxrdacquisition.h.

int QxrdAcquisition::filePhaseWidth
readwrite

Definition at line 163 of file qxrdacquisition.h.

int QxrdAcquisition::lastAcquired
readwrite

Definition at line 154 of file qxrdacquisition.h.

bool QxrdAcquisition::liveViewAtIdle
readwrite

Definition at line 208 of file qxrdacquisition.h.

QcepDoubleList QxrdAcquisition::normalization
readwrite

Definition at line 202 of file qxrdacquisition.h.

int QxrdAcquisition::overflowLevel
readwrite

Definition at line 175 of file qxrdacquisition.h.

QString QxrdAcquisition::qtVersion
read

Definition at line 148 of file qxrdacquisition.h.

QString QxrdAcquisition::qxrdVersion
read

Definition at line 145 of file qxrdacquisition.h.

double QxrdAcquisition::raw16SaveTime
readwrite

Definition at line 178 of file qxrdacquisition.h.

double QxrdAcquisition::raw32SaveTime
readwrite

Definition at line 181 of file qxrdacquisition.h.

double QxrdAcquisition::rawSaveTime
readwrite

Definition at line 184 of file qxrdacquisition.h.

bool QxrdAcquisition::retryDropped
readwrite

Definition at line 214 of file qxrdacquisition.h.

QcepDoubleVector QxrdAcquisition::scalerValues
readwrite

Definition at line 217 of file qxrdacquisition.h.

QString QxrdAcquisition::userComment1
readwrite

Definition at line 190 of file qxrdacquisition.h.

QString QxrdAcquisition::userComment2
readwrite

Definition at line 193 of file qxrdacquisition.h.

QString QxrdAcquisition::userComment3
readwrite

Definition at line 196 of file qxrdacquisition.h.

QString QxrdAcquisition::userComment4
readwrite

Definition at line 199 of file qxrdacquisition.h.


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