Public Types | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes

QmitkBinaryThresholdToolGUI Class Reference

GUI for mitk::BinaryThresholdTool. More...

#include <QmitkBinaryThresholdToolGUI.h>

Inheritance diagram for QmitkBinaryThresholdToolGUI:
Inheritance graph
[legend]
Collaboration diagram for QmitkBinaryThresholdToolGUI:
Collaboration graph
[legend]

List of all members.

Public Types

typedef QmitkBinaryThresholdToolGUI Self
typedef QmitkToolGUI Superclass
typedef itk::SmartPointer< SelfPointer
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

Detailed Description

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.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

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]

Member Function Documentation

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]
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().

{
  m_Slider->setRange(lower, upper);
  m_Spinner->setRange(lower, upper);
}
void QmitkBinaryThresholdToolGUI::OnThresholdingValueChanged ( int  current )

Definition at line 138 of file QmitkBinaryThresholdToolGUI.cpp.

References m_Slider, and m_Spinner.

Referenced by OnNewToolAssociated(), and ~QmitkBinaryThresholdToolGUI().

{
  m_Slider->setValue(current);
  m_Spinner->setValue(current);
}

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines