Dialog for QmitkInteractiveSegmentation. More...
#include <QmitkNewSegmentationDialog.h>
Public Slots | |
void | setPrompt (const QString &prompt) |
void | setSegmentationName (const QString &name) |
Public Member Functions | |
QmitkNewSegmentationDialog (QWidget *parent=0) | |
virtual | ~QmitkNewSegmentationDialog () |
const QString | GetSegmentationName () |
const char * | GetOrganType () |
mitk::Color | GetColor () |
void | SetSuggestionList (QStringList organColorList) |
Protected Slots | |
void | onAcceptClicked () |
void | onNewOrganNameChanged (const QString &) |
void | onColorBtnClicked () |
void | onColorChange (const QString &completedWord) |
Protected Attributes | |
QLabel * | lblPrompt |
Q3ListBox * | lstOrgans |
QLineEdit * | edtName |
QPushButton * | btnColor |
QPushButton * | btnOk |
QLineEdit * | edtNewOrgan |
QString | selectedOrgan |
bool | newOrganEntry |
QColor | m_Color |
QCompleter * | completer |
QString | m_SegmentationName |
QStringList | organList |
QList< QColor > | colorList |
Dialog for QmitkInteractiveSegmentation.
This dialog is used to ask a user about the type of a newly created segmentation and a name for it.
Last contribution by
.
Definition at line 47 of file QmitkNewSegmentationDialog.h.
QmitkNewSegmentationDialog::QmitkNewSegmentationDialog | ( | QWidget * | parent = 0 ) |
Definition at line 34 of file QmitkNewSegmentationDialog.cpp.
References btnColor, btnOk, completer, edtName, lblPrompt, mitk::OrganTypeProperty::New(), onAcceptClicked(), onColorBtnClicked(), and onColorChange().
:QDialog(parent), // true, modal selectedOrgan("undefined"), newOrganEntry(false) { QDialog::setFixedSize(250, 105); QBoxLayout * verticalLayout = new QVBoxLayout( this ); verticalLayout->setMargin(5); verticalLayout->setSpacing(5); mitk::OrganTypeProperty::Pointer organTypes = mitk::OrganTypeProperty::New(); // to enter a name for the segmentation lblPrompt = new QLabel( "Name and color of the segmentation", this ); verticalLayout->addWidget( lblPrompt ); // to choose a color btnColor = new QPushButton( "", this ); btnColor->setFixedWidth(25); btnColor->setAutoFillBackground(true); btnColor->setStyleSheet("background-color:rgb(255,0,0)"); connect( btnColor, SIGNAL(clicked()), this, SLOT(onColorBtnClicked()) ); edtName = new QLineEdit( "", this ); QStringList completionList; completionList << ""; completer = new QCompleter(completionList); completer->setCaseSensitivity(Qt::CaseInsensitive); edtName->setCompleter(completer); connect( completer, SIGNAL(activated(const QString&)), this, SLOT(onColorChange(const QString&)) ); QBoxLayout * horizontalLayout2 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout2); horizontalLayout2->addWidget( btnColor ); horizontalLayout2->addWidget( edtName ); //buttons for closing the dialog btnOk = new QPushButton( tr("Ok"), this ); btnOk->setDefault(true); connect( btnOk, SIGNAL(clicked()), this, SLOT(onAcceptClicked()) ); QPushButton* btnCancel = new QPushButton( tr("Cancel"), this ); connect( btnCancel, SIGNAL(clicked()), this, SLOT(reject()) ); QBoxLayout * horizontalLayout = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout); horizontalLayout->setSpacing(5); horizontalLayout->addStretch(); horizontalLayout->addWidget( btnOk ); horizontalLayout->addWidget( btnCancel ); edtName->setFocus(); }
QmitkNewSegmentationDialog::~QmitkNewSegmentationDialog | ( | ) | [virtual] |
Definition at line 93 of file QmitkNewSegmentationDialog.cpp.
{ }
mitk::Color QmitkNewSegmentationDialog::GetColor | ( | ) |
Definition at line 149 of file QmitkNewSegmentationDialog.cpp.
References m_Color.
Referenced by QmitkSegmentationView::CreateNewSegmentation(), QmitkMorphologicToolGUI::OnAcceptPreview(), QmitkBinaryThresholdULToolGUI::OnAcceptThresholdPreview(), and QmitkBinaryThresholdToolGUI::OnAcceptThresholdPreview().
{ mitk::Color colorProperty; if (m_Color.spec() == 0) { colorProperty.SetRed(1); colorProperty.SetGreen(0); colorProperty.SetBlue(0); } else { colorProperty.SetRed(m_Color.redF()); colorProperty.SetGreen(m_Color.greenF()); colorProperty.SetBlue(m_Color.blueF()); } return colorProperty; }
const char * QmitkNewSegmentationDialog::GetOrganType | ( | ) |
Definition at line 108 of file QmitkNewSegmentationDialog.cpp.
References selectedOrgan.
{ return selectedOrgan.toLocal8Bit().constData(); }
const QString QmitkNewSegmentationDialog::GetSegmentationName | ( | ) |
Definition at line 103 of file QmitkNewSegmentationDialog.cpp.
References m_SegmentationName.
Referenced by QmitkSegmentationView::CreateNewSegmentation(), QmitkMorphologicToolGUI::OnAcceptPreview(), QmitkBinaryThresholdULToolGUI::OnAcceptThresholdPreview(), and QmitkBinaryThresholdToolGUI::OnAcceptThresholdPreview().
{ return m_SegmentationName; }
void QmitkNewSegmentationDialog::onAcceptClicked | ( | ) | [protected, slot] |
Definition at line 97 of file QmitkNewSegmentationDialog.cpp.
References edtName, and m_SegmentationName.
Referenced by QmitkNewSegmentationDialog().
{ m_SegmentationName = edtName->text(); this->accept(); }
void QmitkNewSegmentationDialog::onColorBtnClicked | ( | ) | [protected, slot] |
Definition at line 126 of file QmitkNewSegmentationDialog.cpp.
References btnColor, and m_Color.
Referenced by QmitkNewSegmentationDialog().
void QmitkNewSegmentationDialog::onColorChange | ( | const QString & | completedWord ) | [protected, slot] |
Definition at line 185 of file QmitkNewSegmentationDialog.cpp.
References btnColor, colorList, m_Color, and organList.
Referenced by QmitkNewSegmentationDialog().
void QmitkNewSegmentationDialog::onNewOrganNameChanged | ( | const QString & | newText ) | [protected, slot] |
Definition at line 114 of file QmitkNewSegmentationDialog.cpp.
References btnOk, selectedOrgan, and setSegmentationName().
{ if (!newText.isEmpty()) { btnOk->setEnabled( true ); } selectedOrgan = newText; this->setSegmentationName( newText ); }
void QmitkNewSegmentationDialog::setPrompt | ( | const QString & | prompt ) | [slot] |
Definition at line 138 of file QmitkNewSegmentationDialog.cpp.
References lblPrompt.
Referenced by QmitkMorphologicToolGUI::OnAcceptPreview(), QmitkBinaryThresholdULToolGUI::OnAcceptThresholdPreview(), and QmitkBinaryThresholdToolGUI::OnAcceptThresholdPreview().
{ lblPrompt->setText( prompt ); }
void QmitkNewSegmentationDialog::setSegmentationName | ( | const QString & | name ) | [slot] |
Definition at line 143 of file QmitkNewSegmentationDialog.cpp.
References edtName, and m_SegmentationName.
Referenced by onNewOrganNameChanged().
{ edtName->setText( name ); m_SegmentationName = name; }
void QmitkNewSegmentationDialog::SetSuggestionList | ( | QStringList | organColorList ) |
Definition at line 167 of file QmitkNewSegmentationDialog.cpp.
References colorList, completer, and organList.
Referenced by QmitkSegmentationView::CreateNewSegmentation().
{ QStringList::iterator iter; for (iter = organColorList.begin(); iter != organColorList.end(); ++iter) { QString& element = *iter; QString colorName = element.right(7); QColor color(colorName); QString organName = element.left(element.size() - 7); organList.push_back(organName); colorList.push_back(color); } QStringListModel* completeModel = static_cast<QStringListModel*> (completer->model()); completeModel->setStringList(organList); }
QPushButton* QmitkNewSegmentationDialog::btnColor [protected] |
Definition at line 83 of file QmitkNewSegmentationDialog.h.
Referenced by onColorBtnClicked(), onColorChange(), and QmitkNewSegmentationDialog().
QPushButton* QmitkNewSegmentationDialog::btnOk [protected] |
Definition at line 84 of file QmitkNewSegmentationDialog.h.
Referenced by onNewOrganNameChanged(), and QmitkNewSegmentationDialog().
QList<QColor> QmitkNewSegmentationDialog::colorList [protected] |
Definition at line 99 of file QmitkNewSegmentationDialog.h.
Referenced by onColorChange(), and SetSuggestionList().
QCompleter* QmitkNewSegmentationDialog::completer [protected] |
Definition at line 94 of file QmitkNewSegmentationDialog.h.
Referenced by QmitkNewSegmentationDialog(), and SetSuggestionList().
QLineEdit* QmitkNewSegmentationDialog::edtName [protected] |
Definition at line 81 of file QmitkNewSegmentationDialog.h.
Referenced by onAcceptClicked(), QmitkNewSegmentationDialog(), and setSegmentationName().
QLineEdit* QmitkNewSegmentationDialog::edtNewOrgan [protected] |
Definition at line 86 of file QmitkNewSegmentationDialog.h.
QLabel* QmitkNewSegmentationDialog::lblPrompt [protected] |
Definition at line 79 of file QmitkNewSegmentationDialog.h.
Referenced by QmitkNewSegmentationDialog(), and setPrompt().
Q3ListBox* QmitkNewSegmentationDialog::lstOrgans [protected] |
Definition at line 80 of file QmitkNewSegmentationDialog.h.
QColor QmitkNewSegmentationDialog::m_Color [protected] |
Definition at line 92 of file QmitkNewSegmentationDialog.h.
Referenced by GetColor(), onColorBtnClicked(), and onColorChange().
QString QmitkNewSegmentationDialog::m_SegmentationName [protected] |
Definition at line 96 of file QmitkNewSegmentationDialog.h.
Referenced by GetSegmentationName(), onAcceptClicked(), and setSegmentationName().
bool QmitkNewSegmentationDialog::newOrganEntry [protected] |
Definition at line 90 of file QmitkNewSegmentationDialog.h.
QStringList QmitkNewSegmentationDialog::organList [protected] |
Definition at line 98 of file QmitkNewSegmentationDialog.h.
Referenced by onColorChange(), and SetSuggestionList().
QString QmitkNewSegmentationDialog::selectedOrgan [protected] |
Definition at line 88 of file QmitkNewSegmentationDialog.h.
Referenced by GetOrganType(), and onNewOrganNameChanged().