本文整理汇总了C++中mitk::labelsetimage::Pointer::GetLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetLabel方法的具体用法?C++ Pointer::GetLabel怎么用?C++ Pointer::GetLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::labelsetimage::Pointer
的用法示例。
在下文中一共展示了Pointer::GetLabel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestGetLabel
void TestGetLabel()
{
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
mitk::Label::PixelType value1 = 1;
label1->SetValue(value1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
mitk::Label::PixelType value2 = 200;
label2->SetValue(value2);
m_LabelSetImage->GetActiveLabelSet()->AddLabel(label1);
m_LabelSetImage->AddLayer();
m_LabelSetImage->GetLabelSet(1)->AddLabel(label2);
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for active layer",
mitk::Equal(*m_LabelSetImage->GetLabel(1), *label1, 0.0001, true));
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for layer 1",
mitk::Equal(*m_LabelSetImage->GetLabel(200, 1), *label2, 0.0001, true));
// Try to get a non existing label
mitk::Label *label3 = m_LabelSetImage->GetLabel(1000);
CPPUNIT_ASSERT_MESSAGE("Non existing label should be nullptr", label3 == nullptr);
// Try to get a label from a non existing layer
label3 = m_LabelSetImage->GetLabel(200, 1000);
CPPUNIT_ASSERT_MESSAGE("Label from non existing layer should be nullptr", label3 == nullptr);
}
示例2: TestSetExteriorLabel
void TestSetExteriorLabel()
{
mitk::Label::Pointer exteriorLabel = mitk::Label::New();
exteriorLabel->SetName("MyExteriorSpecialLabel");
mitk::Label::PixelType value1 = 10000;
exteriorLabel->SetValue(value1);
m_LabelSetImage->SetExteriorLabel(exteriorLabel);
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for layer 1", mitk::Equal(*m_LabelSetImage->GetExteriorLabel(), *exteriorLabel, 0.0001, true));
// Exterior label should be set automatically for each new layer
m_LabelSetImage->AddLayer();
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for layer 1", mitk::Equal(*m_LabelSetImage->GetLabel(10000, 1), *exteriorLabel, 0.0001, true));
}