Supressing/eliminating python wrapping warnings

Hi,

I’ve been using a custom build of ITK (v5.4.2) with python wrapping for some time. We also happen to wrap some extra types, image and vector dimensions as part of the build, i.e.,

When initialising the library from python, we get the following couple of wrapping type warnings, whilst annoying they are harmless.

However, I’ve recently upgraded the build to v5.4.4 and in addition to the itk.FixedArray warnings we’re now getting a bunch of new ones, which I assume related to our use of ITKMontage. See attached text file.

itk_warnings.txt (13.1 KB)

I tried looking into modifying some wrap files, however haven’t had much success. I’d really like to know if it is possible to eliminate these warnings, or failing that can someone suggest a way we can at least suppress their display?

Regards,

Darren Thompson

Wrapping code is here:

Warning: Unknown parameter warnings usually indicate some real problems, so they should not be suppressed.

Hi @dzenanz, thanks for pointing me to the wrap file.

After some experimentation, I think I found a solution by adding an additional double parameter to the template parameter list for the interpolation functions.

For example:

itk_wrap_template("${ITKM_I${t}${d}}${abbr}" "${ITKT_I${t}${d}}, double, itk::${iif}<${ITKT_I${t}${d}}, double>")

I no longer get all the warnings when in python.

FYI, I’ve also created a PR for this at COMP: Add extra double parameter to InterpolateImageFunction wrapping templates by darrent1974 · Pull Request #236 · InsightSoftwareConsortium/ITKMontage · GitHub

BTW, I’d still like to figure out a way to get rid of the itk::FixedArray warnings too.

1 Like

What file/compilation unit tries to compile FixedArray? Can you provide a bit of build log around:

Template itk::FixedArray<double,4>
 already defined as <class 'itk.itkFixedArrayPython.itkFixedArrayD4'>
 is redefined as <class 'itk.itkFixedArrayPython.itkFixedArrayD4'>
Warning: template already defined 'itk::FixedArray<double,4>'

I think I’ve now found the problem with this one too and have submitted a proposed PR to resolve it. See, COMP: Add extra check for itk::FixedArray wrapping by darrent1974 · Pull Request #5492 · InsightSoftwareConsortium/ITK · GitHub

1 Like