[vtkusers] Thresholding an image using VTK from PYTHON.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Thu Jun 26 21:40:12 EDT 2003


>>>>> "gte631d" == gte631d  <gte631d at mail.gatech.edu> writes:

    gte631d> Hi All, I'm having a problem, with something that should
    gte631d> be pretty straighforward.

  ##Now we want to do a simple threshold
  thim = vtkImageThreshold()
  thim.SetInput(inim)
  thim.ThresholdByUpper(45)
  thim.SetInValue(1)
  thim.SetOutValue(0)
  thim.SetOutputScalarTypeToShort()
  threshout = thim.GetOutput()
  print threshout.GetPointData().GetScalars()
    ##Returns "NONE"

You need to update the pipeline.  Before you do 
threshout = thim.GetOutput() 
add this line:
thim.Update()

cheers,
prabhu



More information about the vtkusers mailing list