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

Kosma Dunikowski k.dunikowski at pixel.com.pl
Wed Sep 13 06:45:48 EDT 2017


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



More information about the Insight-users mailing list