[ITK-users] [ITK] Generating compatible Java wrappings of SimpleITK between Windows and Linux (x86-64)

Lowekamp, Bradley (NIH/NLM/LHC) [C] blowekamp at mail.nih.gov
Wed Sep 13 13:14:11 EDT 2017


Hello,

That you for posting the issue.

Can you please create an issue for this problem in SimpleITK’s Github issue tracker:
https://github.com/SimpleITK/SimpleITK/issues

I recall looking into this problem some time ago and not being happy with this inconsistent interface for Java that SWIG generated. It should be consistent. There is not much to how we specify the interface for Java, so this is really SWIG will need to be fixed to get our interface proper.

Unfortunately, the mixture of type long and BinInteger is complicated since the long type cannot be implicitly converted to a BigInteger. In our generated code for testing we added a class to help with this conversion. Depending on your usage this may be a useful approach.

Thanks,
Brad

On 9/13/17, 6:46 AM, "Kosma Dunikowski" <k.dunikowski at pixel.com.pl> wrote:

    Hi,
    
    I'm having a problem with swig-generated Java wrappings on both Windows 
    and Linux. I'm getting different method signatures all over the place, e.g:
    
    Windows:
    public void add(long x) {
          SimpleITKJNI.VectorInt64_add(swigCPtr, this, x);
    }
    
    Linux:
    public void add(int x) {
          SimpleITKJNI.VectorInt64_add(swigCPtr, this, x);
    }
    
    Windows:
    public java.math.BigInteger getPixelAsUInt64(VectorUInt32 idx) {
          return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, 
    VectorUInt32.getCPtr(idx), idx);
    }
    
    Linux:
    public long getPixelAsUInt64(VectorUInt32 idx) {
          return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, 
    VectorUInt32.getCPtr(idx), idx);
    }
    
    (full diff @ 
    https://drive.google.com/a/pixel.com.pl/file/d/0Bzm8rPONV4SJOTA4R0tHTXFPWms/view?usp=sharing)
    
    As you can see there are some differences in data sizes. So far I've 
    tried building it with swig 3.0.8, 3.0.9, 3.0.12 and a patched fork 
    mentioned at https://github.com/swig/swig/pull/649 with similar results. 
    I'm using ITK v4.10.0 and SimpleITK v0.10.0 but I've also tried the 
    latest releases. As for the compilers, I used multiple versions of gcc 
    on Linux and mingw-w64 and Visual Studio on Windows.
    
    I've tried manually undefining SWIGWORDSIZE64 on Linux (which is enabled 
    if SITK_ULONG_SAME_AS_UINT64 test passes), which resulted in matching 
    wrappings but also immediate segfaults after I tried using it.
    
    If anyone knows how to tackle this problem, I would greatly appreciate 
    it, since I'm unable to maintain separate Java codebases for different 
    platforms.
    
    Best regards,
    
    Kosma Dunikowski
    
    _____________________________________
    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
    _______________________________________________
    Community mailing list
    Community at itk.org
    http://public.kitware.com/mailman/listinfo/community
    



More information about the Insight-users mailing list