[vtkusers] Fwd: apply filter multiple times

Paulo Carvalho paulo.r.m.carvalho at gmail.com
Sun Jul 7 09:06:31 EDT 2019


---------- Forwarded message ---------
De: Paulo Carvalho <paulo.r.m.carvalho at gmail.com>
Date: dom, 7 de jul de 2019 às 10:06
Subject: Re: [vtkusers] apply filter multiple times
To: Martin Genet <martin.genet at polytechnique.edu>


Hi, Martin!

       If I understood right, you want to create a
vtkUnstructuredGridAlgorithm specialization so you can plug it in to a VTK
pipeline.  That would be "easy" if it were in C++, but it seems you want to
do it in pure Python.  Thus, your problem is two-fold:

   1) You need to learn know how to extend C++ classes in Python and make
your Python class usable in a C++ framework:
https://stackoverflow.com/questions/2200912/inheritance-in-python-c-extension
.

   2) You need to implement a custom sub-class of
vtkUnstructuredGridAlgorithm in Python to be able to plug it in to some VTK
pipeline.

     I've never tried it myself, but be ready for some real headaches as I
recall the pain that was to write CORBA wrappers for Java-C++
interoperabilty.

     I think you'd be better off if you write your custom
vtkUnstructuredGridAlgorithm subclass in C++ and use it in Python like
other VTK classes.  Overriding vtkUnstructuredGridAlgorithm alone will be
enough trouble.

all the best,

Paulo

Em sáb, 6 de jul de 2019 às 17:31, Martin Genet <
martin.genet at polytechnique.edu> escreveu:

> Dear all:
>
> I am having some issue setting up a rather complex pipeline involving,
> but not exclusively, vtk objects and filters. I think basically the
> issue boils down to this: I create an unstructured grid with some vector
> field, warp it, modify the vector field (outside vtk), warp it again,
> etc. Pretty basic, right? Of course I do not want to reallocate an
> unstructured grid for the warped mesh each time I run the warp filter,
> but rather modify the one that is allocated the first time I run the
> warp filter. Makes sense? I have done this many times, for pipelines
> that only involve vtk stuff. However, I am not sure how to do this for
> pipelines involving non-vtk operations. Attached is a minimal example: I
> create a sphere, warp it along the normals, scale the normals, warp it
> again using the already existing warp filter (here the scaling is not
> taken into account for some reason), and warp it using a new warp filter
> (here it is, but I guess it creates a new object instead of modifying
> the existing one, right?). This seem like a trivial issue, but I cannot
> seem to figure it out. Can someone help me? Thank you so much.
>
> Martin
> _______________________________________________
> 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:
> https://vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20190707/67e0c3e0/attachment.html>


More information about the vtkusers mailing list