Skip to content

Endianness affects meshing #41

@davidackerman

Description

@davidackerman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions