| 929 | } |
| 930 | |
| 931 | void QmitkMultiLabelInspector::OnDeleteGroup() |
| 932 | { |
| 933 | if (!m_AllowLabelModification) |
| 934 | mitkThrow() << "QmitkMultiLabelInspector is configured incorrectly. Set AllowLabelModification to true to allow the usage of RemoveGroupInternal."; |
| 935 | |
| 936 | if (m_Segmentation.IsNull()) |
| 937 | return; |
| 938 | |
| 939 | auto currentIndex = this->m_Controls->view->currentIndex(); |
| 940 | auto groupIDVariant = currentIndex.data(QmitkMultiLabelTreeModel::ItemModelRole::GroupIDRole); |
| 941 | |
| 942 | if (groupIDVariant.isValid()) |
| 943 | { |
| 944 | auto groupID = groupIDVariant.value<mitk::MultiLabelSegmentation::GroupIndexType>(); |
| 945 | auto groupName = QString::fromStdString(mitk::LabelSetImageHelper::CreateDisplayGroupName(m_Segmentation, groupID)); |
| 946 | auto question = QStringLiteral("Do you really want to delete group \"%1\" including all of its labels?").arg(groupName); |
| 947 | auto answer = QMessageBox::question(this, QString("Delete group \"%1\"").arg(groupName), question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); |
| 948 | |
| 949 | if (answer != QMessageBox::Yes) |
| 950 | return; |
| 951 | |
| 952 | this->RemoveGroupInternal(groupID); |
| 953 | |
| 954 | // this is needed as workaround for (T27307). It circumvents the fact that modifications |
| 955 | // of data (here the segmentation) does not directly trigger the modification of the |
| 956 | // owning node (see T27307). Therefore other code (like renderers or model views) that e.g. |
| 957 | // listens to the datastorage for modification would not get notified. |
| 958 | if (m_SegmentationNode.IsNotNull()) |
| 959 | { |
| 960 | m_SegmentationNode->Modified(); |
| 961 | } |
| 962 | } |
| 963 | }; |
| 964 | |
| 965 | |
| 966 | void QmitkMultiLabelInspector::OnContextMenuRequested(const QPoint& /*pos*/) |