Biomedical Image Analysis Library
The Biomedical Image Analysis Library is a poweful tool for developers, physicians, researchers, engineers, and so on.
segmentationwidget.cpp
Go to the documentation of this file.
1 #include "segmentationwidget.h"
2 #include "ui_segmentationwidget.h"
3 
4 #include <QMessageBox>
5 
6 SegmentationWidget::SegmentationWidget( QWidget *parent ) : QWidget( parent ), ui( new Ui::Segmentationwidget ) {
7  ui->setupUi( this );
8 }
9 
11  delete ui;
12 }
13 
15  tool = dynamic_cast< SegmentationTool* >( sTool );
16  if( tool ) {
17 
18  setEnabled( true );
19  /* atualiza os dados da interface */
20  ui->BetaSpinBox->setValue( tool->getBeta( ) );
21  ui->AlphaSpinBox->setValue( tool->getAlpha( ) );
22  ui->pushButtonShowSeeds->setChecked( tool->getSeedsVisible( ) );
23  ui->pushButtonShowMask->setChecked( tool->getMaskVisible( ) );
24  switch( tool->getDrawType( ) ) {
25  case 0:
26  ui->eraserButton->setChecked( true );
27  break;
28  case 1:
29  case 2:
30  ui->drawButton->setChecked( true );
31  break;
32  }
33  }
34  else {
35  setEnabled( false );
36  }
37 }
38 
39 void SegmentationWidget::on_SegmentationButton_clicked( ) {
40  double alpha = ui->AlphaSpinBox->value( );
41  double beta = ui->BetaSpinBox->value( );
42  try {
43  tool->segmentationOGS( alpha, beta );
44  }
45  catch( std::runtime_error err ) {
46  QMessageBox::warning( this, "ERROR", err.what( ) );
47  }
48 }
49 
50 void SegmentationWidget::on_eraserButton_clicked( ) {
51  tool->setDrawType( 0 );
52  tool->setSeedsVisibility( true );
53 }
54 
55 void SegmentationWidget::on_drawButton_clicked( ) {
56  tool->setDrawType( 1 );
57  tool->setSeedsVisibility( true );
58 }
59 
60 void SegmentationWidget::on_ClearButton_clicked( ) {
61  tool->clearSeeds( );
62 }
63 
64 void SegmentationWidget::on_AlphaSpinBox_valueChanged( double arg1 ) {
65  tool->setAlpha( arg1 );
66 }
67 
68 void SegmentationWidget::on_BetaSpinBox_valueChanged( double arg1 ) {
69  tool->setBeta( arg1 );
70 }
71 
72 void SegmentationWidget::on_pushButtonShowSeeds_clicked( bool checked ) {
73  tool->setSeedsVisibility( checked );
74 }
75 
76 void SegmentationWidget::on_pushButtonShowMask_clicked( bool checked ) {
77  tool->setMaskVisibility( checked );
78 }
79 
80 void SegmentationWidget::on_thickDoubleSpinBox_valueChanged( double arg1 ) {
81  tool->setThickness( arg1 );
82 }
void setBeta(double value)
int getDrawType() const
Definition: tool.h:10
void setSeedsVisibility(bool vis)
void setDrawType(int type)
double getBeta() const
void setTool(Tool *sTool)
void setAlpha(double value)
Bial::Image< int > segmentationOGS(double alpha, double beta)
SegmentationWidget(QWidget *parent=0)
bool getMaskVisible() const
bool getSeedsVisible() const
void setThickness(int value)
double getAlpha() const
void setMaskVisibility(bool vis)