本文整理汇总了C++中inputimagetype::Pointer::FillBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::FillBuffer方法的具体用法?C++ Pointer::FillBuffer怎么用?C++ Pointer::FillBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inputimagetype::Pointer
的用法示例。
在下文中一共展示了Pointer::FillBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getVTKPolyDataPrecise
//.........这里部分代码省略.........
/******************/
InputImageType::Pointer t = getEmpty(wx,wy,wz);
for(int counter=1; counter<=max1; counter++)
{
//printf("Maximum tiny image size I need is [%d %d %d]\n",wx,wy,wz);
if(carray[counter].sx > 59999)
continue;
printf("Working..\n");
// scanf("%*d");
InputImageType::SizeType size;
InputImageType::RegionType region;
index.Fill(1);
region.SetIndex(index);
region.SetSize(size);
LabelImageType::SizeType lsize;
LabelImageType::IndexType lindex;
LabelImageType::RegionType lregion;
itkexporter->SetInput(t);
t->FillBuffer(0);
lsize[0] = carray[counter].ex-carray[counter].sx+1;
lsize[1] = carray[counter].ey-carray[counter].sy+1;
lsize[2] = carray[counter].ez-carray[counter].sz+1;
lindex[0] = carray[counter].sx;
lindex[1] = carray[counter].sy;
lindex[2] = carray[counter].sz;
lregion.SetIndex(lindex);
lregion.SetSize(lsize);
LabelIteratorType localiter = LabelIteratorType(label,lregion);
size = lsize;
region.SetSize(size);
IteratorType iter = IteratorType(t,region);
for(localiter.GoToBegin(),iter.GoToBegin();!localiter.IsAtEnd();++localiter,++iter)
{
if(localiter.Get()==counter)
{
iter.Set(255);
}
}
t->Modified();
vtkimporter->Modified();
transform->Identity();
transform->Translate(carray[counter].sx-1,carray[counter].sy-1,carray[counter].sz-1);
tf->SetTransform(transform);
tf->Update();
vtkSmartPointer<vtkPolyData> pol=vtkSmartPointer<vtkPolyData>::New();
pol->DeepCopy(tf->GetOutput());
// tf->GetOutput()->Print(std::cout);
appendfilter->AddInputData(pol);
//appendfilter->Update();
//appendfilter->SetInputByNumber(counter-1,tf->GetOutput());
// appendfilter->Update();
// appendfilter->GetOutput()->Print(std::cout);
//if(counter>500)
// break;
printf("Completed %d/%d\r",counter,max1);
// scanf("%*d");
}
appendfilter->Update();
vtkSmartPointer<vtkDecimatePro> decimate = vtkSmartPointer<vtkDecimatePro>::New();
decimate->SetInputData(appendfilter->GetOutput());
decimate->SetTargetReduction(0.1);
//decimate->SetNumberOfDivisions(32,32,32);
printf("Decimating the contours...");
decimate->Update();
printf("Done\n");
printf("Smoothing the contours after decimation...");
vtkSmartPointer<vtkSmoothPolyDataFilter> smoothfinal = vtkSmartPointer<vtkSmoothPolyDataFilter>::New();
smoothfinal->SetRelaxationFactor(0.2);
smoothfinal->SetInputData(decimate->GetOutput());
smoothfinal->SetNumberOfIterations(0);
smoothfinal->Update();
printf("Done\n");
delete [] carray;
vtkSmartPointer<vtkPolyData> out = smoothfinal->GetOutput();
return out;
}