## Users Guide (2.3) - The Format Of SRF Files

- Details
- Category: File Formats
- Last Updated: 03 June 2021
- Published: 17 April 2018
- Hits: 1242

SRF files contain a description of mesh data structures, which are typically visualized in BrainVoyager's Surface window. The binary files consist of three main sections: the description of the vertices and vertex normals, the description of triangles build from the vertices and the description of the nearest neighbors for each vertex. When calculated and saved, SRF files may also contain a "triangle strip" data structure, which is only used for faster rendering. Rendering is performed using OpenGL.

BYTES | DATA TYPE | DEFAULT | DESCRIPTION |

4 | float | 4 | version number |

4 | int | 0 | surface type "0" -> default for reconstructed srfs and spheres, "1" -> reco srfs with extended set of (oblique) neighbors |

4 | int | NrOfVertices (number of vertices) | |

4 | int | NrOfTriangles (number of triangles) | |

4 | float | 128.0 | MeshCenterX |

4 | float | 128.0 | MeshCenterY |

4 | float | 128.0 | MeshCenterZ |

NrOfVertices*4 | float | VertexX, sequence of X coordinates of all vertices | |

NrOfVertices*4 | float | VertexY, sequence of Y coordinates of all vertices | |

NrOfVertices*4 | float | VertexZ, sequence of Z coordinates of all vertices | |

NrOfVertices*4 | float | NormalX, sequence of X components of all vertex normals (*1) | |

NrOfVertices*4 | float | NormalY, sequence of Y components of all vertex normals | |

NrOfVertices*4 | float | NormalZ, sequence of Z components of all vertex normals | |

4 | float | 0.322 | R component of convex curvature color (range: 0.0 - 1-0) |

4 | float | 0.733 | G component of convex curvature color (range: 0.0 - 1-0) |

4 | float | 0.980 | B component of convex curvature color (range: 0.0 - 1-0) |

4 | float | 1.000 | Alpha component of convex curvature color (range: 0.0 - 1-0) |

4 | float | 0.100 | R component of concave curvature color (range: 0.0 - 1-0) |

4 | float | 0.240 | G component of concave curvature color (range: 0.0 - 1-0) |

4 | float | 0.320 | B component of concave curvature color (range: 0.0 - 1-0) |

4 | float | 1.000 | Alpha component of concave curvature color (range: 0.0 - 1-0) |

NrOfVertices*4 | int | MeshColor, sequence of color indices, one for each vertex (*2) | |

Begin of loop over nearest neighbor data for each vertex |
|||

4 | int | N, number of nearest neighbors of vertex 1 | |

4 | int | Nearest neighbor 1 of vertex 1 | |

: | : | : | |

4 | int | Nearest neighbor N of vertex 1 | |

:: | :: | :: | |

4 | int | N, number of nearest neighbors of vertex 'NrOfVertices' | |

4 | int | Nearest neighbor 1 of vertex 'NrOfVertices' | |

: | : | : | |

4 | int | Nearest neighbor N of vertex 'NrOfVertices' | |

End of loop over nearest neighbor data |
|||

NrOfTriangles*3*4 | int | Sequence of three indices to constituting vertices of each triangle | |

4 | int | NrOfTriangleStripElements | |

NrOfStripElements*4 | int | Sequence of strip elements (if NrOfStripElements > 0) | |

N * 1 | char | Name of a MTC file, which will be auto-linked (ends with '0') or '0', if no MTC file | |

4 | float | Reconstructed from voxel resolution (SRF version 4 or higher) |

(*1) Note that for historical reasons, normals do not point outward but inward. You may want to multiply each normal component by "-1.0" for custom rendering.

(*2) Each vertex has one color index. An index value of 0 references the convex curvature color (stored after the normal vectors), a value of 1 references the concave curvature color (stored after the convec curvature color). Functional color look-up table values or RGB colors can also be represented (see below).

Details on color coding.

An RGB color is identified by an index value >= 1056964608. From the 4 byte index, the R, G and B component can be extracted as third byte from the right, second byte from the right and right most byte. These values are stored in a range from 0 - 255. For OPenGL rendering, they have to be divided by 255.0.

Colors for POIs are stored in color indices from 10000 - 10200. Like the basic (background) convex / concave colors, POI colors come also in pairs. The value 10000 codes the convex color of the POI 1, the value 10001 codes the concave color of POI 1, the value 10002 codes the convex color of POI 2, the value 10003 codes the concave color index of POI 3 and so on. The actual color values are stored in a POI color look-up table.

Colors for statistical look-up tables are stored in indices >= 1000. From 1000 - 1009, the positive color bar indices are stored and from 1010 - 1019, the negative color bar indices are stored. The actual colors are stored in the current functional look-up table.

As stated above, a color value of 0 codes the mesh's basic convex color, a value of 1 stores the mesh's concave color.