Skip to content

meshconvert: invalid binary vtk files #2593

@neurolabusc

Description

@neurolabusc

Describe the bug

meshconvert 3.03 with MacOS x86_64 executable creates binary vtk files that use little-endian order. This conflicts with the VTK format which requires thatVTK data files described here are written in big endian form.

To Reproduce

Consider a mesh named plane.obj with the contents:

v 0 0 0
v 1 0 0
v 1 1 0
v 0 1 0
f 1 2 3
f 1 3 4

Run the commands

meshconvert plane.obj plane.vtk
meshconvert -binary plane.obj bplane.vtk

Note that the ASCII plane.vtk is a valid VTK file. However, the binary bplane.vtk is unable to be opened with VTK viewers like Surfice or Slicer3D.

mrtrix

Using a hex editor reveals the error: both the vertices and faces are being stored in the native little-endian order, rather than the required big-endian format.

As an aside, saving vertex position as double instead of float seems excessive.

Platform/Environment/Version

Please provide the following information:

  • OS: macOS: `11.7

  • MRtrix3 version == mrinfo 3.0.3 ==

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions