| 898 | } |
| 899 | |
| 900 | void QmitkMultiLabelInspector::RemoveGroup() |
| 901 | { |
| 902 | if (!m_AllowLabelModification) |
| 903 | mitkThrow() << "QmitkMultiLabelInspector is configured incorrectly. Set AllowLabelModification to true to allow the usage of RemoveLabel."; |
| 904 | |
| 905 | if (m_Segmentation.IsNull()) |
| 906 | return; |
| 907 | |
| 908 | if (m_Segmentation->GetNumberOfGroups() < 2) |
| 909 | { |
| 910 | QMessageBox::information(this, "Delete group", "Cannot delete last remaining group. A segmentation must contain at least a single group."); |
| 911 | return; |
| 912 | } |
| 913 | |
| 914 | const auto* selectedLabel = this->GetFirstSelectedLabelObject(); |
| 915 | |
| 916 | if (selectedLabel == nullptr) |
| 917 | return; |
| 918 | |
| 919 | const auto groupID = m_Segmentation->GetGroupIndexOfLabel(selectedLabel->GetValue()); |
| 920 | auto groupName = QString::fromStdString(mitk::LabelSetImageHelper::CreateDisplayGroupName(m_Segmentation, groupID)); |
| 921 | |
| 922 | auto question = QStringLiteral("Do you really want to delete group \"%1\" including all of its labels?").arg(groupName); |
| 923 | auto answer = QMessageBox::question(this, QString("Delete group \"%1\"").arg(groupName), question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); |
| 924 | |
| 925 | if (answer != QMessageBox::Yes) |
| 926 | return; |
| 927 | |
| 928 | this->RemoveGroupInternal(groupID); |
| 929 | } |
| 930 | |
| 931 | void QmitkMultiLabelInspector::OnDeleteGroup() |
| 932 | { |
no test coverage detected