Hello,
I am having some weird results while trying to update my VTK.
I am converting a VTK polydata to Image data with the following code:
vtkSmartPointer VtkPolyDataToImage(vtkPolyData* poly, vtkImageData* templateImage)
{
vtkSmartPointer image = vtkSmartPointer::New();
image->DeepCopy(templateImage);
// fill the image with foreground voxels:
short inval = 1;
short outval = 0;
vtkIdType count = templateImage->GetNumberOfPoints();
for (vtkIdType i = 0; i < count; ++i)
{
image->GetPointData()->GetScalars()->SetTuple1(i, inval);
}
// polygonal data → image stencil:
vtkSmartPointer pol2stenc =
vtkSmartPointer::New();
pol2stenc->SetInputData(poly);
pol2stenc->SetOutputOrigin(image->GetOrigin());
pol2stenc->SetOutputSpacing(image->GetSpacing());
pol2stenc->SetOutputWholeExtent(image->GetExtent());
pol2stenc->Update();
// cut the corresponding white image and set the background:
vtkSmartPointer imgstenc = vtkSmartPointer::New();
imgstenc->SetInputData(image);
imgstenc->SetStencilConnection(pol2stenc->GetOutputPort());
imgstenc->ReverseStencilOff();
imgstenc->SetBackgroundValue(outval);
imgstenc->Update();
vtkSmartPointer outputImage = imgstenc->GetOutput();
return outputImage;
}
However, After upgrading the created image is different (like 0.2 max difference).
Do you have any idea about what could the issue here ? Is it a known issue ?
Thanks in advance