Dear Luca, 
I very much agree with your point, it's a great!
Thank you for the answer.
 
Best regards
 
YiQiang

--- 12年3月18日,周日, Luca Antiga <luca.ant...@orobix.com> 写道:


发件人: Luca Antiga <luca.ant...@orobix.com>
主题: Re: [vmtk-users] convert into c++
收件人: "Lia Silva" <liamak...@portugalmail.pt>
抄送: vmtk-users@lists.sourceforge.net
日期: 2012年3月18日,周日,下午7:56



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
home: lantiga.github.com
twitter: 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
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users


N鉶 foram detectados v韗us nesta mensagem.
Verificado por AVG - www.avg.com
Vers鉶: 2012.0.1913 / Base de dados de V韗us: 2114/4874 - Data de Lan鏰mento: 
03/16/12So, 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
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users


-----下面为附件内容-----


------------------------------------------------------------------------------
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
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users
------------------------------------------------------------------------------
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
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users

Reply via email to