| 1359 | } |
| 1360 | |
| 1361 | void QmitkMultiLabelInspector::OnDeleteLabels(bool /*value*/) |
| 1362 | { |
| 1363 | QString question = "Do you really want to remove the selected labels?"; |
| 1364 | QMessageBox::StandardButton answerButton = QMessageBox::question( |
| 1365 | this, "Remove selected labels", question, QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes); |
| 1366 | |
| 1367 | if (answerButton == QMessageBox::Yes) |
| 1368 | { |
| 1369 | auto labelValues = this->GetSelectedLabels(); |
| 1370 | |
| 1371 | if (labelValues.empty()) return; |
| 1372 | |
| 1373 | this->WaitCursorOn(); |
| 1374 | |
| 1375 | mitk::SegGroupModifyUndoRedoHelper::GroupIndexSetType containingGroups; |
| 1376 | for (const auto label : labelValues) containingGroups.insert(m_Segmentation->GetGroupIndexOfLabel(label)); |
| 1377 | auto deletedLabelName = mitk::LabelSetImageHelper::CreateDisplayLabelName(m_Segmentation, m_Segmentation->GetLabel(labelValues.front())); |
| 1378 | mitk::SegGroupModifyUndoRedoHelper undoRedoGenerator(m_Segmentation, containingGroups, true); |
| 1379 | |
| 1380 | m_Segmentation->RemoveLabels(this->GetSelectedLabels()); |
| 1381 | |
| 1382 | std::ostringstream stream; |
| 1383 | stream << "Remove labels \"" << deletedLabelName << "\""; |
| 1384 | if (labelValues.size() > 1) |
| 1385 | { |
| 1386 | stream << "and " << labelValues.size() - 1 << "other labels"; |
| 1387 | } |
| 1388 | undoRedoGenerator.RegisterUndoRedoOperationEvent(stream.str()); |
| 1389 | |
| 1390 | this->WaitCursorOff(); |
| 1391 | |
| 1392 | // this is needed as workaround for (T27307). It circumvents the fact that modifications |
| 1393 | // of data (here the segmentation) does not directly trigger the modification of the |
| 1394 | // owning node (see T27307). Therefore other code (like renderers or model views) that e.g. |
| 1395 | // listens to the datastorage for modification would not get notified. |
| 1396 | if (m_SegmentationNode.IsNotNull()) |
| 1397 | { |
| 1398 | m_SegmentationNode->Modified(); |
| 1399 | } |
| 1400 | } |
| 1401 | } |
| 1402 | |
| 1403 | void QmitkMultiLabelInspector::OnMergeLabels(bool /*value*/) |
| 1404 | { |
nothing calls this directly
no test coverage detected