Apply threshold for vtkImagePlaneWidget visualization


Currently I am using vtkImagePlaneWidget to visualize a NIFTI volume.

I am simply using the following methods to define the appearance:

imagePlaneWidget[i]->SetWindowLevel(window, level);

Now I want to achieve something similar to the threshold slider in 3D Slicer:

Values which are lower or higher should be hidden (e.g. to remove the black “background”).

How this can be achieved? I checked vtkImageThreshold, vtkVolumeProperty etc., but I could not figure out what is the right approach.

Thank you!