zmesh icon indicating copy to clipboard operation
zmesh copied to clipboard

Endianness affects meshing

Open davidackerman opened this issue 9 months ago • 0 comments

Hello,

I have noticed that the endianness of the labels array affects the ids that the mesher reports. For example

import zmesh
import numpy as np

for endian in ['<','>']:
    labels = np.zeros((11, 17, 19), dtype=np.dtype(f'{endian}i8'))
    labels[1:-1, 1:-1, 1:-1] = 1

    mesher = zmesh.Mesher((4, 4, 40))
    mesher.mesh(labels)

    print(f"{endian} endian, ids: {mesher.ids()}")

results in:

< endian, ids: [1]
> endian, ids: [72057594037927936]

I can fix the problem by swapping the byteorder, but figured I'd point it out. I had noticed a similar fix in the skeletonization code.

davidackerman avatar May 10 '24 15:05 davidackerman