apply filter multiple times

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

apply filter multiple times

Martin Genet-3
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

test_vtk.py (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Fwd: apply filter multiple times

Paulo Carvalho


---------- Forwarded message ---------
De: Paulo Carvalho <[hidden email]>
Date: dom, 7 de jul de 2019 às 10:06
Subject: Re: [vtkusers] apply filter multiple times
To: Martin Genet <[hidden email]>


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 <[hidden email]> 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

_______________________________________________
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