[ITK-users] Suggestions about Python wrapping of cpp project

Michka Popoff michkapopoff at gmail.com
Fri Jul 25 02:58:50 EDT 2014


Vincent is right in the fact you have less debugging tools (in python for example).
Still, I never needed one for what I was doing, and my app has 50000 pure python lines. You have also very nice tools that integrate to vim, emacs and sublime text that do pep8, pyflakes and pylint checks each time you save the file, so that indentation or syntax errors get statically checked. About strict types, it depends a lot on what type of application you are running, and if this is really critical to you, you should not use python. If you need only integers, floats and strings, you may not need to care. And when code starts to be too long, break it up in classes and methods in different modules, and refactor :)

If your software will be used by beginners, letting them use it with python is very nice, and a lot of softwares are doing it (Paraview for example, but there are many others).
Even for more advanced users, it’s sometimes easier to start off with some python in a software they don’t know.
But I would not say you would get a spike in productivity for advanced users, they already know how to code in c++.
Still, Python is very mature, and as I said, I am running a pure python app to do multiprocessing computing on big files … and I am happy with it.

The question if it is worth to add python support is a difficult question. It depends how many time and the ressources you have to throw at it :)

On 25 juil. 2014, at 06:22, Satyananda Kashyap <ksatyananda at gmail.com> wrote:

> Thanks for your perspective Vincent. 
> 
> One of my initial questions were about the productivity boost which you get when using scripting languages. I am reasonably comfortable coding in C++ toolchain. From your experience do you really see a spike in productivity when you shift over. Is it worth the effort ?  
> 
> I think I will do some of the core development in C++ and expose them to Python. I wanted to use the scripting side more for prototyping and testing purposes. 
> 
> Regards,
> Kashyap
> 
> 
> On Thu, Jul 24, 2014 at 10:18 PM, vincent ngai <vincent.ngai at gmail.com> wrote:
> I'm no expert, but previously when I worked on projects where we exposed almost all core functionalities via scripts, it seemed like a good initially, but what really happened is a shifting of complexities. Rather than have the complexity on the C++/Compiled codebase side shifted over to the scripts, in situation where you need to be able to change functionality without recompiling the source, or even have access to the source, scripts are the way to go. But shifting complexities to the runtime/script side has its own issues, I'm happy with the C/C++ toolchain maturity, Visual C++, GCC, GDB etc, you have very comprehensive debugging and editor facilities available for C++, but on the script side you have far less tools, and debugging may be a hassle. 
> 
> Also for scripts that are scoped by whitespace/tabs and are not strictly typed, we found that scripts exceeding 1/2 pages in length tend to be less maintainable, and the chances of nuking a whitespace or overwriting a variable gets higher.
> 
> Just my 2 cents
> 
> On Wed, Jul 23, 2014 at 11:11 PM, Satyananda Kashyap <ksatyananda at gmail.com> wrote:
> Hello,
> 
> I am looking for your expert opinions here. I have a relatively large C++ project I am working on which uses ITK mainly (hence the question here) and to some extent VTK and OpenCV. I do think that my code is fairly well written. I was thinking of wrapping my code to python using either SWIG or boost.python. Here are my questions : 
> 
> 
> 1. I am led to believe that prototyping and code development is much faster in Python. Given that I have such a big cpp base code is it really worth the effort to wrap into python and then continue there. 
> 
> 2. From what I have read ITK uses SWIG wrappings for wrapping into Python while VTK uses the boost.python route. My initial attempts with both have been relatively unsuccessful. Any opinion on which one is more user friendly/better when I have to wrap my own custom classes which use a combination of both ITK and VTK in them. 
> 
> 3. Any suggestion on a road map as to how to proceed. I am not sure at what base class level I should wrap them and rewrite the dependencies in python.  
> 
> Thanks,
> Regards,
> Kashyap
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
> 
> 
> 
> 
> -- 
> Regards,
> Vincent
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20140725/5874b68e/attachment.html>


More information about the Insight-users mailing list