InsightSoftwareConsortium / InsightSoftwareConsortium/ITK-Wasm
IWM format specification
- Dominant language
- Python
- Stars
- 235
- Forks
- 61
- Avg merge
- 4d 19h
- Merged PRs (30d)
- 4
Description
The [docs provide an example of converting ](https://docs.itk.org/en/latest/learn/python_quick_start.html) that is a [Serialization]((https://wasm.itk.org/en/latest/introduction/file_formats/index.html)) of a [Mesh](https://wasm.itk.org/en/latest/typescript/interface_types/Mesh.html) . However, the definition of the Cell is never specified, even in the [section 4.3.2 Inserting Cells](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch4.html#x38-640004.3). To make my question concrete, consider the provided example of the 'cow.vtk' format converted to 'cow.iwm.cbor':
The cow.vtk provides vertex indices for quads (4 vertices) and triangles (3 vertices)
```
POLYGONS 3263 15593
4 250 251 210 252
4 252 210 201 253
3 253 201 254
4 254 255 256 253
```
However, the cow.iwm.cbor cells includes an additional element that in this example is always 4 for quads and 2 for triangles. What is the purpose of the element - for this example it just makes the file size larger, but presumably it has the potential to have other values. While I can write a reader for the provided example, I fear it will be fragile if I do not know what this value is supposed to mean. Is 2 a constant for [TriangleCell](https://itk.org/Doxygen/html/classitk_1_1TriangleCell.html)
```
4 4 250 251 210 252
4 4 252 210 201 253
2 3 253 201 254
4 4 254 255 256 253
```
Based on [4.3.8 Iterating Through Cells](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch4.html#x38-640004.3) my best guess is that this is the enum for cell type:
```
0 VERTEX_CELL
1 LINE_CELL
2 TRIANGLE_CELL
3 QUADRILATERAL_CELL
4 POLYGON_CELL
...
```
If this is the case, is there any reason the quads are not listed as `QUADRILATERAL_CELL` and not `POLYGON_CELL` types? It does seem that for VERTEX_CELL...QUADRILATERAL_CELL the number of indices is explicit, so this seems to lead to large file sizes than necessary. I understand there are always tradeoffs in file formats for consistency across types versus efficiency, I just want to make sure I understand the logic.

Contributor guide
Assessment
This issue has not been assessed yet.