Re: [vmtk-users] convert into c++
Brought to you by:
davidsteinman,
lucantiga
From: Lia S. <lia...@po...> - 2012-03-19 16:04:53
|
Em 18-03-2012 15:25, Luca Antiga escreveu: > Excellent, I'm happy to know you're on the right track. > Have fun! > > Luca > > > On Mar 18, 2012, at 1:30 PM, Lia Silva wrote: > >> Em 18-03-2012 11:56, Luca Antiga escreveu: >>> Hi Lia, >>> that's not quite what I intended. I'll you a few more explicit >>> suggestions: >>> >>> 1) all the algorithms in vmtk are already in C++. The fact that >>> you're using them >>> in vmtk scripts is just for convenience. Note that this does not >>> impose *any* overhead, >>> speed-wise. >>> >>> 2) make sure you understand why you need to have a C++-only code. Is >>> it for speed only? See point 1). Is if because you want to >>> incorporate vmtk in >>> a purely C++ program? This would make more sense. >>> >>> 3) every algorithm in vmtk is a VTK class. If you know how to >>> program in C++ using VTK, >>> you know how to program in C++ using vmtk. So, make sure you are >>> proficient writing >>> VTK code before you move on with vmtk. There's a great resource of >>> examples here: >>> http://www.vtk.org/Wiki/VTK/Examples/Cxx >>> >>> 4) Once you have addressed 1-3, have a look into vmtk/vmtkScripts >>> and identify the scripts >>> you're interested in and take a look at what classes are used. For >>> instance, the code for >>> vmtksurfacetriangle is >>> >>> cleaner = vtk.vtkCleanPolyData() >>> cleaner.SetInput(self.Surface) >>> cleaner.Update() >>> >>> triangleFilter = vtk.vtkTriangleFilter() >>> triangleFilter.SetInput(cleaner.GetOutput()) >>> triangleFilter.Update() >>> >>> self.Surface = triangleFilter.GetOutput() >>> >>> which in C++ would become >>> >>> vtkCleanPolyData* cleaner = vtkCleanPolyData::New(); >>> cleaner->SetInput(surface); >>> cleaner->Update(); >>> >>> vtkTriangleFilter* triangleFilter = vtkTriangleFilter::New(); >>> triangleFilter->SetInput(cleaner->GetOutput()); >>> triangleFilter->Update(); >>> >>> surface = triangleFilter->GetOutput(); >>> >>> As you see, the high-level code is almost exactly the same, and in both >>> cases, the call to Update triggers code that is already written in C++. >>> >>> Hope this helps clarifying, but most of all, what you should clarify >>> is point 2, i.e. what >>> is the need you're trying to address when you say you want pure C++ >>> code. >>> >>> Best regards >>> >>> Luca >>> >>> >>> On Mar 17, 2012, at 6:41 PM, Lia Silva wrote: >>> >>>> Em 17-03-2012 07:40, Luca Antiga escreveu: >>>>> Dear Lia, >>>>> vmtk code presents itself as Python code, but it is in fact a >>>>> tiny wrapper >>>>> on top of C++ code. All algorithms are already implemented in C++ (see >>>>> vmtk/vtkVmtk directory). If you look for code optimizations, you >>>>> should look >>>>> into the C++ code in that directory. >>>>> Best regards >>>>> >>>>> Luca >>>>> >>>>> >>>>> -- >>>>> Luca Antiga, PhD >>>>> Cofounder and Principal Scientist, Orobix Srl >>>>> via L.A. Muratori 3, 24123 Bergamo, Italy >>>>> >>>>> orobix: www.orobix.com <http://www.orobix.com/> >>>>> home: lantiga.github.com <http://lantiga.github.com/> >>>>> twitter: twitter.com/lantiga <http://twitter.com/lantiga> >>>>> >>>>> On Mar 17, 2012, at 12:50 AM, Lia Silva wrote: >>>>> >>>>>> >>>>>> >>>>>> Hello all! >>>>>> >>>>>> How can i convert a vmtk code into c++ code, so i can run it >>>>>> faster? The >>>>>> code in vmtk it's attached. >>>>>> >>>>>> Thank you in advance >>>>>> >>>>>> >>>>>> >>>>>> <tudo>------------------------------------------------------------------------------ >>>>>> This SF email is sponsosred by: >>>>>> Try Windows Azure free for 90 days Click Here >>>>>> http://p.sf.net/sfu/sfd2d-msazure_______________________________________________ >>>>>> vmtk-users mailing list >>>>>> vmt...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/vmtk-users >>>>> >>>>> Não foram detectados vírus nesta mensagem. >>>>> Verificado por AVG - www.avg.com <http://www.avg.com/> >>>>> Versão: 2012.0.1913 / Base de dados de Vírus: 2114/4874 - Data de >>>>> Lançamento: 03/16/12 >>>>> >>>> So, it means that i have to implement all in c++ since the >>>> beginning? For example, i used the /vmtkimagereader/, so in c++ >>>> i've to use/Dicomseriereadprinttagswrite/? And for the >>>> /vmtkimagevoiselector /i have to use the >>>> /RegionofInterestImageFilter/? Is that it? I'm so confused... Isn't >>>> there another way easier and faster? I thought i could convert >>>> directly into c++.. >>>> >>>> Thank you for all your pacience >>>> ------------------------------------------------------------------------------ >>>> This SF email is sponsosred by: >>>> Try Windows Azure free for 90 days Click Here >>>> http://p.sf.net/sfu/sfd2d-msazure_______________________________________________ >>>> vmtk-users mailing list >>>> vmt...@li... >>>> https://lists.sourceforge.net/lists/listinfo/vmtk-users >>> >>> Não foram detectados vírus nesta mensagem. >>> Verificado por AVG - www.avg.com <http://www.avg.com/> >>> Versão: 2012.0.1913 / Base de dados de Vírus: 2114/4878 - Data de >>> Lançamento: 03/18/12 >>> >> Dear Luca, >> >> Thank you for the answer. It was very helpfull. In fact, the main >> reason i want to use just C++ isn't just to make it faster. This is >> also a reason, but i dont know how exactly vmtk works, and i need to >> do a automatic/semi-automatic tool for measure the aorta diameter. I >> found vmtk by accident and i liked it very much cause its easier to >> work with, but i dont know if i can make a automatic tool using it (i >> dont know how to automatize the process) . In my circle, nobody knows >> vmtk, and my thesis' supervisor just work with c++, so i'm going >> forward using vmtk (cause i dont have much experience with c++ and >> vmtk scripts are easier for me) and later, i pretend to convert into >> c++ so my supervisor can correct it. >> >> You gave me an excellent help and now i'm doing the step 4 by seeing >> the vmtk scripts. If i have any addicional doubt, i hope i can count >> on you. >> >> Thank you very much for your pacience and dedication. >> >> Best regards >> >> Lia > > Não foram detectados vírus nesta mensagem. > Verificado por AVG - www.avg.com <http://www.avg.com> > Versão: 2012.0.1913 / Base de dados de Vírus: 2114/4878 - Data de > Lançamento: 03/18/12 > Dear Luca, I decided not to convert into C++, for now. It's not worth it. Now i'm facing two problems: is there a way to automatize some parameters? I would like to know if i can change the python code, so i dont need to input the parameters manually at the console. In the /vmtkimagevoiselector/ i can specify the coordinates of my cube, and if i could insert them in the code it became easier. Same thing with the /vmtklevelsetsegmentation/. The parameters are always the same, so can i insert them into the code? And how do i do that? The other issue is: I want to measure the diameter of the ascending aorta in nine specifics points. I computed the centerline that gave me the central points and the radius in all points since the source till the target! But i just need nine points. Is there a way to do that? For this project i'm doing a lot of steps.. If i could avoid the most of them, it would be easier to automatize the process and to decrease the processing time. I mean, for compute the centerline its really necessary to run the /vmtkimagevoiselector, vmtklevelsetsegmentation/ and /vmtkmarchingcubes/? I'm sorry for the amount of questions, but i'm new at vmtk and programming.. Best regards, Lia Silva |