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

Matt McCormick matt.mccormick at kitware.com
Tue Mar 29 12:12:54 EDT 2016


Hi Fabio,

Yes, the build issues are unrelated to the wrapping, and you can try
out the wrapping patch only by starting from ITK 4.9.0. I merged the
patch to the release branch, so it can be tested by:

  cd /path/to/ITK
  git checkout -b release origin/release
  git pull

HTH,
Matt

On Tue, Mar 29, 2016 at 11:09 AM, D'Isidoro  Fabio <fisidoro at ethz.ch> wrote:
> Hi Matt,
>
> While waiting for the python Wrap to be ready I have tried to build ITK normally (no Python Wrap) on Visual Studio. The result of the build was:
>
> ========== Build: 213 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>
> And the failed one was:
>
> ....
> 159>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 itkTestDriver.obj
> 159>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 itkTestDriver.obj
> 159>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 itkTestDriver.obj
> 166>------ Build started: Project: ITKOptimizersv4, Configuration: Release Win32 ------
> 166>  Building Custom Rule C:/Users/difabio/ITK/Modules/Numerics/Optimizersv4/src/CMakeLists.txt
> 159>C:\Users\difabio\ITK_build_cpp\bin\Release\itkTestDriver.exe : fatal error LNK1169: one or more multiply defined symbols found
>
> Can I work with this build or I still need to wait, also for building ITK without python wrapping?
>
> And for building ITK without python wrap, would it be different if I downloaded the release version rather than the Git version?
>
> Thanks
>
> ----------------------------------------------------------------------
> Fabio D’Isidoro
> PhD Student – Institute for Biomechanics, ETH Zürich
> HPP O 14, Schafmattstrasse 30, 8093 Zuerich, Switzerland
> Tel: +41 44 633 40 60
>
>
> -----Original Message-----
> From: Matt McCormick [mailto:matt.mccormick at kitware.com]
> Sent: Montag, 28. März 2016 15:13
> To: Michka Popoff
> Cc: D'Isidoro Fabio; insight-users at itk.org
> Subject: Re: [ITK-users] itk::RayCastInterpolateImageFunction for ITK Python Wrap
>
> @Michka,
>
> Yes, good idea to check the dashboard.  This is a known issue related to recent development, probably this patch:
>
>   http://review.source.kitware.com/#/c/20905/
>
> I will start a Windows build to investigate.
>
>
> @Fabio,
>
> Make sure to also have BUILD_TESTING turned off on your build.  All Visual Studio wrapping builds should be markedly faster after we merge this patch:
>
>   http://review.source.kitware.com/#/c/20208/
>
>
> Thanks,
> Matt
>
> On Mon, Mar 28, 2016 at 5:58 AM, Michka Popoff <michkapopoff at gmail.com> wrote:
>> I just looked at our buildbots, this problem is also popping up here:
>> https://open.cdash.org/viewBuildError.php?buildid=4297981
>>
>> The errors are similar. We will have to fix them.
>>
>> Matt, do you have an idea what that could be ?
>> I will not have time to setup a Windows build anytime soon.
>>
>> Michka
>>
>>
>>> On 27 Mar 2016, at 21:41, D'Isidoro Fabio <fisidoro at ethz.ch> wrote:
>>>
>>> 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:
>>> 503>"public: static unsigned int const itk::NumericTraits<unsigned
>>> 503>int>::Zero" (?Zero@?$NumericTraits at I@itk@@2IB) already defined in
>>> 503>itkAbsImageFilterPython.obj
>>> 503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005:
>>> 503>"public: static unsigned int const itk::NumericTraits<unsigned
>>> 503>int>::One" (?One@?$NumericTraits at I@itk@@2IB) already defined in
>>> 503>itkAbsImageFilterPython.obj
>>> 503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005:
>>> 503>"public: static long const itk::NumericTraits<long>::Zero"
>>> 503>(?Zero@?$NumericTraits at J@itk@@2JB) already defined in
>>> 503>itkAbsImageFilterPython.obj
>>> 503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005:
>>> 503>"public: static long const itk::NumericTraits<long>::One"
>>> 503>(?One@?$NumericTraits at J@itk@@2JB) already defined in
>>> 503>itkAbsImageFilterPython.obj
>>> 503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005:
>>> 503>"public: static bool const itk::NumericTraits<bool>::Zero"
>>> 503>(?Zero@?$NumericTraits at _N@itk@@2_NB) already defined in
>>> 503>itkAbsImageFilterPython.obj
>>> 503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005:
>>> 503>"public: static bool const itk::NumericTraits<bool>::One"
>>> 503>(?One@?$NumericTraits at _N@itk@@2_NB) already defined in
>>> 503>itkAbsImageFilterPython.obj
>>> 503>ITKCommon-4.10.lib(itkNumericTraits.obj) : error LNK2005:
>>> 503>"public: static unsigned long const itk::NumericTraits<unsigned
>>> 503>long>::Zero" (?Zero@?$NumericTraits at K@itk@@2KB) already defined
>>> 503>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
>>> 503>C:/Users/difabio/ITK_49_Wrap/lib/Release/ITKImageIntensityPython.
>>> 503>lib and object
>>> 503>C:/Users/difabio/ITK_49_Wrap/lib/Release/ITKImageIntensityPython.
>>> 503>exp
>>> 503>C:\Users\difabio\ITK_49_Wrap\lib\Release\_ITKImageIntensityPython
>>> 503>.pyd : fatal error LNK1169: one or more multiply defined symbols
>>> 503>found
>>> 529>------ Build started: Project: ALL_BUILD, Configuration: Release
>>> 529>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/Community
>>>> So 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