Python wrapping for 64-bit double `itk::Mesh` coordinates?

Is there a Python wrapping of itk::Mesh for 64-bit floating point (double) coordinates of its points?

In C++, an itk::Mesh has 32-bit float coordinates by default, but it can be set to 64-bit double by some “mesh traits”:

// 64-bit `double` coordinates
using MeshType = itk::Mesh<int, 2, itk::DefaultStaticMeshTraits<int, 2, 2, double>>;

Could something like that be made possible in Python?

// Possible with itk python wrappings?
mesh = itk.Mesh[itk.D, 2, itk.DefaultStaticMeshTraits[itk.D, 2, 2, itk.D]].New()

@Pranjal_Sahu or @Tom_Birdsong might know. But I doubt this is possible with default Python builds (e.g. PyPI wheels).

1 Like

Hi @Niels_Dekker, yes, from what I can tell your proposed implementation is the best way to accomplish this. I do not believe there is are mesh wrappings with double coordinates in the ITK Python wheels at the moment.

1 Like

It can be done. But it’s not present.

Probably to keep limited number of options.

1 Like

@dzenanz @Tom_Birdsong @Pranjal_Sahu Thanks for your useful replies so far.

FYI I would find 64-bit floating point support for a Python itk.Mesh interesting, especially because in Python, the built-in floating point type also corresponds with 64-bit double: sys — System-specific parameters and functions — Python 3.10.6 documentation So supporting double as mesh coordinate type would allow Python users to pass their floating point data to an itk.Mesh in a lossless way.