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
>>>> 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ão foram detectados vírus nesta mensagem.
>>>> Verificado por AVG - 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
>>> vmtk-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/vmtk-users
>> 
>> Não foram detectados vírus nesta mensagem.
>> Verificado por AVG - 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

------------------------------------------------------------------------------
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