MCPcopy Create free account
hub / github.com/MITK/MITK / OnClearLabel

Method OnClearLabel

Modules/SegmentationUI/src/QmitkMultiLabelInspector.cpp:1485–1515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1483}
1484
1485void QmitkMultiLabelInspector::OnClearLabel(bool /*value*/)
1486{
1487 auto currentLabel = GetFirstSelectedLabelObject();
1488 QString question = "Do you really want to clear the contents of label \"" + QString::fromStdString(currentLabel->GetName())+"\"?";
1489
1490 QMessageBox::StandardButton answerButton =
1491 QMessageBox::question(this, "Clear label", question, QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes);
1492
1493 if (answerButton == QMessageBox::Yes)
1494 {
1495 this->WaitCursorOn();
1496
1497 mitk::SegGroupModifyUndoRedoHelper undoRedoGenerator(m_Segmentation, { m_Segmentation->GetGroupIndexOfLabel(currentLabel->GetValue()) }, true, 0, true, false, true);
1498
1499 m_Segmentation->EraseLabel(currentLabel->GetValue());
1500
1501 undoRedoGenerator.RegisterUndoRedoOperationEvent("Clear label \"" + mitk::LabelSetImageHelper::CreateDisplayLabelName(m_Segmentation, currentLabel) + "\"");
1502
1503 this->WaitCursorOff();
1504
1505 // this is needed as workaround for (T27307). It circumvents the fact that modifications
1506 // of data (here the segmentation) does not directly trigger the modification of the
1507 // owning node (see T27307). Therefore other code (like renderers or model views) that e.g.
1508 // listens to the datastorage for modification would not get notified.
1509 if (m_SegmentationNode.IsNotNull())
1510 {
1511 m_SegmentationNode->Modified();
1512 mitk::RenderingManager::GetInstance()->RequestUpdateAll();
1513 }
1514 }
1515}
1516
1517void QmitkMultiLabelInspector::OnRenameGroup()
1518{

Callers

nothing calls this directly

Calls 10

WaitCursorOnMethod · 0.95
WaitCursorOffMethod · 0.95
GetGroupIndexOfLabelMethod · 0.80
EraseLabelMethod · 0.80
IsNotNullMethod · 0.80
GetNameMethod · 0.45
GetValueMethod · 0.45
ModifiedMethod · 0.45
RequestUpdateAllMethod · 0.45

Tested by

no test coverage detected