This is a simple evaluation of different mesh formats used in neuroimaging. Feel free to suggest changes to optimize performance. JavaScript demonstrates a lot of speed variability. To mitigate this, each format is converted 10 times, with the time for the first run omitted.
A few notes on the formats:
- GIfTI uses
GZipBase64Binary
with the optimalRowMajorOrder
. - mz3 tested as both GZip compressed and raw formats.
- OBJ is an ASCII format, so a choice must be made regarding file size and precision.
- STL format does not re-use vertices. The resulting mesh will appear faceted and use more GPU resources unless one applies a computationally expensive operation to weld vertices.
- jmsh is a JSON-based general purpose geometry/mesh-data container based on the JMesh and JData specifications; it is human-readable and widely parsable
- bmsh is a binary-JSON (BJData - Draft 2) based mesh-data container based on the JMesh specification; both
.bmsh
and.jmsh
support data-level compression - json is a minimized plain JSON file using JMesh annotations without compression
This is a simple node.js function that you can replicate on your own computer:
$ npm install gifti-reader-js atob numjs pako buffer
$ git clone https://github.com/neurolabusc/MeshFormatsJS.git
$ cd MeshFormatsJS
$ node ./meshtest.js
gifti.gii Size 4384750 Time 2111
gz.mz3 Size 3259141 Time 541
raw.mz3 Size 5898280 Time 31
obj.obj Size 13307997 Time 5318
stl.stl Size 16384084 Time 1075
zlib.jmsh Size 4405604 Time 660
zlib.bmsh Size 3259049 Time 479
raw.min.json Size 12325881 Time 1239
raw.bmsh Size 5898902 Time 38