2 #include "ui_qxrddetectorcontrolwindow.h"
31 setAttribute(Qt::WA_DeleteOnClose,
false);
39 dp->prop_DetectorDisplayMode() -> linkTo(m_DetectorDisplayMode);
40 dp->prop_PerformDarkSubtraction() -> linkTo(m_PerformDarkSubtraction);
41 dp->prop_SaveRawImages() -> linkTo(m_SaveRawData);
42 dp->prop_SaveDarkImages() -> linkTo(m_SaveDarkData);
43 dp->prop_PerformBadPixels() -> linkTo(m_BadPixelCorrection);
44 dp->prop_PerformGainCorrection() -> linkTo(m_GainCorrection);
45 dp->prop_SaveSubtracted() -> linkTo(m_SaveSubtractedData);
47 dp->prop_DarkImagePath() -> linkTo(m_DarkImagePath);
48 dp->prop_RawDataSubdir() -> linkTo(m_RawDataSubdir);
49 dp->prop_DarkDataSubdir() -> linkTo(m_DarkDataSubdir);
50 dp->prop_BadPixelsPath() -> linkTo(m_BadPixelPath);
51 dp->prop_GainMapPath() -> linkTo(m_GainCorrectionPath);
52 dp->prop_SubtractedSubdir() -> linkTo(m_SubtractedDataSubdir);
54 dp->prop_MaskPath() -> linkTo(m_MaskImagePath);
56 dp->prop_PerformIntegration() -> linkTo(m_PerformIntegration);
57 dp->prop_DisplayIntegratedData() -> linkTo(m_DisplayIntegratedData);
58 dp->prop_SaveIntegratedData() -> linkTo(m_SaveIntegratedData);
59 dp->prop_IntegratedDataFile() -> linkTo(m_IntegratedDataFile);
60 dp->prop_SaveIntegratedDataSeparate() -> linkTo(m_SaveIntegratedDataSeparate);
61 dp->prop_IntegratedDataSubdir() -> linkTo(m_IntegratedDataSubdir);
63 dp->prop_AccumulateIntegrated2D() -> linkTo(m_AccumulateIntegratedData);
64 dp->prop_AccumulateIntegratedName()-> linkTo(m_AccumulateIntegratedName);
66 dp->prop_CalculateROICounts() -> linkTo(m_CalculateROICounts);
67 dp->prop_DisplayROIBorders() -> linkTo(m_DisplayROIBorders);
101 m_ROIWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
104 m_DetectorImage->init(dp->imagePlotSettings());
107 m_DetectorImage->setROISelection(m_ROIWidget->selectionModel());
121 int fs = expt->get_FontSize();
122 int sp = expt->get_Spacing();
148 printf(
"Deleting detector control window\n");
157 setWindowTitle(tr(
"%1: Control %2 detector \"%3\"")
158 .arg(dt->get_DetectorNumber())
159 .arg(dt->get_DetectorTypeName())
160 .arg(dt->get_DetectorName()));
166 QMainWindow::changeEvent(e);
168 case QEvent::LanguageChange:
181 acq->printMessage(msg, ts);
190 int roiCount =
m_ROIModel->rowCount(QModelIndex());
192 QItemSelectionModel *selected = m_ROIWidget->selectionModel();
194 for (
int i=0; i<roiCount; i++) {
195 if (selected->rowIntersectsSelection(i, QModelIndex())) {
218 QAction *choice = menu.exec(QCursor::pos());
221 int roiType = choice->data().toInt();
235 int res = QMessageBox::Cancel;
237 if (rois.count() == 0) {
238 QMessageBox::information(
this,
"No ROIs Selected",
"Select ROIs to delete", QMessageBox::Ok);
239 }
else if (rois.count() == 1) {
240 res = QMessageBox::information(
this,
"Delete ROI?",
241 tr(
"Do you really want to delete ROI %1").arg(rois.value(0)),
242 QMessageBox::Ok, QMessageBox::Cancel);
245 foreach (
int i, rois) {
247 roimsg = tr(
"%1").arg(i);
249 roimsg += tr(
", %1").arg(i);
253 res = QMessageBox::information(
this,
"Delete ROIs?",
254 tr(
"Do you really want to delete ROIs %1").arg(roimsg));
258 for (
int i=rois.count()-1; i>=0; i--) {
268 if (rois.count() != 1) {
269 QMessageBox::information(
this,
"Only Move One",
"Must have a single ROI selected before moving it", QMessageBox::Ok);
281 if (rois.count() != 1) {
282 QMessageBox::information(
this,
"Only Move One",
"Must have a single ROI selected before moving it", QMessageBox::Ok);
350 m_DetectorImage -> enableROIDisplay(show);
358 QString newPath = QFileDialog::getOpenFileName(
this,
"Select Mask Image",
361 if (newPath.length() > 0) {
362 dp->set_MaskPath(newPath);
372 int res = QMessageBox::information(
this,
"Clear Mask?",
"Do you really want to clear the mask?", QMessageBox::Ok, QMessageBox::Cancel);
374 if (res == QMessageBox::Ok) {
375 dp->set_MaskPath(
"");
385 QString newPath = QFileDialog::getOpenFileName(
this,
"Select Dark Image",
386 dp->get_DarkImagePath());
388 if (newPath.length() > 0) {
389 dp->set_DarkImagePath(newPath);
399 int res = QMessageBox::information(
this,
"Clear Dark?",
"Do you really want to clear the dark image?", QMessageBox::Ok, QMessageBox::Cancel);
401 if (res == QMessageBox::Ok) {
402 dp->set_DarkImagePath(
"");
412 QString newPath = QFileDialog::getOpenFileName(
this,
"Select Bad Pixels Image",
413 dp->get_BadPixelsPath());
415 if (newPath.length() > 0) {
416 dp->set_BadPixelsPath(newPath);
426 int res = QMessageBox::information(
this,
"Clear Bad Pixels?",
"Do you really want to clear the bad pixels image?", QMessageBox::Ok, QMessageBox::Cancel);
428 if (res == QMessageBox::Ok) {
429 dp->set_BadPixelsPath(
"");
439 QString newPath = QFileDialog::getOpenFileName(
this,
"Select Gain Correction Image",
440 dp->get_GainMapPath());
442 if (newPath.length() > 0) {
443 dp->set_GainMapPath(newPath);
453 int res = QMessageBox::information(
this,
"Clear Gain Correction?",
"Do you really want to clear the gain correction image?", QMessageBox::Ok, QMessageBox::Cancel);
455 if (res == QMessageBox::Ok) {
456 dp->set_GainMapPath(
"");
467 m_ROIModel->recalculate(dp->data(), dp->mask());
479 if (rois.count() != 1) {
480 QMessageBox::information(
this,
"Visualize ROI",
"Select one ROI to visualize", QMessageBox::Ok);
482 m_ROIModel->visualizeBackground(rois.first(), dp->data(), dp->mask());
496 if (rois.count() != 1) {
497 QMessageBox::information(
this,
"Visualize ROI",
"Select one ROI to visualize", QMessageBox::Ok);
499 m_ROIModel->visualizePeak(rois.first(), dp->data(), dp->mask());
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdAcquisitionWPtr m_Acquisition
void valueChanged(QString val, int index)
void onUpdateIntervalMsecChanged(int newVal)
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdDetectorControlWindow(QcepSettingsSaverWPtr saver, QxrdExperimentWPtr exp, QxrdAcquisitionWPtr acq, QxrdDetectorWPtr det, QxrdDetectorProcessorWPtr proc, QWidget *parent=0)
QWeakPointer< QxrdDetectorProcessor > QxrdDetectorProcessorWPtr
QSharedPointer< QxrdROICoordinates > QxrdROICoordinatesPtr
void displayNewData(QcepImageDataBasePtr img, QcepMaskDataPtr overflow)
void displayNewMask(QcepMaskDataPtr mask)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
QSharedPointer< QxrdROICalculator > QxrdROICalculatorPtr
QAtomicInt m_NewMaskAvailable
void updateImageDisplay()
QWeakPointer< QxrdExperiment > QxrdExperimentWPtr
QxrdDetectorProcessorWPtr m_Processor
QxrdROICoordinatesListModelPtr m_ROIModel
QVector< int > selectedROIs()
QSharedPointer< QxrdDetectorProcessor > QxrdDetectorProcessorPtr
QWeakPointer< QxrdDetector > QxrdDetectorWPtr
QcepImageDataBasePtr m_NewImage
void setSpacing(int spacing)
void changeEvent(QEvent *e)
static int roiTypeCount()
QcepImageDataBasePtr m_DisplayedImage
void doClearGainCorrection()
void doBrowseGainCorrection()
QWeakPointer< QxrdAcquisition > QxrdAcquisitionWPtr
QcepApplication * g_Application
void setFontSize(int fontSize)
void doVisualizeBackground()
QxrdDetectorWPtr m_Detector
QSharedPointer< QxrdDetector > QxrdDetectorPtr
QcepMaskDataPtr m_NewMask
void valueChanged(int val, int index)
QSharedPointer< QcepImageDataBase > QcepImageDataBasePtr
QAtomicInt m_NewDataAvailable
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QcepMaskDataPtr m_DisplayedMask
~QxrdDetectorControlWindow()
QcepMaskDataPtr m_NewOverflow
void valueChanged(bool val, int index)
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr
QcepSettingsSaverWPtr m_Saver
QxrdExperimentWPtr m_Experiment
QcepMaskDataPtr m_DisplayedOverflow
void updateROIDisplay(bool show)