18 printf(
"QxrdDetectorSimulated::QxrdDetectorSimulated(%p)\n",
this);
27 printf(
"Deleting simulated detector\n");
31 printf(
"QxrdDetectorSimulated::~QxrdDetectorSimulated(%p)\n",
this);
58 if (QThread::currentThread() != thread()) {
59 QMetaObject::invokeMethod(
this,
"onExposureTimeChanged");
65 double newTime = acq->get_ExposureTime();
67 expt->printMessage(tr(
"Exposure time changed to %1").arg(newTime));
90 if (QThread::currentThread() != thread()) {
91 QMetaObject::invokeMethod(
this,
"startDetector", Qt::BlockingQueuedConnection);
98 printMessage(tr(
"Starting simulated detector \"%1\"").arg(get_DetectorName()));
103 if (acq->get_ExposureTime() <= 0) {
104 acq->set_ExposureTime(0.1);
114 if (QThread::currentThread() != thread()) {
115 QMetaObject::invokeMethod(
this,
"startDetector", Qt::BlockingQueuedConnection);
117 printMessage(tr(
"Stopping simulated detector \"%1\"").arg(get_DetectorName()));
129 if (QThread::currentThread() != thread()) {
130 QMetaObject::invokeMethod(
this,
"beginAcquisition", Qt::BlockingQueuedConnection, Q_ARG(
double, exposure));
140 if (QThread::currentThread() != thread()) {
141 QMetaObject::invokeMethod(
this,
"endAcquisition", Qt::BlockingQueuedConnection);
149 if (QThread::currentThread() != thread()) {
150 QMetaObject::invokeMethod(
this,
"shutdownAcquisition", Qt::BlockingQueuedConnection);
161 if (acq->synchronizedAcquisition()) {
162 acq->synchronizedAcquisition()->acquiredFrameAvailable(
frameCounter);
165 int nRows = get_NRows();
166 int nCols = get_NCols();
169 nCols, nRows, acq.data());
170 int xpmsec = (int)(acq->get_ExposureTime()*1000+0.5);
174 quint16 *ptr = image->data();
176 for (
int j=0; j<
nRows; j++) {
177 for (
int i=0; i<
nCols; i++) {
178 if ((i>=frame*64) && (i<(frame+1)*64) && (j < 64)) {
186 if ((nRows > 1024) && (nCols > 1024)) {
187 const int labelWidth = 256;
188 const int labelHeight = 64;
190 QImage imageLabel(labelWidth, labelHeight, QImage::Format_RGB32);
191 QPainter painter(&imageLabel);
193 painter.fillRect(0,0,labelWidth,labelHeight, Qt::black);
194 painter.setPen(Qt::white);
195 painter.setFont(QFont(
"Times", labelHeight, QFont::Bold,
true));
196 painter.drawText(0, labelHeight, tr(
"%1").arg(
frameCounter));
198 QRgb *rgb = (QRgb*) imageLabel.bits();
199 int nFrames = nRows / labelHeight;
201 int plval = qGray(*rgb);
204 for (
int j=0; j<labelHeight; j++) {
205 for (
int i=0; i<labelWidth; i++) {
206 int x = nCols-labelWidth+i;
207 int y = (frameN+1)*labelHeight-j;
210 int lval = qGray(vRgb);
220 image->setValue(x,y,lval);
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QSharedPointer< QxrdDetectorProxy > QxrdDetectorProxyPtr
virtual void pushPropertiesToProxy(QxrdDetectorProxyPtr proxy)
QxrdExperimentWPtr m_Experiment
qint64 qcepDebug(int cond)
void shutdownAcquisition()
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
virtual void pullPropertiesfromProxy(QxrdDetectorProxyPtr proxy)
QxrdAcquisitionWPtr m_Acquisition
QWeakPointer< QxrdExperiment > QxrdExperimentWPtr
bool checkDetectorEnabled()
void enqueueAcquiredFrame(QcepImageDataBasePtr img)
virtual void onExposureTimeChanged()
QxrdDetectorSimulated(QcepSettingsSaverWPtr saver, QxrdExperimentWPtr expt, QxrdAcquisitionWPtr acq, int detNum, QcepObject *parent)
virtual ~QxrdDetectorSimulated()
void pullPropertiesfromProxy(QxrdDetectorProxyPtr proxy)
virtual void startDetector()
void pushPropertiesToProxy(QxrdDetectorProxyPtr proxy)
void beginAcquisition(double exposure)
virtual void stopDetector()
static QcepInt16ImageDataPtr newInt16Image(AllocationStrategy strat, int width, int height, QcepObject *parent)
QWeakPointer< QxrdAcquisition > QxrdAcquisitionWPtr
static void pushDefaultsToProxy(QxrdDetectorProxyPtr proxy, int detType)
static void pushDefaultsToProxy(QxrdDetectorProxyPtr proxy)
virtual void shutdownAcquisition()
virtual void endAcquisition()
QSharedPointer< QcepInt16ImageData > QcepInt16ImageDataPtr
virtual void beginAcquisition(double exposure)
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr