auto lut = vtkSmartPointer<vtkLookupTable>::New();
lut->SetNumberOfColors(2);
lut->SetTableRange(0, 1);
lut->SetTableValue(0, 0.0, 0.0, 0.0, 0.0);//背景透明
lut->SetTableValue(1, 1.0, 0.0, 0.0, 1.0);//前景红色
lut->Build();
auto colorMap = vtkSmartPointer<vtkImageMapToColors>::New();
colorMap->SetInputData(mask);
colorMap->SetLookupTable(lut);
colorMap->Update();
auto labelmap = vtkSmartPointer<vtkImageActor>::New();
labelmap->SetInputData(colorMap->GetOutput());
auto renderer = vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(labelmap);
vtkImageData 二值化图像转RGBlabel
最新推荐文章于 2022-02-11 11:42:04 发布