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

QmitkBinaryThresholdULToolGUI Class Reference

GUI for mitk::BinaryThresholdTool. More...

#include <QmitkBinaryThresholdULToolGUI.h>

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

List of all members.

Public Types

typedef
QmitkBinaryThresholdULToolGUI 
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 OnThresholdingValuesChanged (int lower, int upper)

Static Public Member Functions

static Pointer New ()

Protected Slots

void OnNewToolAssociated (mitk::Tool *)
void OnSpanChanged (int lower, int upper)
void OnAcceptThresholdPreview ()
void OnUpperSpinnerChanged (int)
void OnLowerSpinnerChanged (int)

Protected Member Functions

 QmitkBinaryThresholdULToolGUI ()
virtual ~QmitkBinaryThresholdULToolGUI ()

Protected Attributes

QxtSpanSliderm_RangeSlider
QSpinBox * m_LowerSpinner
QSpinBox * m_UpperSpinner
mitk::BinaryThresholdULTool::Pointer m_BinaryThresholdULTool

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 QmitkBinaryThresholdULToolGUI.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> QmitkBinaryThresholdULToolGUI::ConstPointer

Reimplemented from QmitkToolGUI.

Definition at line 42 of file QmitkBinaryThresholdULToolGUI.h.

typedef itk::SmartPointer<Self> QmitkBinaryThresholdULToolGUI::Pointer

Reimplemented from QmitkToolGUI.

Definition at line 42 of file QmitkBinaryThresholdULToolGUI.h.

Reimplemented from QmitkToolGUI.

Definition at line 42 of file QmitkBinaryThresholdULToolGUI.h.

Reimplemented from QmitkToolGUI.

Definition at line 42 of file QmitkBinaryThresholdULToolGUI.h.


Constructor & Destructor Documentation

QmitkBinaryThresholdULToolGUI::QmitkBinaryThresholdULToolGUI (  ) [protected]

Definition at line 28 of file QmitkBinaryThresholdULToolGUI.cpp.

References QxtSpanSlider::NoOverlapping.

:QmitkToolGUI(),
m_RangeSlider(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_LowerSpinner = new QSpinBox();
  m_LowerSpinner->setMinimum(-2048);
  m_LowerSpinner->setMaximum(0);
  m_LowerSpinner->setValue(-2048);
  connect(m_LowerSpinner, SIGNAL(valueChanged(int)), this, SLOT(OnLowerSpinnerChanged(int)) );

  m_RangeSlider = new QxtSpanSlider(Qt::Horizontal, this );
  m_RangeSlider->setMaximum(2048);
  m_RangeSlider->setMinimum(-2048);
  m_RangeSlider->setHandleMovementMode(QxtSpanSlider::NoOverlapping);

  m_UpperSpinner = new QSpinBox();
  m_UpperSpinner->setMinimum(0);
  m_UpperSpinner->setMaximum(2048);
  m_UpperSpinner->setValue(2048);

  connect(m_UpperSpinner, SIGNAL(valueChanged(int)), this, SLOT(OnUpperSpinnerChanged(int)) );
  connect(m_RangeSlider, SIGNAL(spanChanged(int, int)  ),this, SLOT( OnSpanChanged(int , int ) ));

  layout->addWidget(m_LowerSpinner);
  layout->addWidget(m_RangeSlider);
  layout->addWidget(m_UpperSpinner);

  mainLayout->addLayout(layout);

  QPushButton* okButton = new QPushButton("Ok", this);
  connect( okButton, SIGNAL(clicked()), this, SLOT(OnAcceptThresholdPreview()));
  okButton->setFont( f );
  mainLayout->addWidget( okButton );

  connect( this, SIGNAL(NewToolAssociated(mitk::Tool*)), this, SLOT(OnNewToolAssociated(mitk::Tool*)) );
}
QmitkBinaryThresholdULToolGUI::~QmitkBinaryThresholdULToolGUI (  ) [protected, virtual]

Member Function Documentation

virtual const char* QmitkBinaryThresholdULToolGUI::GetClassName (  ) const [virtual]

Reimplemented from QmitkToolGUI.

static Pointer QmitkBinaryThresholdULToolGUI::New (  ) [static]
void QmitkBinaryThresholdULToolGUI::OnAcceptThresholdPreview (  ) [protected, slot]

Definition at line 104 of file QmitkBinaryThresholdULToolGUI.cpp.

References QmitkNewSegmentationDialog::GetColor(), QmitkNewSegmentationDialog::GetSegmentationName(), m_BinaryThresholdULTool, and QmitkNewSegmentationDialog::setPrompt().

{
  if (m_BinaryThresholdULTool.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().toLocal8Bit().data();
    mitk::Color color     = dialog->GetColor();

    delete dialog;

    if ( dialogReturnValue != QDialog::Rejected ) // user clicked cancel or pressed Esc or something similar
    {
      m_BinaryThresholdULTool->AcceptCurrentThresholdValue( organName, color );
    }
    else
    {
      m_BinaryThresholdULTool->CancelThresholding();
    }
  }
}
void QmitkBinaryThresholdULToolGUI::OnLowerSpinnerChanged ( int  value ) [protected, slot]
void QmitkBinaryThresholdULToolGUI::OnNewToolAssociated ( mitk::Tool tool ) [protected, slot]
void QmitkBinaryThresholdULToolGUI::OnSpanChanged ( int  lower,
int  upper 
) [protected, slot]

Definition at line 145 of file QmitkBinaryThresholdULToolGUI.cpp.

References m_BinaryThresholdULTool, m_LowerSpinner, and m_UpperSpinner.

{
  if (upper < lower)
  {
    int tmp = upper;
    upper = lower;
    lower = tmp;
  }

  if (m_BinaryThresholdULTool.IsNotNull())
  {
    m_BinaryThresholdULTool->SetThresholdValues(lower, upper);
  }
  if (m_LowerSpinner->value() != lower)
    m_LowerSpinner->setValue(lower);
  if (m_UpperSpinner->value() != upper)
    m_UpperSpinner->setValue(upper);
}
void QmitkBinaryThresholdULToolGUI::OnThresholdingIntervalBordersChanged ( int  lower,
int  upper 
)

Definition at line 128 of file QmitkBinaryThresholdULToolGUI.cpp.

References m_LowerSpinner, m_RangeSlider, and m_UpperSpinner.

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

{
  m_RangeSlider->setMaximum(upper);
  m_RangeSlider->setMinimum(lower);
  m_LowerSpinner->setMaximum(upper);
  m_LowerSpinner->setMinimum(lower);
  m_UpperSpinner->setMaximum(upper);
  m_UpperSpinner->setMinimum(lower);
}
void QmitkBinaryThresholdULToolGUI::OnThresholdingValuesChanged ( int  lower,
int  upper 
)

Definition at line 138 of file QmitkBinaryThresholdULToolGUI.cpp.

References m_LowerSpinner, m_RangeSlider, m_UpperSpinner, and QxtSpanSlider::setSpan().

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

{
  m_RangeSlider->setSpan(lower, upper);
  m_LowerSpinner->setValue(lower);
  m_UpperSpinner->setValue(upper);
}
void QmitkBinaryThresholdULToolGUI::OnUpperSpinnerChanged ( int  value ) [protected, slot]

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