I’m wondering how I might perform a box clip with the vtkTableBasedClipDataSet filter to avoid mesh triangulation. For example, a typical BoxClip of ImageData looks like this:
import vtk
...
alg = vtk.vtkBoxClipDataSet()
alg.SetBoxClip(xmin, xmax, ymin, ymax, zmin, zmax)
alg.SetInputDataObject(dataset) # pass image data in this example
alg.GenerateClippedOutputOn()
alg.Update()
result = alg.GetOutputDataObject(1)
...
# Plot result
This is super close to what I want - no triangulation - but the box clipped from the dataset is curved along the edges which is not prefered. How would I get sharp edges from vtkTableBasedClipDataSet?
I believe you are seeing the effects of clipping by an implicit box function. The volume is clipped by a scalar field which is defined as the distance from the box. This distance field is only box-like when the cut value is set to 0. To see what the distance field looks like outside the box, see the images in this StackOverflow post.
The box function is effectively evaluated at points in the input data set. The problem is that in general, edges of your box function will not coincide with points in the input grid. In such cases vtkTableBasedClipDatatSet will perform linear interpolation between the points. The linear interpolation fails in the case of the non-linear distance function from the box, and is responsible for the rounded edges you see.
Is there any way to use the vtkTableBasedClipDatatSet filter and have sharp edges exactly like a vtkBoxClipDataSet? My goal is to not triangulate the output mesh where I don’t need to - which is why I’m interested in using the vtkTableBasedClipDatatSet.