-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsegmentationwidget.cpp
82 lines (67 loc) · 2.04 KB
/
segmentationwidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "segmentationwidget.h"
#include "ui_segmentationwidget.h"
#include <QMessageBox>
SegmentationWidget::SegmentationWidget( QWidget *parent ) : QWidget( parent ), ui( new Ui::Segmentationwidget ) {
ui->setupUi( this );
}
SegmentationWidget::~SegmentationWidget( ) {
delete ui;
}
void SegmentationWidget::setTool( Tool *sTool ) {
tool = dynamic_cast< SegmentationTool* >( sTool );
if( tool ) {
setEnabled( true );
/* atualiza os dados da interface */
ui->BetaSpinBox->setValue( tool->getBeta( ) );
ui->AlphaSpinBox->setValue( tool->getAlpha( ) );
ui->pushButtonShowSeeds->setChecked(tool->getSeedsVisible());
ui->pushButtonShowMask->setChecked(tool->getMaskVisible());
switch( tool->getDrawType( ) ) {
case 0:
ui->eraserButton->setChecked( true );
break;
case 1:
case 2:
ui->drawButton->setChecked( true );
break;
}
} else {
setEnabled( false );
}
}
void SegmentationWidget::on_SegmentationButton_clicked( ) {
double alpha = ui->AlphaSpinBox->value( );
double beta = ui->BetaSpinBox->value( );
try {
tool->segmentationOGS( alpha, beta );
} catch( std::runtime_error err ) {
QMessageBox::warning( this, "ERROR", err.what( ) );
}
}
void SegmentationWidget::on_eraserButton_clicked( ) {
tool->setDrawType( 0 );
tool->setSeedsVisibility(true);
}
void SegmentationWidget::on_drawButton_clicked( ) {
tool->setDrawType( 1 );
tool->setSeedsVisibility(true);
}
void SegmentationWidget::on_ClearButton_clicked( ) {
tool->clearSeeds( );
}
void SegmentationWidget::on_AlphaSpinBox_valueChanged( double arg1 ) {
tool->setAlpha( arg1 );
}
void SegmentationWidget::on_BetaSpinBox_valueChanged( double arg1 ) {
tool->setBeta( arg1 );
}
void SegmentationWidget::on_pushButtonShowSeeds_clicked(bool checked) {
tool->setSeedsVisibility(checked);
}
void SegmentationWidget::on_pushButtonShowMask_clicked(bool checked) {
tool->setMaskVisibility(checked);
}
void SegmentationWidget::on_thickDoubleSpinBox_valueChanged( double arg1 )
{
tool->setThickness( arg1 );
}