vtkImageStencil and vtkPolyDataToImageStencil


I am trying to create a volumetric mask (vtkImageData) from a 3D contour (vtkPolyData) using a Programmable Filter in paraview. I found this example to work from online but paraview cannot find vtkImageStencil or vtkPolyDataToImageStencil. I have tried importing them from vtkmodules and also vtkmodules.vtkImagingStencil

What am I missing? Also, maybe I am going about this process the wrong way. Using a contour to clip a regular grid is a fairly standard process, is there not an easy way to do this in paraview already?