本文整理汇总了C++中mitk::labelsetimage::Pointer::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::Initialize方法的具体用法?C++ Pointer::Initialize怎么用?C++ Pointer::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::labelsetimage::Pointer
的用法示例。
在下文中一共展示了Pointer::Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setUp
void setUp() override
{
// Create a new labelset image
m_LabelSetImage = mitk::LabelSetImage::New();
mitk::Image::Pointer regularImage = mitk::Image::New();
unsigned int dimensions[3] = {256, 256, 312};
regularImage->Initialize(mitk::MakeScalarPixelType<int>(), 3, dimensions);
m_LabelSetImage->Initialize(regularImage);
}
示例2:
void TestReadWrite3DplusTLabelSetImage()
{
unsigned int dimensions[4] = {256, 256, 312, 10};
regularImage->Initialize(mitk::MakeScalarPixelType<int>(), 4, dimensions);
multilabelImage = mitk::LabelSetImage::New();
multilabelImage->Initialize(regularImage);
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
newlayer->SetLayer(1);
mitk::Label::Pointer label0 = mitk::Label::New();
label0->SetName("Background");
label0->SetValue(0);
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(label0);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
multilabelImage->AddLayer(newlayer);
pathToImage = mitk::IOUtil::CreateTemporaryDirectory();
pathToImage.append("/LabelSetTestImage3DplusT.nrrd");
mitk::IOUtil::Save(multilabelImage, pathToImage);
mitk::LabelSetImage::Pointer loadedImage =
dynamic_cast<mitk::LabelSetImage *>(mitk::IOUtil::Load(pathToImage)[0].GetPointer());
// This information is currently not serialized but also checked within the Equals function
loadedImage->SetActiveLayer(multilabelImage->GetActiveLayer());
CPPUNIT_ASSERT_MESSAGE("Error reading label set image", loadedImage.IsNotNull());
CPPUNIT_ASSERT_MESSAGE("Error reading label set image", mitk::Equal(*multilabelImage, *loadedImage, 0.0001, true));
itksys::SystemTools::RemoveFile(pathToImage);
}