| 689 | } |
| 690 | |
| 691 | void 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 | |
| 729 | void QmitkMultiLabelInspector::DeleteLabelInternal(const LabelValueVectorType& labelValues) |
| 730 | { |
nothing calls this directly
no test coverage detected