[ITK-users] itk::RayCastInterpolateImageFunction for ITK Python Wrap

D'Isidoro Fabio fisidoro at ethz.ch
Sun Mar 27 15:41:37 EDT 2016


Thank you. 

I downloaded ITK with Git from: http://www.itk.org/Wiki/ITK/Git and built it with Visual Studio and the ITK_WRAP_PYTHON option (I had one this procedure many times already before). Unfortunately my build (8 hours on my laptop, without BUILD_EXAMPLES) was unsuccessful. Apparently there are mistakes related to itk:NumericTraits (see below a part of it):

...
$NumericTraits at H@itk@@2HB) already defined in itkAbsImageFilterPython.obj
503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005: "public: static unsigned int const itk::NumericTraits<unsigned int>::Zero" (?Zero@?$NumericTraits at I@itk@@2IB) already defined in itkAbsImageFilterPython.obj
503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005: "public: static unsigned int const itk::NumericTraits<unsigned int>::One" (?One@?$NumericTraits at I@itk@@2IB) already defined in itkAbsImageFilterPython.obj
503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005: "public: static long const itk::NumericTraits<long>::Zero" (?Zero@?$NumericTraits at J@itk@@2JB) already defined in itkAbsImageFilterPython.obj
503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005: "public: static long const itk::NumericTraits<long>::One" (?One@?$NumericTraits at J@itk@@2JB) already defined in itkAbsImageFilterPython.obj
503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005: "public: static bool const itk::NumericTraits<bool>::Zero" (?Zero@?$NumericTraits at _N@itk@@2_NB) already defined in itkAbsImageFilterPython.obj
503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005: "public: static bool const itk::NumericTraits<bool>::One" (?One@?$NumericTraits at _N@itk@@2_NB) already defined in itkAbsImageFilterPython.obj
503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005: "public: static unsigned long const itk::NumericTraits<unsigned long>::Zero" (?Zero@?$NumericTraits at K@itk@@2KB) already defined in itkAbsImageFilterPython.obj
503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005: "public: static unsigned long const itk::NumericTraits<unsigned long>::One" (?One@?$NumericTraits at K@itk@@2KB) already defined in itkAbsImageFilterPython.obj
503>     Creating library C:/Users/difabio/ITK_49_Wrap/lib/Release/ITKImageIntensityPython.lib and object C:/Users/difabio/ITK_49_Wrap/lib/Release/ITKImageIntensityPython.exp
503>C:\Users\difabio\ITK_49_Wrap\lib\Release\_ITKImageIntensityPython.pyd : fatal error LNK1169: one or more multiply defined symbols found
529>------ Build started: Project: ALL_BUILD, Configuration: Release Win32 ------
529>  Building Custom Rule C:/Users/difabio/ITK/CMakeLists.txt
529>  CMake does not need to re-run because C:\Users\difabio\ITK_49_Wrap\CMakeFiles\generate.stamp is up-to-date.
========== Build: 452 succeeded, 77 failed, 0 up-to-date, 0 skipped ==========


In my Cmake build configuration, I remember I added the data type "double" and maybe also "unsigned float" to the standard ones. May this be the problem?

Any help would be appreciated. Thanks.

-----Original Message-----
From: Michka Popoff [mailto:michkapopoff at gmail.com] 
Sent: Sonntag, 27. März 2016 11:20
To: Matt McCormick
Cc: D'Isidoro Fabio; insight-users at itk.org
Subject: Re: [ITK-users] itk::RayCastInterpolateImageFunction for ITK Python Wrap

Patch has been merged. You should now be able to use it.
Thanks Matt for the quick review.

Michka

> On 27 Mar 2016, at 03:59, Matt McCormick <matt.mccormick at kitware.com> wrote:
> 
> Hi,
> 
> Here are some pointers to relevant documentation:
> 
> How to add wrapping for a filter:
> http://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch9.h
> tml#x50-1500009.5
> 
> How to perform a review:
> https://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySo
> ftwareProcess/PerformAGerritReview/index.html
> 
> How to download ITK with Git: http://www.itk.org/Wiki/ITK/Git
> 
> Hope this helps,
> Matt
> 
> On Sat, Mar 26, 2016 at 2:41 PM, Michka Popoff <michkapopoff at gmail.com> wrote:
>> I can notify you once it is merged to the master branch of ITK.
>> This should be fast (as soon as it gets reviewed).
>> 
>> Wrapping new functions/classes is made by adding a .wrap file in the 
>> corresponding “wrapping" folder of the module.
>> I often just copy-paste a similar .wrap file an adapt it. There are 
>> sometimes some surprise, and the .wrap file needs to be tweaked.
>> 
>> Not sure if we have a guide on how to do it.
>> Some cases like this one are really easy to implement, some others 
>> are more involved.
>> 
>> Once the patch is merged, you will need to build ITK from source.
>> This is pretty easy: 
>> http://www.itk.org/Wiki/ITK/Configuring_and_Building
>> We can assist you if there are problems.
>> 
>> Writing your own filter in Python is doable; but I never tried such thing.
>> It would be a nice proof-of-concept to get something like this to run.
>> But this is probably more work than it is worth.
>> 
>> If you can wait a few days until the patch is merged, and are willing 
>> to build ITK from source, the python solution is probably the easiest.
>> 
>> Michka
>> 
>> 
>> On 26 Mar 2016, at 19:27, D'Isidoro Fabio <fisidoro at ethz.ch> wrote:
>> 
>> Thank you for your reply.
>> 
>> I miss the skills to test/review that patch. I do not know how to 
>> wrap a C++ code to Python. Is there any relatively easy guide for it?
>> 
>> Also, what are my possibilities now? Writing my own RayCasting Filter 
>> in Python and possibly use it as interpolator for the 
>> ResampleImageFilter Filter? Or necessarily turn to C++ forgetting about Python?
>> 
>> Thanks
>> 
>> From: Michka Popoff [mailto:michkapopoff at gmail.com]
>> Sent: Samstag, 26. März 2016 19:16
>> To: D'Isidoro Fabio
>> Cc: insight-users at itk.org
>> Subject: Re: [ITK-users] itk::RayCastInterpolateImageFunction for ITK 
>> Python Wrap
>> 
>> Hi
>> 
>> The function was not wrapped at all.
>> Most of them are, and the remaining are added slowly, mostly 
>> on-demand (for the moment).
>> 
>> I made a patch which you can test/review here:
>> http://review.source.kitware.com/#/c/20945/
>> 
>> We can probably add it to the 4.9.1 release; else it will land in the 
>> ITK
>> 4.10 release.
>> 
>> Michka
>> 
>> 
>> On 26 Mar 2016, at 17:13, D'Isidoro Fabio <fisidoro at ethz.ch> wrote:
>> 
>> Hallo,
>> 
>> I am trying to implement my own Digital Radiograph Reconstruction 
>> algorithm with ITK v 4.8 Python Wrap. I have looked on the web and 
>> found examples that make use of the 
>> itk::RayCastInterpolateImageFunction. However, it seems that this function has not been wrapped for Python because I get the error:
>> 
>> ‘LazyITKModule’ object has not attribute ‘RayCastInterpolateImageFunction’
>> 
>> Any help? Hast this been done in the new 4.9 Version or what do you 
>> suggest for me to do?
>> 
>> Thank you.
>> 
>> Fabio
>> 
>> _____________________________________
>> 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
>> 
>> 
>> 
>> _____________________________________
>> 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
>> 



More information about the Insight-users mailing list