VtkPolyData clip

Hi everyone,
1635447638(1)
I have a problem. So in the image, the white part is a polydata of an iso surface. And I defined the implicit function of a sphere and cut it.

    vtkNew<vtkClipPolyData> isoClip;
skinClip->SetInputData(m_IsoSurfacePolyData);
skinClip->SetClipFunction(sphere);
skinClip->SetValue(0);
skinClip->GenerateClipScalarsOn();
skinClip->Update();

And it worked well, the sphere is cut from the iso surface.
But I don’t want it to be hollow. Can I add the interaction part’s surface.
I used vtlProbeFilter, but it did not work right.

Thank you!

The isosurface of a scalar field in a 3D mesh is expected to be a surface, and not necessarily a watershed one. If you want to extract region with a scalar value above a given threshold, you may use the threshold filter. This way, you will have a dense result.

Thank you for the reply.
What I really want is something like this https://kitware.github.io/vtk-examples/site/Cxx/Medical/TissueLens/#description
But apparently this is not working

Can you also show how you use the probe filter ?
In the given example there are these lines to create the sphere with the right geometry, probe the values and cut it to match the whole.

  // Define a model for the "lens". Its geometry matches the implicit
  // sphere used to clip the isosurface
  vtkNew<vtkSphereSource> lensModel;
  lensModel->SetRadius(50);
  lensModel->SetCenter(73, 52, 15);
  lensModel->SetPhiResolution(201);
  lensModel->SetThetaResolution(101);

  // Sample the input volume with the lens model geometry
  vtkNew<vtkProbeFilter> lensProbe;
  lensProbe->SetInputConnection(lensModel->GetOutputPort());
  lensProbe->SetSourceConnection(reader->GetOutputPort());

  // Clip the lens data with the isosurface value
  vtkNew<vtkClipDataSet> lensClip;
  lensClip->SetInputConnection(lensProbe->GetOutputPort());
  lensClip->SetValue(500);
  lensClip->GenerateClipScalarsOff();
  lensClip->Update();

Here it is
m_IsoSurfaceMapperBR has the input of the iso surface
m_BoneReductionImageBR is the imagedata used to generate the iso surface

vtkSmartPointer<vtkSphere> sphere = vtkSmartPointer<vtkSphere>::New();
vtkSmartPointer<vtkSphereSource> spherePoly = vtkSmartPointer<vtkSphereSource>::New();
double tip[3];
m_drillModel->GetDrillTip(tip);
sphere->SetCenter(tip);
sphere->SetRadius(6.0);
spherePoly->SetCenter(tip);
spherePoly->SetRadius(6.0);
spherePoly->SetPhiResolution(200);
spherePoly->SetThetaResolution(200);

vtkNew<vtkClipPolyData> isoClip;
skinClip->SetInputData(m_IsoSurfaceMapperBR->GetInput());
skinClip->SetClipFunction(sphere);
skinClip->SetValue(0);
skinClip->GenerateClipScalarsOn();
skinClip->Update();

vtkNew<vtkProbeFilter> probe;
probe->SetInputData(spherePoly);
probe->SetSourceData(m_BoneReductionImageBR);
probe->Update();

vtkNew<vtkClipPolyData> probeClip;
probeClip->SetInputConnection(probe->GetOutputPort());
probeClip->SetValue(30);
probeClip->GenerateClipScalarsOff();
probeClip->Update();

vtkSmartPointer<vtkAppendPolyData> appendData = vtkSmartPointer<vtkAppendPolyData>::New();
appendData->AddInputData(isoClip->GetOutPut());
appendData->AddInputData(probeClip->GetOutPut());
appendData->Update();
vtkSmartPointer<vtkCleanPolyData> clean = vtkSmartPointer<vtkCleanPolyData>::New();
clean->SetInputData(appendData->GetOutput());
clean->Update();

m_IsoSurfaceMapperBR->SetInputData(clean->GetOutput());
m_IsoSurfaceMapperBR->ScalarVisibilityOff();
m_IsoSurfaceMapperBR->Update();

I append the two polydata to a single one and use the same mapper for that