Hello,
Sorry in advance if my english is not perfect. I try to make my explanation clear.
I’m using vtkPointInterpolator in my method. Whether I use Linear or Voronoi kernel I don’t have any problem. But when I use Gaussian or Shepard kernels I get a seg fault in the ptInterpolator method SetKernel. I looks like the Gaussian or Shepard kernel are not initialize/build correctly or something like that. Even if I want to print Class name, I cant with Gaussian nor Shepard.
My code below :
vtkPointInterpolator *ptInterpolator = vtkPointInterpolator::New();
//Select Kernel to use (selection might be improved with vtk safe down casting)
vtkLinearKernel* kernel = vtkLinearKernel::New();
if (m_kernelStr == "Voronoi")
{
kernel->Delete();
vtkProbabilisticVoronoiKernel* kernel = vtkProbabilisticVoronoiKernel::New();
}
else if (m_kernelStr == "Gaussian")
{
kernel->Delete();
vtkGaussianKernel *kernel = vtkGaussianKernel::New();
kernel->SetRequiresInitialization(false);
kernel->SetKernelFootprintToRadius();
kernel->SetSharpness(m_sharpness);
kernel->SetRadius(m_radius);
kernel->SetNormalizeWeights(true);
}
else if (m_kernelStr == "Shepard")
{
kernel->Delete();
vtkShepardKernel *kernel = vtkShepardKernel::New();
kernel->SetRequiresInitialization(false);
kernel->SetKernelFootprintToRadius();
kernel->SetRadius(m_radius);
kernel->SetPowerParameter(m_order);
}
else {
kernel->SetKernelFootprintToRadius();
kernel->SetRadius(m_radius);
kernel->SetNormalizeWeights(true);
}
//Perform interpolation
ptInterpolator->SetSourceData(volumeToBeInterpolated);
ptInterpolator->SetInputData(surfaceToBeInterpolateOn);
ptInterpolator->SetKernel(kernel);
std::cout << "kernel : " << kernel->GetClassName() << std::endl;
std::cout << "pt kernel : " << ptInterpolator->GetKernel()->GetClassName() << std::endl;
ptInterpolator->Update();
surfaceToBeInterpolateOn->ShallowCopy(ptInterpolator->GetPolyDataOutput());
kernel->Delete();
ptInterpolator->Delete();
I can’t attached input files as I’m a new user on the forum… But it should work for any vtkUnstructuredGrid for volumeToBeInterpolated variable and any vtkPolyData for surfaceToInterpolateOn.
If someone have any hints, it would be appreciated
Valentin