Fwd: apply filter multiple times
Paulo Carvalho <[email protected]> Sun, 7 Jul 2019 10:06:31 -0300
| Newsgroups | gmane.comp.lib.vtk.user |
|---|---|
| Message-ID | <CA+xrYwgrXk6Ad0PRw73pzuWYVDO8jGmHDnXBBZbN-TSfYhi5MQ@mail.gmail.com> |
--===============1154398188== Content-Type: multipart/alternative; boundary="000000000000f035f9058d16ff96" --000000000000f035f9058d16ff96 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ---------- Forwarded message --------- De: Paulo Carvalho <[email protected]> Date: dom, 7 de jul de 2019 =C3=A0s 10:06 Subject: Re: [vtkusers] apply filter multiple times To: Martin Genet <[email protected]> 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-extensi= on . 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=C3=A1b, 6 de jul de 2019 =C3=A0s 17:31, Martin Genet < [email protected]> 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=3Dvtkusers > > Follow this link to subscribe/unsubscribe: > https://vtk.org/mailman/listinfo/vtkusers > --000000000000f035f9058d16ff96 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" class= =3D"gmail_attr">---------- Forwarded message ---------<br>De: <b class=3D"g= mail_sendername" dir=3D"auto">Paulo Carvalho</b> <span dir=3D"auto"><<a = href=3D"mailto:[email protected]">[email protected]</= a>></span><br>Date: dom, 7 de jul de 2019 =C3=A0s 10:06<br>Subject: Re: = [vtkusers] apply filter multiple times<br>To: Martin Genet <<a href=3D"m= ailto:[email protected]">[email protected]</a>>= ;<br></div><br><br><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div>= <div>Hi, Martin!<br><br></div>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 If I und= erstood right, you want to create a vtkUnstructuredGridAlgorithm specializa= tion so you can plug it in to a VTK pipeline.=C2=A0 That would be "eas= y" if it were in C++, but it seems you want to do it in pure Python.= =C2=A0 Thus, your problem is two-fold:<br><br></div>=C2=A0=C2=A0 1) You nee= d to learn know how to extend C++ classes in Python and make your Python cl= ass usable in a C++ framework: <a href=3D"https://stackoverflow.com/questio= ns/2200912/inheritance-in-python-c-extension" target=3D"_blank">https://sta= ckoverflow.com/questions/2200912/inheritance-in-python-c-extension</a>.<br>= <br></div><div>=C2=A0=C2=A0 2) You need to implement a custom sub-class of = vtkUnstructuredGridAlgorithm in Python to be able to plug it in to some VTK= pipeline.<br><br></div><div>=C2=A0=C2=A0=C2=A0=C2=A0 I've never tried = it myself, but be ready for some real headaches as I recall the pain that w= as to write CORBA wrappers for Java-C++ interoperabilty.<br><br></div><div>= =C2=A0=C2=A0=C2=A0=C2=A0 I think you'd be better off if you write your = custom vtkUnstructuredGridAlgorithm subclass in C++ and use it in Python li= ke other VTK classes.=C2=A0 Overriding vtkUnstructuredGridAlgorithm alone w= ill be enough trouble.<br><br></div><div>all the best,<br><br></div><div>Pa= ulo<br></div></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" cl= ass=3D"gmail_attr">Em s=C3=A1b, 6 de jul de 2019 =C3=A0s 17:31, Martin Gene= t <<a href=3D"mailto:[email protected]" target=3D"_blank">m= [email protected]</a>> escreveu:<br></div><blockquote class= =3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg= b(204,204,204);padding-left:1ex">Dear all:<br> <br> I am having some issue setting up a rather complex pipeline involving, <br> but not exclusively, vtk objects and filters. I think basically the <br> issue boils down to this: I create an unstructured grid with some vector <b= r> field, warp it, modify the vector field (outside vtk), warp it again, <br> etc. Pretty basic, right? Of course I do not want to reallocate an <br> unstructured grid for the warped mesh each time I run the warp filter, <br> but rather modify the one that is allocated the first time I run the <br> warp filter. Makes sense? I have done this many times, for pipelines <br> that only involve vtk stuff. However, I am not sure how to do this for <br> pipelines involving non-vtk operations. Attached is a minimal example: I <b= r> create a sphere, warp it along the normals, scale the normals, warp it <br> again using the already existing warp filter (here the scaling is not <br> taken into account for some reason), and warp it using a new warp filter <b= r> (here it is, but I guess it creates a new object instead of modifying <br> the existing one, right?). This seem like a trivial issue, but I cannot <br= > seem to figure it out. Can someone help me? Thank you so much.<br> <br> Martin<br> _______________________________________________<br> Powered by <a href=3D"http://www.kitware.com" rel=3D"noreferrer" target=3D"= _blank">www.kitware.com</a><br> <br> Visit other Kitware open-source projects at <a href=3D"http://www.kitware.c= om/opensource/opensource.html" rel=3D"noreferrer" target=3D"_blank">http://= www.kitware.com/opensource/opensource.html</a><br> <br> Please keep messages on-topic and check the VTK FAQ at: <a href=3D"http://w= ww.vtk.org/Wiki/VTK_FAQ" rel=3D"noreferrer" target=3D"_blank">http://www.vt= k.org/Wiki/VTK_FAQ</a><br> <br> Search the list archives at: <a href=3D"http://markmail.org/search/?q=3Dvtk= users" rel=3D"noreferrer" target=3D"_blank">http://markmail.org/search/?q= =3Dvtkusers</a><br> <br> Follow this link to subscribe/unsubscribe:<br> <a href=3D"https://vtk.org/mailman/listinfo/vtkusers" rel=3D"noreferrer" ta= rget=3D"_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br> </blockquote></div> </div></div> --000000000000f035f9058d16ff96-- --===============1154398188== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1154398188==--