Need any example with FIlter using inside the Programmable Filter

I cant find no example with calling vtk filters inside th programmable filter.
1)Created filter should not be in ParaView Pipeline Browser.
2)It can be Glyph filter or Cutter filter or Threshold or ExtractSubset for StructuredGrid
3)And, if it can be realised what vtk filter make ExtractSubset like ParaView?
I see this something like:

input = self.GetInputDataObject(0, 0)
InputCopy= input.NewInstance()
InputCopy.ShallowCopy(input)

thFilter= vtk.vtkThreshold()
thFilter.SetInputData(InputCopy)
thFilter.Scalars = [‘CELLS’, ‘data’]
thFilter.ThresholdRange = [1.0, 4.0]
thFilter.Update()

self.GetOutputDataObject(0).ShallowCopy(thFilter.GetOutputDataObject(0))

Solved:
import vtk
inp = self.GetInputDataObject(0, 0)
outp = self.GetOutputDataObject(0)
thresh = vtk.vtkThreshold()
thresh.SetInputData(inp)
thresh.SetInputArrayToProcess(1, 0, 0,0, “dataScalar”)
thresh.ThresholdBetween(1,5)
thresh.Update()
outp.ShallowCopy(thresh.GetOutput())

Here’s another example of running Pass Arrays, followed by Point Data to Cell Data inside a Programmable Filter

   # run PassArrays and PointDataToCellData filters to get element variables faster
   # run on entire MultiBlockDataSet

   # use pass arrays to extract arrays of interest
   myArrays=vtk.vtkPassArrays()
   myArrays.SetInputDataObject(self.GetOutputDataObject(0))
   #myArrays.SetInputDataObject(self.GetInputDataObject(0,0))
   myArrays.ClearArrays()
   myArrays.AddPointDataArray('Z_undef')
   if (Radius_undeformed):
      myArrays.AddPointDataArray('Radius_undef')
   if (Sector_Angle_undeformed):
      myArrays.AddPointDataArray('Sector_Angle_undef')
   myArrays.AddCellDataArray('')
   myArrays.AddFieldDataArray('')

   # use point2cell to operate on the arrays we care about
   p2c = vtk.vtkPointDataToCellData()
   p2c.SetInputConnection(myArrays.GetOutputPort())
   p2c.Update()

Dennis

Hello,

This site has been very useful to figure out the implementation of vtk operations (which are used by the Paraview filters) into a Python programmable filter:

https://lorensen.github.io/VTKExamples/site/Python/

Regards

Miguel

The person behind this work has passed away, but remains in his work (in many languages such as

) here:

https://kitware.github.io/vtk-examples/site/