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

Method RemoveGroup

Modules/SegmentationUI/src/QmitkMultiLabelInspector.cpp:900–929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

898}
899
900void QmitkMultiLabelInspector::RemoveGroup()
901{
902 if (!m_AllowLabelModification)
903 mitkThrow() << "QmitkMultiLabelInspector is configured incorrectly. Set AllowLabelModification to true to allow the usage of RemoveLabel.";
904
905 if (m_Segmentation.IsNull())
906 return;
907
908 if (m_Segmentation->GetNumberOfGroups() < 2)
909 {
910 QMessageBox::information(this, "Delete group", "Cannot delete last remaining group. A segmentation must contain at least a single group.");
911 return;
912 }
913
914 const auto* selectedLabel = this->GetFirstSelectedLabelObject();
915
916 if (selectedLabel == nullptr)
917 return;
918
919 const auto groupID = m_Segmentation->GetGroupIndexOfLabel(selectedLabel->GetValue());
920 auto groupName = QString::fromStdString(mitk::LabelSetImageHelper::CreateDisplayGroupName(m_Segmentation, groupID));
921
922 auto question = QStringLiteral("Do you really want to delete group \"%1\" including all of its labels?").arg(groupName);
923 auto answer = QMessageBox::question(this, QString("Delete group \"%1\"").arg(groupName), question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
924
925 if (answer != QMessageBox::Yes)
926 return;
927
928 this->RemoveGroupInternal(groupID);
929}
930
931void QmitkMultiLabelInspector::OnDeleteGroup()
932{

Callers 3

RemovingLayerTestMethod · 0.45
RemoveGroupInternalMethod · 0.45
ApplyGroupRemoveFunction · 0.45

Calls 7

RemoveGroupInternalMethod · 0.95
GetNumberOfGroupsMethod · 0.80
GetGroupIndexOfLabelMethod · 0.80
QStringClass · 0.50
IsNullMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected