MCPcopy Create free account
hub / github.com/MITK/MITK / DeleteLabel

Method DeleteLabel

Modules/SegmentationUI/src/QmitkMultiLabelInspector.cpp:691–727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689}
690
691void QmitkMultiLabelInspector::DeleteLabel()
692{
693 if (!m_AllowLabelModification)
694 mitkThrow() << "QmitkMultiLabelInspector is configured incorrectly. Set AllowLabelModification to true to allow the usage of DeleteLabel.";
695
696 if (m_Segmentation.IsNull())
697 return;
698
699 const auto label = this->GetFirstSelectedLabelObject();
700
701 if (nullptr == label)
702 return;
703
704 const auto relevantLabels = this->GetLabelInstancesOfSelectedFirstLabel();
705
706 if (relevantLabels.empty())
707 return;
708
709 auto question = "Do you really want to delete label \"" + QString::fromStdString(label->GetName());
710 question = relevantLabels.size()==1 ? question + "\"?" : question + "\" with all "+QString::number(relevantLabels.size()) +" instances?";
711
712 auto answer = QMessageBox::question(this, QString("Delete label"), question, QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes);
713
714 if (answer == QMessageBox::Yes)
715 {
716 this->DeleteLabelInternal(relevantLabels);
717
718 // this is needed as workaround for (T27307). It circumvents the fact that modifications
719 // of data (here the segmentation) does not directly trigger the modification of the
720 // owning node (see T27307). Therefore other code (like renderers or model views) that e.g.
721 // listens to the datastorage for modification would not get notified.
722 if (m_SegmentationNode.IsNotNull())
723 {
724 m_SegmentationNode->Modified();
725 }
726 }
727}
728
729void QmitkMultiLabelInspector::DeleteLabelInternal(const LabelValueVectorType& labelValues)
730{

Callers

nothing calls this directly

Calls 10

DeleteLabelInternalMethod · 0.95
IsNotNullMethod · 0.80
QStringClass · 0.50
IsNullMethod · 0.45
emptyMethod · 0.45
GetNameMethod · 0.45
sizeMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected