GUI for mitk::BinaryThresholdTool. More...
#include <QmitkBinaryThresholdToolGUI.h>


Public Types | |
| typedef QmitkBinaryThresholdToolGUI | Self |
| typedef QmitkToolGUI | Superclass |
| typedef itk::SmartPointer< Self > | Pointer |
| typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
| virtual const char * | GetClassName () const |
| void | OnThresholdingIntervalBordersChanged (int lower, int upper) |
| void | OnThresholdingValueChanged (int current) |
Static Public Member Functions | |
| static Pointer | New () |
Protected Slots | |
| void | OnNewToolAssociated (mitk::Tool *) |
| void | OnSliderValueChanged (int value) |
| void | OnAcceptThresholdPreview () |
| void | OnSpinnerValueChanged (int) |
Protected Member Functions | |
| QmitkBinaryThresholdToolGUI () | |
| virtual | ~QmitkBinaryThresholdToolGUI () |
Protected Attributes | |
| QSlider * | m_Slider |
| QSpinBox * | m_Spinner |
| mitk::BinaryThresholdTool::Pointer | m_BinaryThresholdTool |
GUI for mitk::BinaryThresholdTool.
This GUI shows a slider to change the tool's threshold and an OK button to accept a preview for actual thresholding.
Last contributor: $Author$
Definition at line 36 of file QmitkBinaryThresholdToolGUI.h.
| typedef itk::SmartPointer<const Self> QmitkBinaryThresholdToolGUI::ConstPointer |
Reimplemented from QmitkToolGUI.
Definition at line 42 of file QmitkBinaryThresholdToolGUI.h.
| typedef itk::SmartPointer<Self> QmitkBinaryThresholdToolGUI::Pointer |
Reimplemented from QmitkToolGUI.
Definition at line 42 of file QmitkBinaryThresholdToolGUI.h.
Reimplemented from QmitkToolGUI.
Definition at line 42 of file QmitkBinaryThresholdToolGUI.h.
Reimplemented from QmitkToolGUI.
Definition at line 42 of file QmitkBinaryThresholdToolGUI.h.
| QmitkBinaryThresholdToolGUI::QmitkBinaryThresholdToolGUI | ( | ) | [protected] |
Definition at line 28 of file QmitkBinaryThresholdToolGUI.cpp.
:QmitkToolGUI(), m_Slider(NULL), m_Spinner(NULL) { // create the visible widgets QBoxLayout* mainLayout = new QVBoxLayout(this); QLabel* label = new QLabel( "Threshold :", this ); QFont f = label->font(); f.setBold(false); label->setFont( f ); mainLayout->addWidget(label); QBoxLayout* layout = new QHBoxLayout(); m_Spinner = new QSpinBox(); m_Spinner->setMaximum(20); m_Spinner->setMinimum(5); m_Spinner->setValue(1); connect(m_Spinner, SIGNAL(valueChanged(int)), this, SLOT(OnSpinnerValueChanged(int)) ); layout->addWidget(m_Spinner); //m_Slider = new QSlider( 5, 20, 1, 1, Qt::Horizontal, this ); m_Slider = new QSlider( Qt::Horizontal, this ); m_Slider->setMinimum(5); m_Slider->setMaximum(20); m_Slider->setPageStep(1); m_Slider->setValue(1); connect( m_Slider, SIGNAL(valueChanged(int)), this, SLOT(OnSliderValueChanged(int))); layout->addWidget( m_Slider ); QPushButton* okButton = new QPushButton("Ok", this); connect( okButton, SIGNAL(clicked()), this, SLOT(OnAcceptThresholdPreview())); okButton->setFont( f ); layout->addWidget( okButton ); mainLayout->addLayout(layout); connect( this, SIGNAL(NewToolAssociated(mitk::Tool*)), this, SLOT(OnNewToolAssociated(mitk::Tool*)) ); }
| QmitkBinaryThresholdToolGUI::~QmitkBinaryThresholdToolGUI | ( | ) | [protected, virtual] |
Definition at line 72 of file QmitkBinaryThresholdToolGUI.cpp.
References m_BinaryThresholdTool, OnThresholdingIntervalBordersChanged(), and OnThresholdingValueChanged().
{
// !!!
if (m_BinaryThresholdTool.IsNotNull())
{
m_BinaryThresholdTool->IntervalBordersChanged -= mitk::MessageDelegate2<QmitkBinaryThresholdToolGUI, int, int>( this, &QmitkBinaryThresholdToolGUI::OnThresholdingIntervalBordersChanged );
m_BinaryThresholdTool->ThresholdingValueChanged -= mitk::MessageDelegate1<QmitkBinaryThresholdToolGUI, int>( this, &QmitkBinaryThresholdToolGUI::OnThresholdingValueChanged );
}
}
| virtual const char* QmitkBinaryThresholdToolGUI::GetClassName | ( | ) | const [virtual] |
Reimplemented from QmitkToolGUI.
| static Pointer QmitkBinaryThresholdToolGUI::New | ( | ) | [static] |
| void QmitkBinaryThresholdToolGUI::OnAcceptThresholdPreview | ( | ) | [protected, slot] |
Definition at line 108 of file QmitkBinaryThresholdToolGUI.cpp.
References QmitkNewSegmentationDialog::GetColor(), QmitkNewSegmentationDialog::GetSegmentationName(), m_BinaryThresholdTool, and QmitkNewSegmentationDialog::setPrompt().
{
if (m_BinaryThresholdTool.IsNotNull())
{
QmitkNewSegmentationDialog* dialog = new QmitkNewSegmentationDialog( this ); // needs a QWidget as parent, "this" is not QWidget
dialog->setPrompt("What did you just segment?");
int dialogReturnValue = dialog->exec();
std::string organName = dialog->GetSegmentationName().toStdString();
mitk::Color color = dialog->GetColor();
delete dialog;
if ( dialogReturnValue != QDialog::Rejected ) // user clicked cancel or pressed Esc or something similar
{
m_BinaryThresholdTool->AcceptCurrentThresholdValue( organName, color );
}
else
{
m_BinaryThresholdTool->CancelThresholding();
}
}
}
| void QmitkBinaryThresholdToolGUI::OnNewToolAssociated | ( | mitk::Tool * | tool ) | [protected, slot] |
Definition at line 83 of file QmitkBinaryThresholdToolGUI.cpp.
References m_BinaryThresholdTool, OnThresholdingIntervalBordersChanged(), and OnThresholdingValueChanged().
{
if (m_BinaryThresholdTool.IsNotNull())
{
m_BinaryThresholdTool->IntervalBordersChanged -= mitk::MessageDelegate2<QmitkBinaryThresholdToolGUI, int, int>( this, &QmitkBinaryThresholdToolGUI::OnThresholdingIntervalBordersChanged );
m_BinaryThresholdTool->ThresholdingValueChanged -= mitk::MessageDelegate1<QmitkBinaryThresholdToolGUI, int>( this, &QmitkBinaryThresholdToolGUI::OnThresholdingValueChanged );
}
m_BinaryThresholdTool = dynamic_cast<mitk::BinaryThresholdTool*>( tool );
if (m_BinaryThresholdTool.IsNotNull())
{
m_BinaryThresholdTool->IntervalBordersChanged += mitk::MessageDelegate2<QmitkBinaryThresholdToolGUI, int, int>( this, &QmitkBinaryThresholdToolGUI::OnThresholdingIntervalBordersChanged );
m_BinaryThresholdTool->ThresholdingValueChanged += mitk::MessageDelegate1<QmitkBinaryThresholdToolGUI, int>( this, &QmitkBinaryThresholdToolGUI::OnThresholdingValueChanged );
}
}
| void QmitkBinaryThresholdToolGUI::OnSliderValueChanged | ( | int | value ) | [protected, slot] |
Definition at line 100 of file QmitkBinaryThresholdToolGUI.cpp.
References m_BinaryThresholdTool, and m_Spinner.
{
if (m_BinaryThresholdTool.IsNotNull())
{
m_BinaryThresholdTool->SetThresholdValue( value );
}
m_Spinner->setValue(value);
}
| void QmitkBinaryThresholdToolGUI::OnSpinnerValueChanged | ( | int | value ) | [protected, slot] |
Definition at line 144 of file QmitkBinaryThresholdToolGUI.cpp.
References m_Slider.
{
m_Slider->setValue(value);
}
| void QmitkBinaryThresholdToolGUI::OnThresholdingIntervalBordersChanged | ( | int | lower, |
| int | upper | ||
| ) |
Definition at line 132 of file QmitkBinaryThresholdToolGUI.cpp.
References m_Slider, and m_Spinner.
Referenced by OnNewToolAssociated(), and ~QmitkBinaryThresholdToolGUI().
| void QmitkBinaryThresholdToolGUI::OnThresholdingValueChanged | ( | int | current ) |
Definition at line 138 of file QmitkBinaryThresholdToolGUI.cpp.
References m_Slider, and m_Spinner.
Referenced by OnNewToolAssociated(), and ~QmitkBinaryThresholdToolGUI().
Definition at line 67 of file QmitkBinaryThresholdToolGUI.h.
Referenced by OnAcceptThresholdPreview(), OnNewToolAssociated(), OnSliderValueChanged(), and ~QmitkBinaryThresholdToolGUI().
QSlider* QmitkBinaryThresholdToolGUI::m_Slider [protected] |
Definition at line 64 of file QmitkBinaryThresholdToolGUI.h.
Referenced by OnSpinnerValueChanged(), OnThresholdingIntervalBordersChanged(), and OnThresholdingValueChanged().
QSpinBox* QmitkBinaryThresholdToolGUI::m_Spinner [protected] |
Definition at line 65 of file QmitkBinaryThresholdToolGUI.h.
Referenced by OnSliderValueChanged(), OnThresholdingIntervalBordersChanged(), and OnThresholdingValueChanged().
1.7.2