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

Method AddLabelWithContent

Modules/Multilabel/src/mitkLabelSetImage.cpp:975–990  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

973}
974
975mitk::Label* mitk::MultiLabelSegmentation::AddLabelWithContent(Label* label, const Image* labelContent, GroupIndexType groupID, LabelValueType contentLabelValue, bool addAsClone, bool correctLabelValue)
976{
977 if (nullptr == labelContent) mitkThrow() << "Invalid use of AddLabel. labelContent is not valid.";
978 if (!Equal(*(this->GetTimeGeometry()), *(labelContent->GetTimeGeometry()), mitk::NODE_PREDICATE_GEOMETRY_DEFAULT_CHECK_COORDINATE_PRECISION, mitk::NODE_PREDICATE_GEOMETRY_DEFAULT_CHECK_DIRECTION_PRECISION))
979 mitkThrow() << "Invalid use of AddLabel. labelContent has not the same geometry like the segmentation.";
980
981 auto newLabel = this->AddLabel(label, groupID, addAsClone, correctLabelValue);
982
983 mitk::TransferLabelContent(labelContent, this->GetGroupImage(groupID), this->GetConstLabelsByValue(this->GetLabelValuesByGroup(groupID)),
984 mitk::MultiLabelSegmentation::UNLABELED_VALUE, mitk::MultiLabelSegmentation::UNLABELED_VALUE, false, { {contentLabelValue, newLabel->GetValue()}},
985 mitk::MultiLabelSegmentation::MergeStyle::Replace, mitk::MultiLabelSegmentation::OverwriteStyle::RegardLocks);
986
987 this->Modified();
988
989 return newLabel;
990}
991
992mitk::Label* mitk::MultiLabelSegmentation::AddLabel(const std::string& name, const mitk::Color& color, GroupIndexType groupID)
993{

Callers 2

SaveResultLabelMaskMethod · 0.80
SaveResultLabelMaskMethod · 0.80

Calls 7

AddLabelMethod · 0.95
GetGroupImageMethod · 0.95
GetConstLabelsByValueMethod · 0.95
GetLabelValuesByGroupMethod · 0.95
EqualFunction · 0.50
GetValueMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected