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

Method DeleteLabelInstance

Modules/SegmentationUI/src/QmitkMultiLabelInspector.cpp:657–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

655}
656
657void QmitkMultiLabelInspector::DeleteLabelInstance()
658{
659 if (!m_AllowLabelModification)
660 mitkThrow() << "QmitkMultiLabelInspector is configured incorrectly. Set AllowLabelModification to true to allow the usage of DeleteLabelInstance.";
661
662 if (m_Segmentation.IsNull())
663 return;
664
665 auto label = this->GetFirstSelectedLabelObject();
666
667 if (nullptr == label)
668 return;
669
670 auto index = m_Model->indexOfLabel(label->GetValue());
671 auto instanceName = index.data(Qt::DisplayRole);
672
673 auto question = "Do you really want to delete label instance \"" + instanceName.toString() + "\"?";
674 auto answer = QMessageBox::question(this, QString("Delete label instances"), question, QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes);
675
676 if (answer == QMessageBox::Yes)
677 {
678 this->DeleteLabelInternal({ label->GetValue() });
679
680 // this is needed as workaround for (T27307). It circumvents the fact that modifications
681 // of data (here the segmentation) does not directly trigger the modification of the
682 // owning node (see T27307). Therefore other code (like renderers or model views) that e.g.
683 // listens to the datastorage for modification would not get notified.
684 if (m_SegmentationNode.IsNotNull())
685 {
686 m_SegmentationNode->Modified();
687 }
688 }
689}
690
691void QmitkMultiLabelInspector::DeleteLabel()
692{

Callers

nothing calls this directly

Calls 10

DeleteLabelInternalMethod · 0.95
indexOfLabelMethod · 0.80
IsNotNullMethod · 0.80
QStringClass · 0.50
IsNullMethod · 0.45
GetValueMethod · 0.45
dataMethod · 0.45
toStringMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected