cutter performance

Hi everyone,
I’ve met a performance issue with vtkCutter, the situation is I have some polyDatas to be cut and displayed, so for 1 polyData there are 3 cuttors and actors for 3 renderers like this:

For the slices made by vtkImageSlice, I called setSlice(ijk) to update them, and for the cutters just change the plane center and direction and call a modified() to update, then call render() on 3 renderWindows.

When I add more polyData, the time cost increased by times and get far from 60fps, here is the performance:

Is there anyway I can do to improve this? I’ve thought of adding those polyDatas to one appendPolyData, but they need to be colored differently.


It seems that from what you describe, you should have only 1 cut to perform when there is 1 slider changed.
It’s not clear to me why you need to call modified() manually.
How do you render the blue lines ? Is this the output of a cutter (plane to plane intersection) ? If so, you might want to consider creating the lines manually or, even better, use widgets. (e.g. vtkImageResliceWidget)

Hi Julien,

Thank you for you reply, forgive me that I didn’t display the other situations, this one is using standard xyz axis to do the slice, when slider changes, the origin(center) of the three planes for the cutters is changed, I call the modified because in some old versions they do not update if I just change the origin of the planes of the cutters. In new versions the modified is not needed, but since the center is changed, it will still update the plane and the ‘dataSetCutter’ part will still be there in the requestData segment, which is the main cost of the render period.

There is ony 1 cut to perform but the others’ center are changed. I can update only one plane and do not update the other two since there are no updates for them in the other two windows.

The blue lines are some single line vtkPolyDatas created manually, they will also be updated if the center changes. In a slider change event, the process is the center changes → imageSlice.setSlice called, planes and blue lines change → 3 renderWindows render, the blue lines’ positions have been changed so there will be 3 renders, this can be improved if I put the blue lines out of vtkRenderer on a seperated dom element or a canvas.

But there are other situations that will need the reslice but not slice, for custom cut plane, the performance issue will still be there, without the cutters both the widget and my manually made component are very smooth but both will be slow when the cutters are added (This situation will need cutters to be updated in 2 or 3 windows, if there are 4 objects there will be 4 planes updated in a single window and 8-12 planes total)

Maybe you could NOT set the new origin onto a plane if the new origin is within the plane.
You can use vtkPlane.distanceToPlane for that.

It’s not in the same plane in reslice situations, like this:

The slider on the axial plane(left one) changed, then the reslice on the other two planes updated, with the 4 cutters updated together, and main cost is the cutter update.

I just made a slight improvement of vtkCutter, you’ll find the PR here.
I do not think there is much more room for improvement.

You might want to refresh the cut on mouse-release instead of on mouse-move…


1 Like

Hi Julien,

Thanks for the reply and sorry for the late response, I might refer to some wasm module to see if there could be any improvement for the cutter update because the mousemove events is an important user experience.

I doubt you will get dramatic improvement with wasm.

An alternative would be to run those filters in webworkers (i.e. in parralel).