本文整理汇总了C++中mitk::labelsetimage::Pointer::SetActiveLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetActiveLayer方法的具体用法?C++ Pointer::SetActiveLayer怎么用?C++ Pointer::SetActiveLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::labelsetimage::Pointer
的用法示例。
在下文中一共展示了Pointer::SetActiveLayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestSetActiveLayer
void TestSetActiveLayer()
{
// Cache active layer
mitk::LabelSet::ConstPointer activeLayer = m_LabelSetImage->GetActiveLabelSet();
// Add new layer
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
unsigned int layerID = m_LabelSetImage->AddLayer(newlayer);
// Set initial layer as active layer
m_LabelSetImage->SetActiveLayer(0);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned", mitk::Equal(*activeLayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
// Set previously added layer as active layer
m_LabelSetImage->SetActiveLayer(layerID);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned", mitk::Equal(*newlayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
// Set a non existing layer as active layer - nothing should change
m_LabelSetImage->SetActiveLayer(10000);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned", mitk::Equal(*newlayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
}
示例2: TestExistsLabel
void TestExistsLabel()
{
mitk::Label::Pointer label = mitk::Label::New();
label->SetName("Label2");
mitk::Label::PixelType value = 200;
label->SetValue(value);
m_LabelSetImage->AddLayer();
m_LabelSetImage->GetLabelSet(1)->AddLabel(label);
m_LabelSetImage->SetActiveLayer(0);
CPPUNIT_ASSERT_MESSAGE("Existing label was not found", m_LabelSetImage->ExistLabel(value) == true);
CPPUNIT_ASSERT_MESSAGE("Non existing label was found", m_LabelSetImage->ExistLabel(10000) == false);
}