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

Method OnDeleteAffectedLabel

Modules/SegmentationUI/src/QmitkMultiLabelInspector.cpp:1322–1359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1320}
1321
1322void QmitkMultiLabelInspector::OnDeleteAffectedLabel()
1323{
1324 if (!m_AllowLabelModification)
1325 mitkThrow() << "QmitkMultiLabelInspector is configured incorrectly. Set AllowLabelModification to true to allow the usage of RemoveLabel.";
1326
1327 if (m_Segmentation.IsNull())
1328 {
1329 return;
1330 }
1331
1332 auto affectedLabels = GetCurrentlyAffactedLabelInstances();
1333 auto currentLabel = m_Segmentation->GetLabel(affectedLabels.front());
1334
1335 if (currentLabel.IsNull())
1336 {
1337 MITK_WARN << "Ignore operation. Try to delete non-existing label. Invalid ID: " << affectedLabels.front();
1338 return;
1339 }
1340
1341 QString question = "Do you really want to delete all instances of label \"" + QString::fromStdString(currentLabel->GetName()) + "\"?";
1342
1343 QMessageBox::StandardButton answerButton =
1344 QMessageBox::question(this, "Delete label", question, QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes);
1345
1346 if (answerButton == QMessageBox::Yes)
1347 {
1348 this->DeleteLabelInternal(affectedLabels);
1349
1350 // this is needed as workaround for (T27307). It circumvents the fact that modifications
1351 // of data (here the segmentation) does not directly trigger the modification of the
1352 // owning node (see T27307). Therefore other code (like renderers or model views) that e.g.
1353 // listens to the datastorage for modification would not get notified.
1354 if (m_SegmentationNode.IsNotNull())
1355 {
1356 m_SegmentationNode->Modified();
1357 }
1358 }
1359}
1360
1361void QmitkMultiLabelInspector::OnDeleteLabels(bool /*value*/)
1362{

Callers

nothing calls this directly

Calls 7

DeleteLabelInternalMethod · 0.95
frontMethod · 0.80
IsNotNullMethod · 0.80
IsNullMethod · 0.45
GetLabelMethod · 0.45
GetNameMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected