[vtkusers] problems with vtKProgrammableSource

David E DeMarle dave.demarle at kitware.com
Fri Jan 15 12:30:55 EST 2016


I could be wrong but programmable source doesn't have a
SetRequestDataObjectMethod or a SetFillOutputPortInformation method which
is where you might change that.

I recommend you use the new vtkPyhtonAlgorithm instead.
http://www.kitware.com/blog/home/post/737



David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Fri, Jan 15, 2016 at 12:08 PM, Bryan Cole <bryan.cole at teraview.com>
wrote:

>
> I'm trying to use a vtkProgrammableSource to create a StructuredPoints
> output using python and VTK-6.0.0. My test script is below.
>
> This fails with the error "ERROR: In
> /builddir/build/BUILD/VTK6.0.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx,
> line 815
> vtkCompositeDataPipeline (0x2253f50): Input for connection index 0 on
> input port index 0 for algorithm vtkClipVolume(0x224e050) is of type
> vtkPolyData, but a vtkImageData is required."
>
> I.e. the programmable source is always giving a vtkPolyData output to the
> downstream filter (vtkClipVolume) instead of the desired
> StructuredPoints dataset. What am I doing wrong?
>
> Thanks,
> BC
>
> ##############example#############
> import vtk
>
> src = vtk.vtkProgrammableSource()
> def make_grid():
>     sp = src.GetStructurePointsOutput()
>     sp.SetDimensions(50,50,50)
>     sp.SetOrigin(-10,-10,-10)
>     sp.SetSpacing(0.4,0.4,0.4)
>
> src.SetExecuteMethod(make_grid)
>
> func = vtk.vtkSphere()
> func.SetCenter(0,0,0)
> func.SetRadius(5.0)
>
> clip = vtk.vtkClipVolume()
> clip.SetInputConnection(src.GetOutputPort())
> clip.SetClipFunction(func)
>
> map = vtk.vtkPolyDataMapper()
> map.SetInputConnection(clip.GetOutputPort())
> map.ScalarVisibilityOff()
>
> surfaceActor = vtk.vtkActor()
> surfaceActor.SetMapper(map)
>
> # Create the RenderWindow, Renderer and both Actors
> ren = vtk.vtkRenderer()
> renWin = vtk.vtkRenderWindow()
> renWin.AddRenderer(ren)
> iren = vtk.vtkRenderWindowInteractor()
> iren.SetRenderWindow(renWin)
>
> # Add the actors to the renderer, set the background and size
> ren.AddActor(surfaceActor)
>
> iren.Initialize()
> renWin.Render()
> iren.Start()
>
>
>
> --
> Group Leader, Technical Development Group - Teraview Ltd.
> Platinum Building, St. John's Innovation Park, Cambridge CB4 0DS, UK.
> tel: +44 (0)1223 435386, fax: +44 (0)1223 435382, web: www.teraview.com Registered
> Number: 04126946, VAT Number: 770 8883 84
>
> ...preferred document formats: ODF (ISO/IEC 26300:2006), PDF
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160115/45c55384/attachment.html>


More information about the vtkusers mailing list