| 1280 | } |
| 1281 | |
| 1282 | void QmitkMultiLabelInspector::OnClearLabels(bool /*value*/) |
| 1283 | { |
| 1284 | QString question = "Do you really want to clear the selected labels?"; |
| 1285 | |
| 1286 | QMessageBox::StandardButton answerButton = QMessageBox::question( |
| 1287 | this, "Clear selected labels", question, QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes); |
| 1288 | |
| 1289 | if (answerButton == QMessageBox::Yes) |
| 1290 | { |
| 1291 | this->WaitCursorOn(); |
| 1292 | |
| 1293 | auto labelValues = this->GetSelectedLabels(); |
| 1294 | mitk::SegGroupModifyUndoRedoHelper::GroupIndexSetType containingGroups; |
| 1295 | for (const auto label : labelValues) containingGroups.insert(m_Segmentation->GetGroupIndexOfLabel(label)); |
| 1296 | auto clearedLabelName = mitk::LabelSetImageHelper::CreateDisplayLabelName(m_Segmentation, m_Segmentation->GetLabel(labelValues.front())); |
| 1297 | mitk::SegGroupModifyUndoRedoHelper undoRedoGenerator(m_Segmentation, containingGroups, true, 0, true, false, true); |
| 1298 | |
| 1299 | m_Segmentation->EraseLabels(labelValues); |
| 1300 | |
| 1301 | std::ostringstream stream; |
| 1302 | stream << "Clear labels \"" << clearedLabelName << "\""; |
| 1303 | if (labelValues.size() > 1) |
| 1304 | { |
| 1305 | stream << "and " << labelValues.size() - 1 << "other labels"; |
| 1306 | } |
| 1307 | undoRedoGenerator.RegisterUndoRedoOperationEvent(stream.str()); |
| 1308 | |
| 1309 | this->WaitCursorOff(); |
| 1310 | // this is needed as workaround for (T27307). It circumvents the fact that modifications |
| 1311 | // of data (here the segmentation) does not directly trigger the modification of the |
| 1312 | // owning node (see T27307). Therefore other code (like renderers or model views) that e.g. |
| 1313 | // listens to the datastorage for modification would not get notified. |
| 1314 | if (m_SegmentationNode.IsNotNull()) |
| 1315 | { |
| 1316 | m_SegmentationNode->Modified(); |
| 1317 | mitk::RenderingManager::GetInstance()->RequestUpdateAll(); |
| 1318 | } |
| 1319 | } |
| 1320 | } |
| 1321 | |
| 1322 | void QmitkMultiLabelInspector::OnDeleteAffectedLabel() |
| 1323 | { |
nothing calls this directly
no test coverage detected