jfjoch_viewer: Handle ROI better
This commit is contained in:
@@ -16,14 +16,22 @@ JFJochViewerROIResult::JFJochViewerROIResult(QWidget *parent) : QWidget(parent)
|
||||
roi_x = new QLabel("", this);
|
||||
roi_y = new QLabel("", this);
|
||||
|
||||
label_1 = new QLabel("", this);
|
||||
label_2 = new QLabel("", this);
|
||||
|
||||
label_1->setAlignment(Qt::AlignCenter);
|
||||
label_2->setAlignment(Qt::AlignCenter);
|
||||
|
||||
layout->addWidget(roi_mean, 0, 0);
|
||||
layout->addWidget(roi_var, 0, 1);
|
||||
layout->addWidget(roi_sum, 0, 2);
|
||||
layout->addWidget(roi_max, 0, 3);
|
||||
layout->addWidget(roi_npixel, 1, 0);
|
||||
layout->addWidget(roi_masked, 1, 1);
|
||||
layout->addWidget(roi_x, 1, 2);
|
||||
layout->addWidget(roi_y, 1, 3);
|
||||
layout->addWidget(label_1, 1,0,1,2);
|
||||
layout->addWidget(roi_npixel, 1, 2);
|
||||
layout->addWidget(roi_masked, 1, 3);
|
||||
layout->addWidget(label_2, 2,0,1,2);
|
||||
layout->addWidget(roi_x, 2, 2);
|
||||
layout->addWidget(roi_y, 2, 3);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
@@ -37,10 +45,12 @@ void JFJochViewerROIResult::SetROIResult(ROIMessage roi) {
|
||||
roi_mean->setText(QString("Mean <b>%1</b>").arg(QString::number(roi_mean_val, 'f', 3)));
|
||||
roi_var->setText(QString("Var <b>%1</b>").arg(QString::number(variance, 'f', 3)));
|
||||
roi_max->setText(QString("Max <b>%1</b>").arg(roi.max_count));
|
||||
roi_npixel->setText(QString("Pixels <b>%1</b>").arg(roi.pixels));
|
||||
roi_npixel->setText(QString("Valid <b>%1</b>").arg(roi.pixels));
|
||||
roi_masked->setText(QString("Masked <b>%1</b>").arg(roi.pixels_masked));
|
||||
roi_x->setText(QString("x: <b>%1</b>").arg(static_cast<float>(roi.x_weighted) / roi.sum));
|
||||
roi_y->setText(QString("y: <b>%1</b>").arg(static_cast<float>(roi.y_weighted) / roi.sum));
|
||||
label_1->setText(QString("Pixel count"));
|
||||
label_2->setText(QString("Center of mass"));
|
||||
} else {
|
||||
roi_sum->setText("");
|
||||
roi_mean->setText("");
|
||||
@@ -50,5 +60,7 @@ void JFJochViewerROIResult::SetROIResult(ROIMessage roi) {
|
||||
roi_masked->setText("");
|
||||
roi_x->setText("");
|
||||
roi_y->setText("");
|
||||
label_1->setText("");
|
||||
label_2->setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ class JFJochViewerROIResult : public QWidget{
|
||||
QLabel *roi_masked;
|
||||
QLabel *roi_x;
|
||||
QLabel *roi_y;
|
||||
QLabel *label_1;
|
||||
QLabel *label_2;
|
||||
|
||||
public slots:
|
||||
void SetROIResult(ROIMessage msg);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <QStatusBar>
|
||||
#include "JFJoch2DAzintImageWindow.h"
|
||||
|
||||
#include "../JFJochViewerROIResult.h"
|
||||
|
||||
JFJoch2DAzintImageWindow::JFJoch2DAzintImageWindow(QWidget *parent) : JFJochHelperWindow(parent) {
|
||||
QWidget *centralWidget = new QWidget(this);
|
||||
@@ -25,9 +25,12 @@ JFJoch2DAzintImageWindow::JFJoch2DAzintImageWindow(QWidget *parent) : JFJochHelp
|
||||
foreground_row->addWidget(new QLabel("Foreground:"));
|
||||
foreground_row->addWidget(foreground_slider);
|
||||
|
||||
auto roi_result = new JFJochViewerROIResult(this);
|
||||
|
||||
grid_layout->addLayout(background_row, 0, 0, 1, 2);
|
||||
grid_layout->addLayout(foreground_row, 1, 0, 1, 2);
|
||||
grid_layout->addWidget(viewer, 2, 0, 1, 2);
|
||||
grid_layout->addWidget(roi_result, 3, 0, 1, 2);
|
||||
centralWidget->setLayout(grid_layout);
|
||||
|
||||
connect(viewer, &JFJochAzIntImage::backgroundChanged,
|
||||
@@ -42,6 +45,8 @@ JFJoch2DAzintImageWindow::JFJoch2DAzintImageWindow(QWidget *parent) : JFJochHelp
|
||||
foreground_slider->setValue(val);
|
||||
});
|
||||
|
||||
connect(viewer, &JFJochAzIntImage::roiCalculated, roi_result, &JFJochViewerROIResult::SetROIResult);
|
||||
|
||||
connect(background_slider, &SliderPlusBox::valueChanged, viewer, &JFJochAzIntImage::changeBackground);
|
||||
connect(foreground_slider, &SliderPlusBox::valueChanged, viewer, &JFJochAzIntImage::changeForeground);
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include "../JFJochViewerROIResult.h"
|
||||
|
||||
JFJochCalibrationWindow::JFJochCalibrationWindow(QWidget *parent) : JFJochHelperWindow(parent) {
|
||||
QWidget *centralWidget = new QWidget(this);
|
||||
setWindowTitle("Calibration image viewer");
|
||||
@@ -35,11 +37,14 @@ JFJochCalibrationWindow::JFJochCalibrationWindow(QWidget *parent) : JFJochHelper
|
||||
foreground_row->addWidget(new QLabel("Foreground:"));
|
||||
foreground_row->addWidget(foreground_slider);
|
||||
|
||||
auto roi_result = new JFJochViewerROIResult(this);
|
||||
|
||||
grid_layout->addWidget(calibration_option, 0, 0);
|
||||
grid_layout->addWidget(color_map_select, 0, 1);
|
||||
grid_layout->addLayout(background_row, 1, 0, 1, 2);
|
||||
grid_layout->addLayout(foreground_row, 2, 0, 1, 2);
|
||||
grid_layout->addWidget(viewer, 3, 0, 1, 2);
|
||||
grid_layout->addWidget(roi_result, 4, 0, 1, 2);
|
||||
|
||||
connect(viewer, &JFJochSimpleImage::backgroundChanged,
|
||||
[this] (float val) {
|
||||
@@ -52,6 +57,7 @@ JFJochCalibrationWindow::JFJochCalibrationWindow(QWidget *parent) : JFJochHelper
|
||||
QSignalBlocker blocker(foreground_slider);
|
||||
foreground_slider->setValue(val);
|
||||
});
|
||||
connect(viewer, &JFJochSimpleImage::roiCalculated, roi_result, &JFJochViewerROIResult::SetROIResult);
|
||||
|
||||
connect(background_slider, &SliderPlusBox::valueChanged, viewer, &JFJochSimpleImage::changeBackground);
|
||||
connect(foreground_slider, &SliderPlusBox::valueChanged, viewer, &JFJochSimpleImage::changeForeground);
|
||||
|
||||
Reference in New Issue
Block a user