| 655 | } |
| 656 | |
| 657 | void 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 | |
| 691 | void QmitkMultiLabelInspector::DeleteLabel() |
| 692 | { |
nothing calls this directly
no test coverage detected