本文整理汇总了C++中mitk::labelsetimage::Pointer::RemoveLabels方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::RemoveLabels方法的具体用法?C++ Pointer::RemoveLabels怎么用?C++ Pointer::RemoveLabels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::labelsetimage::Pointer
的用法示例。
在下文中一共展示了Pointer::RemoveLabels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestRemoveLabels
void TestRemoveLabels()
{
mitk::Image::Pointer image =
dynamic_cast<mitk::Image*>(mitk::IOUtil::Load(GetTestDataFilePath("Multilabel/LabelSetTestInitializeImage.nrrd"))[0].GetPointer());
m_LabelSetImage->InitializeByLabeledImage(image);
CPPUNIT_ASSERT_MESSAGE("Image - number of labels is not 6", m_LabelSetImage->GetNumberOfLabels() == 6);
// 2ndMin because of the exterior label = 0
CPPUNIT_ASSERT_MESSAGE("Labels with value 1 and 3 was not remove from the image",
m_LabelSetImage->GetStatistics()->GetScalarValue2ndMin() == 1);
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image",
m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 7);
CPPUNIT_ASSERT_MESSAGE("Label with ID 3 does not exists after initialization",
m_LabelSetImage->ExistLabel(3) == true);
CPPUNIT_ASSERT_MESSAGE("Label with ID 7 does not exists after initialization",
m_LabelSetImage->ExistLabel(7) == true);
std::vector<mitk::Label::PixelType> labelsToBeRemoved;
labelsToBeRemoved.push_back(1);
labelsToBeRemoved.push_back(3);
labelsToBeRemoved.push_back(7);
m_LabelSetImage->RemoveLabels(labelsToBeRemoved);
CPPUNIT_ASSERT_MESSAGE("Wrong number of labels after some have been removed",
m_LabelSetImage->GetNumberOfLabels() == 3);
// Values within the image are 0, 1, 3, 5, 6, 7 - New Min/Max value should be 5 / 6
// 2ndMin because of the exterior label = 0
CPPUNIT_ASSERT_MESSAGE("Labels with value 1 and 3 was not remove from the image",
m_LabelSetImage->GetStatistics()->GetScalarValue2ndMin() == 5);
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image",
m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 6);
}