41 #include <qwt_plot_curve.h>
42 #include <qwt_plot_zoomer.h>
43 #include <qwt_legend.h>
44 #include <qwt_symbol.h>
48 #include <QSignalMapper>
49 #include <QFileDialog>
50 #include <QMessageBox>
51 #include <QCloseEvent>
55 #include <QMetaObject>
56 #include <QMetaMethod>
58 #include <QDesktopWidget>
59 #include <QSortFilterProxyModel>
110 printf(
"QxrdWindow::QxrdWindow(%p)\n",
this);
116 app->printMessage(
"QxrdWindow::QxrdWindow");
130 setWindowIcon(QIcon(
":/images/qxrd-icon-64x64.png"));
190 m_ImagePlot -> init(set->imagePlotSettings());
191 m_CenterFinderPlot -> init(set->centerFinderPlotSettings());
192 m_IntegratorPlot -> init(set->integratorPlotSettings());
194 m_DistortionCorrectionPlot -> init(set->distortionCorrectionPlotSettings());
197 QDesktopWidget *dw = QApplication::desktop();
199 QRect screenGeom = dw->screenGeometry(
this);
213 if (screenGeom.height() >= 1280) {
233 }
else if (screenGeom.height() >= 1000) {
275 if (screenGeom.height() < 1000) {
282 int fs = expt->get_FontSize();
283 int sp = expt->get_Spacing();
300 connect(m_ExecuteScriptButton, &QAbstractButton::clicked, m_ActionExecuteScript, &QAction::triggered);
302 connect(m_CancelScriptButton, &QAbstractButton::clicked, m_ActionCancelScript, &QAction::triggered);
304 connect(m_LoadScriptButton, &QAbstractButton::clicked, m_ActionLoadScript, &QAction::triggered);
317 connect(m_ActionCloseExperiment, &QAction::triggered,
this, &QWidget::close);
328 m_ExperimentsMenu->menuAction()->setMenuRole(QAction::NoRole);
334 m_ConfigureDetectorMenu->menuAction()->setMenuRole(QAction::NoRole);
364 connect(
m_DisplayDialog -> m_AutoRange, &QAbstractButton::clicked, m_ActionAutoRange, &QAction::triggered);
365 connect(
m_DisplayDialog -> m_Display_5pct, &QAbstractButton::clicked, m_Action005Range, &QAction::triggered);
366 connect(
m_DisplayDialog -> m_Display_10pct, &QAbstractButton::clicked, m_Action010Range, &QAction::triggered);
367 connect(
m_DisplayDialog -> m_Display_100pct, &QAbstractButton::clicked, m_Action100Range, &QAction::triggered);
415 connect(m_ActionMaskCircles, &QAction::triggered, m_ImageMaskCirclesButton, &QAbstractButton::click);
416 connect(m_ActionMaskPolygons, &QAction::triggered, m_ImageMaskPolygonsButton, &QAbstractButton::click);
426 connect(m_ImageZoomOutButton, &QAbstractButton::clicked, m_ImagePlot, &
QcepPlot::zoomOut);
437 connect(m_CenteringZoomOutButton, &QAbstractButton::clicked, m_CenterFinderPlot, &
QcepPlot::zoomOut);
438 connect(m_CenteringZoomAllButton, &QAbstractButton::clicked, m_CenterFinderPlot, &
QcepPlot::autoScale);
442 connect(m_IntegratorZoomOutButton, &QAbstractButton::clicked, m_IntegratorPlot, &
QcepPlot::zoomOut);
443 connect(m_IntegratorZoomAllButton, &QAbstractButton::clicked, m_IntegratorPlot, &
QcepPlot::autoScale);
446 connect(m_DistortionCorrectionZoomInButton, &QAbstractButton::clicked, m_DistortionCorrectionPlot, &
QcepPlot::enableZooming);
447 connect(m_DistortionCorrectionZoomOutButton, &QAbstractButton::clicked, m_DistortionCorrectionPlot, &
QcepPlot::zoomOut);
448 connect(m_DistortionCorrectionZoomAllButton, &QAbstractButton::clicked, m_DistortionCorrectionPlot, &
QcepPlot::autoScale);
449 connect(m_DistortionCorrectionMeasureButton, &QAbstractButton::clicked, m_DistortionCorrectionPlot, &
QcepPlot::enableMeasuring);
459 connect(m_HelpHomeButton, &QAbstractButton::clicked, m_HelpBrowser, &QTextBrowser::home);
460 connect(m_HelpForwardButton, &QAbstractButton::clicked, m_HelpBrowser, &QTextBrowser::forward);
461 connect(m_HelpBackButton, &QAbstractButton::clicked, m_HelpBrowser, &QTextBrowser::backward);
463 connect(m_HelpBrowser, &QTextBrowser::forwardAvailable, m_HelpForwardButton, &QWidget::setEnabled);
464 connect(m_HelpBrowser, &QTextBrowser::backwardAvailable, m_HelpBackButton, &QWidget::setEnabled);
471 connect(m_ActionIntegrateCurrent, &QAction::triggered,
473 connect(m_ActionIntegrateInputImages, &QAction::triggered,
503 ps->prop_XMouse()->linkTo(m_XMouse);
504 ps->prop_YMouse()->linkTo(m_YMouse);
505 ps->prop_ValMouse()->linkTo(m_ValMouse);
506 ps->prop_TTHMouse()->linkTo(m_TTHMouse);
507 ps->prop_QMouse()->linkTo(m_QMouse);
508 ps->prop_RMouse()->linkTo(m_RMouse);
514 m_StatusMsg -> setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
523 m_Progress -> setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
524 m_Progress -> setToolTip(tr(
"Acquisition progress"));
526 statusBar() -> addPermanentWidget(
m_Progress);
538 app->criticalMessage(
"Oh no, QxrdWindow::m_Acquisition == NULL");
549 acq -> prop_OverflowLevel() -> linkTo(
m_DisplayDialog->m_OverflowLevel);
558 expt -> prop_CompletionPercentage() -> linkTo(
m_Progress);
563 proc -> prop_PerformDarkSubtractionTime() -> linkTo(
m_CorrectionDialog->m_PerformDarkTime);
567 proc -> prop_PerformBadPixelsTime() -> linkTo(
m_CorrectionDialog->m_PerformBadPixelsTime);
568 proc -> prop_PerformGainCorrection() -> linkTo(
m_CorrectionDialog->m_PerformGainCorrection);
569 proc -> prop_PerformGainCorrectionTime() -> linkTo(
m_CorrectionDialog->m_PerformGainCorrectionTime);
571 proc -> prop_SaveSubtractedTime() -> linkTo(
m_CorrectionDialog->m_SaveSubtractedTime);
574 proc -> prop_PerformIntegration() -> linkTo(
m_CorrectionDialog->m_PerformIntegration);
575 proc -> prop_PerformIntegrationTime() -> linkTo(
m_CorrectionDialog->m_PerformIntegrationTime);
576 proc -> prop_DisplayIntegratedData() -> linkTo(
m_CorrectionDialog->m_DisplayIntegratedData);
577 proc -> prop_DisplayIntegratedDataTime() -> linkTo(
m_CorrectionDialog->m_DisplayIntegratedDataTime);
578 proc -> prop_SaveIntegratedData() -> linkTo(
m_CorrectionDialog->m_SaveIntegratedData);
579 proc -> prop_SaveIntegratedDataTime() -> linkTo(
m_CorrectionDialog->m_SaveIntegratedDataTime);
580 proc -> prop_SaveIntegratedInSeparateFiles() -> linkTo(
m_CorrectionDialog->m_SaveIntegratedInSeparateFiles);
581 proc -> prop_AccumulateIntegrated2D() ->linkTo(
m_CorrectionDialog->m_AccumulateIntegrated2D);
582 proc -> prop_AccumulateIntegratedName() -> linkTo(
m_CorrectionDialog->m_AccumulateIntegratedName);
583 proc -> prop_EstimatedProcessingTime() -> linkTo(
m_CorrectionDialog->m_EstimatedProcessingTime);
590 ps -> prop_DisplayMinimumPct() -> linkTo(
m_DisplayDialog->m_DisplayMinimumPct);
591 ps -> prop_DisplayMaximumPct() -> linkTo(
m_DisplayDialog->m_DisplayMaximumPct);
592 ps -> prop_DisplayMinimumVal() -> linkTo(
m_DisplayDialog->m_DisplayMinimumVal);
593 ps -> prop_DisplayMaximumVal() -> linkTo(
m_DisplayDialog->m_DisplayMaximumVal);
594 ps -> prop_DisplayMinimumPctle() -> linkTo(
m_DisplayDialog->m_DisplayMinimumPctle);
595 ps -> prop_DisplayMaximumPctle() -> linkTo(
m_DisplayDialog->m_DisplayMaximumPctle);
598 ps -> prop_DisplayScalingMode() -> linkTo(
m_DisplayDialog->m_DisplayScalingMode);
601 m_DisplayDialog->m_DisplayParmsStack->setCurrentIndex(ps->get_DisplayScalingMode());
603 ps -> prop_DisplayColorMap() -> linkTo(
m_DisplayDialog->m_DisplayColorMap);
607 ps -> prop_OverflowShown() -> linkTo(
m_DisplayDialog->m_DisplayOverflow);
608 ps -> prop_InterpolatePixels() -> linkTo(
m_DisplayDialog->m_InterpolatePixels);
609 ps -> prop_MaintainAspectRatio() -> linkTo(
m_DisplayDialog->m_MaintainAspectRatio);
615 m_DistortionCorrectionPlot -> setWindow(
this);
616 m_CenterFinderPlot -> setWindow(
this);
652 m_WindowsMenu -> addAction(
m_MaskDialog -> toggleViewAction());
657 m_WindowsMenu -> addAction(
m_SliceDialog -> toggleViewAction());
669 QSortFilterProxyModel *sorted =
new QSortFilterProxyModel(
this);
671 sorted->setSourceModel(toDoList);
673 sorted->sort(0, Qt::DescendingOrder);
675 m_ToDoList->setModel(sorted);
676 m_ToDoList->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
677 m_ToDoList->horizontalHeader()->setStretchLastSection(
true);
678 m_ToDoList->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
679 m_ToDoList->setSelectionBehavior(QAbstractItemView::SelectRows);
688 m_Messages -> document() -> setMaximumBlockCount(app->get_MessageWindowLines());
695 m_ActionRefineCenterTilt->setEnabled(
false);
699 if (!expt->get_DefaultLayout()) {
700 QByteArray geometry = set->get_WindowGeometry();
701 QByteArray winstate = set->get_WindowState();
703 if (!restoreGeometry(geometry)) {
704 printf(
"Restore geometry failed\n");
707 if (!restoreState(winstate,2)) {
708 printf(
"Restore state failed\n");
711 expt->set_DefaultLayout(0);
725 printf(
"Deleting window\n");
731 app->printMessage(
"QxrdWindow::~QxrdWindow");
735 printf(
"QxrdWindow::~QxrdWindow(%p)\n",
this);
744 setWindowTitle(expt->experimentFilePath()+
" - QXRD");
746 setWindowTitle(
"QXRD");
749 if (
sizeof(
void*) == 4) {
750 setWindowTitle(windowTitle()+
" - 32 bit - v"+
STR(QXRD_VERSION));
752 setWindowTitle(windowTitle()+
" - 64 bit - v"+
STR(QXRD_VERSION));
763 m_ActionRefineCenterTilt->setEnabled(enable);
793 m_ExperimentsMenu->clear();
798 QList<QxrdExperimentWPtr> exps = app->experiments();
804 QString path = exp->experimentFilePath();
806 QAction *action =
new QAction(path, m_ExperimentsMenu);
807 QSignalMapper *mapper =
new QSignalMapper(action);
808 connect(action, &QAction::triggered, mapper, (
void (QSignalMapper::*)()) &QSignalMapper::map);
809 mapper->setMapping(action, path);
813 m_ExperimentsMenu -> addAction(action);
828 QStringList recent = app->get_RecentExperiments();
830 foreach (QString exp, recent) {
832 QSignalMapper *mapper =
new QSignalMapper(action);
833 connect(action, &QAction::triggered, mapper, (
void (QSignalMapper::*)()) &QSignalMapper::map);
834 mapper->setMapping(action, exp);
836 connect(mapper, (
void (QSignalMapper::*)(
const QString&)) &QSignalMapper::mapped, app.data(),
846 m_ConfigureDetectorMenu->clear();
851 int nDets = acq->get_DetectorCount();
853 for (
int i=0; i<nDets; i++) {
855 QString detType = det->get_DetectorTypeName();
856 QString detName = det->get_DetectorName();
857 bool enabled = det->get_Enabled();
859 QString
str = tr(
"(%1) Configure %2 detector \"%3\"...").arg(i).arg(detType).arg(detName);
861 QAction *action =
new QAction(str, m_ConfigureDetectorMenu);
863 action->setCheckable(
true);
864 action->setChecked(enabled);
866 QSignalMapper *mapper =
new QSignalMapper(action);
868 connect(action, &QAction::triggered, mapper, (
void (QSignalMapper::*)()) &QSignalMapper::map);
869 mapper->setMapping(action,i);
871 connect(mapper, (
void (QSignalMapper::*)(
int)) &QSignalMapper::mapped,
874 m_ConfigureDetectorMenu->addAction(action);
881 m_DetectorControlWindowsMenu->clear();
886 int nDets = acq->get_DetectorCount();
888 for (
int i=0; i<nDets; i++) {
890 QString detType = det->get_DetectorTypeName();
891 QString detName = det->get_DetectorName();
892 bool enabled = det->get_Enabled();
894 QString
str = tr(
"(%1) Open %2 detector \"%3\" Control...").arg(i).arg(detType).arg(detName);
896 QAction *action =
new QAction(str, m_DetectorControlWindowsMenu);
898 action->setCheckable(
true);
899 action->setChecked(enabled);
901 QSignalMapper *mapper =
new QSignalMapper(action);
903 connect(action, &QAction::triggered, mapper, (
void (QSignalMapper::*)()) &QSignalMapper::map);
904 mapper->setMapping(action,i);
906 connect(mapper, (
void (QSignalMapper::*)(
int)) &QSignalMapper::mapped,
909 m_DetectorControlWindowsMenu->addAction(action);
916 return QDateTime::currentDateTime().toString(
"yyyy.MM.dd : hh:mm:ss.zzz ");
921 QString message = ts.toString(
"yyyy.MM.dd : hh:mm:ss.zzz ")+
922 QThread::currentThread()->objectName()+
": "+
925 message = message.replace(
"\n",
" : ");
932 if (QThread::currentThread()==thread()) {
933 QMessageBox::warning(
this, tr(
"Warning"), msg);
937 Qt::QueuedConnection,
938 Q_ARG(QString, msg)));
944 if (QThread::currentThread()==thread()) {
945 m_Messages -> append(msg);
949 Qt::QueuedConnection,
950 Q_ARG(QString, msg)));
956 if (QThread::currentThread()==thread()) {
957 m_Messages -> append(
"<font color=#ff0000>"+aline+
"</font>");
961 Qt::QueuedConnection,
962 Q_ARG(QString, aline)));
968 if (QThread::currentThread()==thread()) {
969 static int dialogCount = 0;
974 expt->printMessage(tr(
"critical message %1, count = %2").arg(msg).arg(dialogCount));
978 if (dialogCount <= 1) {
979 QMessageBox::critical(
this,
"Error", msg);
984 "displayCriticalMessage",
985 Qt::QueuedConnection,
986 Q_ARG(QString, msg)));
1002 QString fileName,
int iphase,
int nphases,
int isum,
int nsum,
int igroup,
int ngroup)
1004 printMessage(tr(
"QxrdWindow::acquiredFrame(\"%1\",%2,%3,%4,%5,%6,%7)")
1006 .arg(iphase).arg(nphases)
1007 .arg(isum).arg(nsum)
1008 .arg(igroup).arg(ngroup));
1012 int totalFrames = (nphases*nsum*ngroup <= 0 ? 1 : nphases*nsum*ngroup);
1013 int thisFrame = igroup*nphases*nsum + isum*nphases + iphase + 1;
1015 printMessage(tr(
"Frame %1 of %2").arg(thisFrame).arg(totalFrames));
1023 expt->statusMessage(tr(
"%1: Exposure %2 of %3, File %4 of %5")
1025 .arg(isum+1).arg(nsum)
1026 .arg(igroup+1).arg(ngroup));
1028 expt->statusMessage(tr(
"%1: Phase %2 of %3, Sum %4 of %5, Group %6 of %7")
1030 .arg(iphase+1).arg(nphases)
1031 .arg(isum+1).arg(nsum)
1032 .arg(igroup+1).arg(ngroup));
1036 m_Progress -> setValue(thisFrame*100/totalFrames);
1044 set->set_WindowGeometry(saveGeometry());
1045 set->set_WindowState(saveState(2));
1053 QMainWindow::resizeEvent(ev);
1060 QMainWindow::moveEvent(ev);
1065 if (QThread::currentThread()==thread()) {
1073 "displayStatusMessage",
1074 Qt::QueuedConnection,
1075 Q_ARG(QString, msg)));
1109 INVOKE_CHECK(QMetaObject::invokeMethod(
this,
"newMask", Qt::QueuedConnection));
1129 m_CenterFinderPlot -> onProcessedImageAvailable(
m_Data);
1162 m_CenterFinderPlot -> onMaskedImageAvailable(
m_Data,
m_Mask);
1196 QString path = expt->experimentFilePath();
1197 QString name = expt->defaultExperimentName(path);
1198 QString dirp = expt->defaultExperimentDirectory(path);
1200 QDir dir(expt->get_ExperimentDirectory());
1202 QString newPath = dir.filePath(name+
"-copy.qxrdp");
1204 QString newChoice = QFileDialog::getSaveFileName(NULL,
1205 "Save Experiment As",
1207 "QXRD Experiments (*.qxrdp)");
1209 if (newChoice.length()>0) {
1210 expt->saveExperimentAs(newChoice);
1211 app->appendRecentExperiment(newChoice);
1224 QString path = expt->experimentFilePath();
1225 QString name = expt->defaultExperimentName(path);
1226 QString dirp = expt->defaultExperimentDirectory(path);
1228 QDir dir(expt->get_ExperimentDirectory());
1230 QString newPath = dir.filePath(name+
"-copy.qxrdp");
1232 QString newChoice = QFileDialog::getSaveFileName(NULL,
1233 "Save Experiment Copy",
1235 "QXRD Experiments (*.qxrdp)");
1237 if (newChoice.length()>0) {
1238 expt->saveExperimentCopyAs(newChoice);
1239 app->appendRecentExperiment(newChoice);
1251 if (proc->data() == NULL) {
1254 QString theFile = QFileDialog::getSaveFileName(
1255 this,
"Save Data in", proc -> get_DataPath());
1257 if (theFile.length()) {
1271 QString theFile = QFileDialog::getOpenFileName(
1272 this,
"Load Data from...", proc -> get_DataPath());
1274 if (theFile.length()) {
1275 proc->loadData(theFile);
1287 if (proc->darkImage() == NULL) {
1290 QString theFile = QFileDialog::getSaveFileName(
1291 this,
"Save Dark Data in", proc -> get_DataPath());
1293 if (theFile.length()) {
1307 QString theFile = QFileDialog::getOpenFileName(
1308 this,
"Load Dark Data from...", proc -> get_DataPath());
1310 if (theFile.length()) {
1311 proc->loadDark(theFile);
1323 if (proc->darkImage() == NULL) {
1326 if (QMessageBox::question(
this,
"Clear Dark Image?",
"Do you really want to clear the dark image?",
1327 QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
1341 if (proc->mask() == NULL) {
1344 QString theFile = QFileDialog::getSaveFileName(
1345 this,
"Save Mask in", proc -> get_DataPath());
1347 if (theFile.length()) {
1361 QString theFile = QFileDialog::getOpenFileName(
1362 this,
"Load Mask from...", proc -> get_DataPath());
1364 if (theFile.length()) {
1365 proc->loadMask(theFile);
1377 if (proc->mask() == NULL) {
1380 if (QMessageBox::question(
this,
"Clear Mask?",
"Do you really want to clear the mask?",
1381 QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
1395 if (proc->badPixels() == NULL) {
1398 QString theFile = QFileDialog::getSaveFileName(
1399 this,
"Save Bad Pixels in", proc -> get_DataPath());
1401 if (theFile.length()) {
1415 QString theFile = QFileDialog::getOpenFileName(
1416 this,
"Load Bad Pixel Map from...", proc -> get_DataPath());
1418 if (theFile.length()) {
1419 proc->loadBadPixels(theFile);
1431 if (proc->badPixels() == NULL) {
1434 if (QMessageBox::question(
this,
"Clear Bad Pixels",
"Do you really want to clear the bad pixel map?",
1435 QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
1436 proc->clearBadPixels();
1449 if (proc->gainMap() == NULL) {
1452 QString theFile = QFileDialog::getSaveFileName(
1453 this,
"Save Gain Map in", proc -> get_DataPath());
1455 if (theFile.length()) {
1469 QString theFile = QFileDialog::getOpenFileName(
1470 this,
"Load Pixel Gain Map from...", proc -> get_DataPath());
1472 if (theFile.length()) {
1473 proc->loadGainMap(theFile);
1485 if (proc->gainMap() == NULL) {
1488 if (QMessageBox::question(
this,
"Clear Gain Map",
"Do you really want to clear the gain map?",
1489 QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
1490 proc->clearGainMap();
1505 QString theFile = QFileDialog::getSaveFileName(
1508 if (theFile.length()) {
1511 proc -> saveCachedGeometry(theFile);
1525 QString theFile = QFileDialog::getSaveFileName(
1528 if (theFile.length()) {
1531 proc -> saveCachedIntensity(theFile);
1546 m_CancelScriptButton -> setEnabled(
true);
1547 m_ActionCancelScript -> setEnabled(
true);
1548 m_ExecuteScriptButton -> setEnabled(
false);
1549 m_ActionExecuteScript -> setEnabled(
false);
1560 eng -> cancelCommand();
1567 if (result.isError()) {
1568 int line = result.property(
"lineNumber").toInteger();
1570 m_Messages -> append(tr(
"Error in line %1").arg(line));
1571 m_Messages -> append(result.property(
"message").toString());
1576 m_CancelScriptButton -> setEnabled(
false);
1577 m_ActionCancelScript -> setEnabled(
false);
1578 m_ExecuteScriptButton -> setEnabled(
true);
1579 m_ActionExecuteScript -> setEnabled(
true);
1587 QString theFile = QFileDialog::getOpenFileName(
1588 this,
"Load Script from...", proc->get_ScriptPath());
1590 if (theFile.length()) {
1591 proc->set_ScriptPath(theFile);
1606 expt ->
printMessage(tr(
"Loading script file from %1").arg(path));
1637 int alloc = allocator -> get_Allocated();
1638 int maxalloc = allocator -> get_Max();
1654 QStringList files = QFileDialog::getOpenFileNames(
this,
1655 "Select data files to accumulate...",
1656 proc -> get_DataPath());
1658 QMetaObject::invokeMethod(proc.data(),
"accumulateImages", Q_ARG(QStringList, files));
1667 QStringList files = QFileDialog::getOpenFileNames(
this,
1668 "Select data file(s) to add to current...",
1669 proc -> get_DataPath());
1671 QMetaObject::invokeMethod(proc.data(),
"addImages", Q_ARG(QStringList, files));
1680 QStringList files = QFileDialog::getOpenFileNames(
this,
1681 "Select data file(s) to subtract from current...",
1682 proc -> get_DataPath());
1684 QMetaObject::invokeMethod(proc.data(),
"subtractImages", Q_ARG(QStringList, files));
1693 QMetaObject::invokeMethod(proc.data(),
"reflectHorizontally");
1702 QMetaObject::invokeMethod(proc.data(),
"reflectVertically");
1711 QStringList files = QFileDialog::getOpenFileNames(
this,
1712 "Select data files to project along X...",
1713 proc -> get_DataPath());
1715 QMetaObject::invokeMethod(proc.data(),
"projectImages", Q_ARG(QStringList, files),
1716 Q_ARG(
int, 1), Q_ARG(
int, 0), Q_ARG(
int, 0));
1725 QStringList files = QFileDialog::getOpenFileNames(
this,
1726 "Select data files to project along Y...",
1727 proc -> get_DataPath());
1729 QMetaObject::invokeMethod(proc.data(),
"projectImages", Q_ARG(QStringList, files),
1730 Q_ARG(
int, 0), Q_ARG(
int, 1), Q_ARG(
int, 0));
1739 QStringList files = QFileDialog::getOpenFileNames(
this,
1740 "Select data files to project along Z...",
1741 proc -> get_DataPath());
1743 QMetaObject::invokeMethod(proc.data(),
"projectImages", Q_ARG(QStringList, files),
1744 Q_ARG(
int, 0), Q_ARG(
int, 0), Q_ARG(
int, 1));
1753 QStringList files = QFileDialog::getOpenFileNames(
this,
1754 "Select data files to correlate with current image...",
1755 proc -> get_DataPath());
1757 QMetaObject::invokeMethod(proc.data(),
"correlateImages", Q_ARG(QStringList, files));
1766 QStringList files = QFileDialog::getOpenFileNames(
this,
1767 "Select data files to integrate...",
1768 proc -> get_DataPath());
1770 foreach (QString file, files) {
1771 proc->integrateData(file);
1781 QStringList files = QFileDialog::getOpenFileNames(
this,
1782 "Select data files to process...",
1783 proc -> get_DataPath());
1785 foreach (QString file, files) {
1786 proc->processData(file);
1800 if (QMessageBox::question(
this, tr(
"Really Crash?"),
1801 tr(
"Do you really want to crash the program?"),
1802 QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
1811 if (QThread::currentThread() != thread()) {
1812 INVOKE_CHECK(QMetaObject::invokeMethod(
this,
"testWidget", Qt::BlockingQueuedConnection));
1814 QDockWidget *dockWidget =
new QDockWidget(
"Test",
this);
1815 QWidget *contents =
new QMainWindow(dockWidget);
1816 QMenuBar *menuBar =
new QMenuBar(contents);
1818 QMenu *test1Menu = menuBar->addMenu(
"Test1");
1819 QMenu *test2Menu = menuBar->addMenu(
"Test2");
1821 test1Menu->addAction(
"Cmd1");
1822 test1Menu->addAction(
"Cmd2");
1823 test2Menu->addAction(
"Cmd3");
1824 test2Menu->addAction(
"Cmd4");
1826 addDockWidget(Qt::RightDockWidgetArea, dockWidget);
1834 m_Messages -> document() -> setMaximumBlockCount(newVal);
1850 m_DistortionCorrectionPlot->detachItems(QwtPlotItem::Rtti_PlotCurve);
1851 m_DistortionCorrectionPlot->detachItems(QwtPlotItem::Rtti_PlotMarker);
1853 int nrgs = cf->countPowderRings();
1854 int npts = cf->countPowderRingPoints();
1856 for (
int r=0; r<nrgs; r++) {
1857 QVector<double> x, y;
1859 for (
int i=0; i<npts; i++) {
1862 if (pt.
n1() == r && pt.
n2() == 0) {
1863 x.append(cf->getChi(pt.
x(), pt.
y()));
1864 y.append(cf->getR (pt.
x(), pt.
y()));
1868 if (cf->get_SubtractRingAverages()) {
1871 for (
int i=0; i<n; i++) {
1875 double avg = sum/(double)n - cf->get_RingAverageDisplacement()*r;
1876 for (
int i=0; i<n; i++) {
1887 if (x.count() > 0) {
1888 QwtPlotCurve* pc =
new QwtPlotCurve(tr(
"Ring %1").arg(r));
1890 m_DistortionCorrectionPlot->setPlotCurveStyle(r, pc);
1892 pc -> setSamples(x, y);
1894 pc -> setStyle(QwtPlotCurve::NoCurve);
1895 pc -> setLegendAttribute(QwtPlotCurve::LegendShowSymbol,
true);
1897 pc -> attach(m_DistortionCorrectionPlot);
1902 m_DistortionCorrectionPlot->replot();
1917 m_DistortionCorrectionPlot->detachItems(QwtPlotItem::Rtti_PlotCurve);
1918 m_DistortionCorrectionPlot->detachItems(QwtPlotItem::Rtti_PlotMarker);
1920 int nrgs = cf->countPowderRings();
1921 int npts = cf->countPowderRingPoints();
1923 for (
int r=0; r<nrgs; r++) {
1924 QVector<double> x, y;
1926 for (
int i=0; i<npts; i++) {
1929 if (pt.
n1() == r && pt.
n2() == 0) {
1930 x.append(cf->getChi(pt.
x(), pt.
y()));
1931 y.append(cf->getTTH(pt.
x(), pt.
y()));
1937 double calTTH = cf->calibrantTTH(r);
1939 if (cf->get_SubtractRingAverages()) {
1946 avg = calTTH - cf->get_RingAverageDisplacement()*r;
1947 for (
int i=0; i<n; i++) {
1958 if (x.count() >= 0) {
1959 QwtPlotCurve* pc =
new QwtPlotCurve(tr(
"Ring %1").arg(r));
1961 m_DistortionCorrectionPlot->setPlotCurveStyle(r, pc);
1963 pc -> setSamples(x, y);
1965 pc -> setStyle(QwtPlotCurve::NoCurve);
1966 pc -> setLegendAttribute(QwtPlotCurve::LegendShowSymbol,
true);
1968 pc -> attach(m_DistortionCorrectionPlot);
1971 QwtPlotCurve* tth =
new QwtPlotCurve(tr(
"Cal %1").arg(r));
1972 QVector<double> x1,y1;
1973 x1.append(0); y1.append(calTTH - avg);
1974 x1.append(360); y1.append(calTTH - avg);
1975 m_DistortionCorrectionPlot->setPlotCurveStyle(r, tth);
1976 tth -> setSamples(x1,y1);
1977 tth -> setSymbol(NULL);
1978 tth -> attach(m_DistortionCorrectionPlot);
1984 m_DistortionCorrectionPlot->replot();
1997 m_DistortionCorrectionPlot->detachItems(QwtPlotItem::Rtti_PlotCurve);
1998 m_DistortionCorrectionPlot->detachItems(QwtPlotItem::Rtti_PlotMarker);
2001 int npts = pts.count();
2003 QVector<double> x, y;
2005 for (
int i=0; i<npts; i++) {
2011 QwtPlotCurve* pc =
new QwtPlotCurve(tr(
"Ring Centers"));
2013 m_DistortionCorrectionPlot->setPlotCurveStyle(0, pc);
2015 pc -> setSamples(x, y);
2017 pc -> setLegendAttribute(QwtPlotCurve::LegendShowSymbol,
true);
2018 pc -> attach(m_DistortionCorrectionPlot);
2020 m_DistortionCorrectionPlot->replot();
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QSharedPointer< QxrdCenterFinder > QxrdCenterFinderPtr
void calculateHistogram()
QxrdAcquisitionScalerDialog * m_AcquisitionScalerDialog
QxrdOutputFileBrowser * m_OutputFileBrowser
void populateRecentExperimentsMenu()
void activateExperiment(QString path)
QcepDoubleImageDataPtr m_NewData
QxrdImageCalculator * m_Calculator
QWeakPointer< QxrdDataProcessor > QxrdDataProcessorWPtr
QcepDoubleImageDataPtr data()
qint64 qcepDebug(int cond)
void loadScript(QString path)
void fitPowderCircle(int n=0)
void onCenterYChanged(double cy)
void executeCommand(QString cmd)
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionExtraInputsDialogPtr m_AcquisitionExtraInputsDialog
void onUpdateIntervalMsecChanged(int newVal)
void onCenterXChanged(double cx)
QxrdDistortionCorrectionDialog * m_DistortionCorrectionDialog
void selectHistogram(QRectF rect)
QxrdInputFileBrowser * m_InputFileBrowser
void onNewIntegrationAvailable(QcepIntegratedDataPtr data)
void chooseExistingExperiment()
void deletePowderPoints()
void setInverseGrayscale()
QSharedPointer< QxrdWindowSettings > QxrdWindowSettingsPtr
void integrationXUnitsChanged(int newXUnits)
QxrdAcquisitionWPtr m_Acquisition
QSharedPointer< QxrdCalibrantLibrary > QxrdCalibrantLibraryPtr
QxrdWindow(QxrdWindowSettingsWPtr settings, QxrdApplicationWPtr appl, QxrdExperimentWPtr docw, QxrdAcquisitionWPtr acqw, QxrdDataProcessorWPtr procw, QcepAllocatorWPtr allocw, QWidget *parent)
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
void toggleShowOverflow()
void warningMessage(QString msg)
void configureDetector(int i)
void calculateCalibration()
QSharedPointer< QxrdScriptEngine > QxrdScriptEnginePtr
void newMaskAvailable(QcepMaskDataPtr img)
QcepDatasetBrowserDialog * m_DatasetBrowserDialog
QcepDoubleImageDataPtr m_Data
void editGlobalPreferences()
QcepObjectNamer m_ObjectNamer
QcepAllocatorWPtr m_Allocator
QcepMaskDataPtr m_NewMask
QxrdAcquisitionDialog * m_AcquisitionDialog
void plotPowderRingRadii()
QWeakPointer< QxrdApplication > QxrdApplicationWPtr
QWeakPointer< QxrdExperiment > QxrdExperimentWPtr
QxrdDisplayDialog * m_DisplayDialog
void openRecentExperiment(QString path)
void onMessageWindowLinesChanged(int newVal)
void moveEvent(QMoveEvent *)
void acquiredFrame(QString fileName, int isum, int nsum, int iframe, int nframe, int igroup, int ngroup)
QxrdExperimentWPtr m_Experiment
QAtomicInt m_NewDataAvailable
QString timeStamp() const
static QString convertToString(QScriptValue result)
QProgressBar * m_AllocationStatus
void updateHistogramNeeded()
void resizeEvent(QResizeEvent *)
#define INVOKE_CHECK(res)
void openDetectorControlWindow(int i)
void onCenterYChanged(double cy)
void displayStatusMessage(QString msg)
void newIntegrationAvailable(QcepIntegratedDataPtr data)
void doReflectVertically()
QxrdHighlighter * m_Highlighter
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
void shrinkPanels(int fontSize, int spacing)
QxrdIntegratorDialog * m_IntegratorDialog
QxrdDataProcessorWPtr dataProcessor() const
void displayCriticalMessage(QString msg)
void slicePolygon(QVector< QPointF > poly)
void setupAcquireMenu(QMenu *menu)
void enableTiltRefinement(bool enable)
void doRefineCenterTilt()
QWeakPointer< QcepAllocator > QcepAllocatorWPtr
QSharedPointer< QxrdIntegrator > QxrdIntegratorPtr
QxrdApplicationWPtr m_Application
void enablePowderPoints()
QWeakPointer< QxrdWindowSettings > QxrdWindowSettingsWPtr
void setSpacing(int spacing)
QxrdCenterFinderDialog * m_CenterFinderDialog
QSharedPointer< QxrdImagePlotSettings > QxrdImagePlotSettingsPtr
QxrdSliceDialog * m_SliceDialog
void doAccumulateImages()
void initialLogEntry(QString aline)
QString m_CachedGeometryPath
void finishedCommand(QScriptValue result)
void closeEvent(QCloseEvent *event)
void doSaveCachedIntensity()
QxrdWindowSettingsWPtr m_WindowSettings
void histogramSelectionChanged(QRectF rect)
void saveExperimentCopy()
void plotPowderRingTwoTheta()
QxrdCalibrantDialog * m_CalibrantDialog
void chooseNewExperiment()
QxrdDataProcessorWPtr m_DataProcessor
void doIntegrateSequence()
void populateConfigureDetectorMenu()
void populateExperimentsMenu()
QProgressBar * m_Progress
QxrdScriptDialog * m_ScriptDialog
QWeakPointer< QxrdAcquisition > QxrdAcquisitionWPtr
void clearStatusMessage()
void setupRecentExperimentsMenu(QAction *action)
QMenu * m_RecentExperimentsMenu
void integrateSaveAndDisplay()
QSharedPointer< QcepAllocator > QcepAllocatorPtr
void plotPowderRingCenters()
void setFontSize(int fontSize)
void enableMaskPolygons()
void valueChanged(double val, int index)
void doReflectHorizontally()
void doPolarNormalization()
QxrdHistogramDialog * m_HistogramDialog
QxrdAcquisitionWPtr acquisition() const
void displayMessage(QString msg)
void populateDetectorControlWindowsMenu()
QxrdInfoDialog * m_ImageInfoDialog
QSharedPointer< QxrdDetector > QxrdDetectorPtr
QxrdImageDisplayWidget * m_ImageDisplay
QString m_CachedIntensityPath
void doEditDetectorPreferences()
void doSaveCachedGeometry()
void valueChanged(int val, int index)
QSharedPointer< QcepMaskData > QcepMaskDataPtr
void newDataAvailable(QcepDoubleImageDataPtr img, QcepMaskDataPtr overflow)
QxrdCorrectionDialog * m_CorrectionDialog
QSharedPointer< QxrdApplication > QxrdApplicationPtr
QxrdSynchronizedAcquisitionDialogPtr m_SynchronizedAcquisitionDialog
QcepMaskDataPtr m_NewOverflow
void slicePolygon(QVector< QPointF > poly)
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr
void clearSelectedCurves()
QcepMaskDataPtr m_Overflow
void onCenterXChanged(double cx)
QxrdMaskDialog * m_MaskDialog
QAtomicInt m_NewMaskAvailable
void allocatedMemoryChanged()
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr