[vtkusers] How to extract Scalar and Point Data from ProbeFilter?

Eric E. Monson emonson at cs.duke.edu
Wed Jan 26 12:38:35 EST 2011


Hello,

Make sure you call probe.Update() before you try to read the output. Normally the pipeline is only updated when the system needs the information for a sink like displaying or saving, but if you're trying to access it before that point you need to call Update manually first. Also, since the data already exists (or will after you update), you don't need to set "data" data type or allocate memory. (You should do the former if you're making a copy of the data rather than accessing it "in place".) So, I think you can change your example to:

// ----------------------------
probe = vtk.vtkProbeFilter()  # or  cutter = vtk.ctkCutter()
...
probe.Update()
data = probe.GetOutput().GetPointData().GetScalars()
print data
// ----------------------------

-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Jan 26, 2011, at 3:23 AM, FUJII Kenji wrote:

> Hi there,
> 
> I want to extract Point and Scalar Data from ProbeFilter that was Probing or Cutting from Polydata.
> 
> To extract them, I was trying to call some function (GetOutput, GetPointData, GetScalars etc...)
> But It doesn't work well. What I tried in Python is as follows.
> 
> // ----------------------------
> probe = vtk.vtkProbeFilter()  # or  cutter = vtk.ctkCutter()
> ...
> data = vtk.vtkDoubleArray()
> data.SetNumberOfComponents(1)
> data.SetNumberOfTuples(20*20)
> data = probe.GetOutput().GetPointData().GetScalars()
> print data
> // ----------------------------
> 
> The result of  "print data" was (None).
> I think vtkProbeFilter and vtkCutter may not have Point and Scalar data.
> 
> Please reply if someone knows how to extract their data.
> 
> Regards,
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ################################################
> 日東紡音響エンジニアリング株式会社
> システム事業部 藤井 健司 
> 
> 〒130-0021 東京都墨田区緑1-21-10 BR両国2ビル 4F
> TEL:03-3634-5300 FAX:03-3634-5350
> Email:kenji.fujii at noe.co.jp
> ################################################
> 
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list