Select Page

Formats: DFS

BrainSuite uses its own format for storing surface data. This format, which uses the extension .dfs, stores a list of triangles and vertices. It can also store information related to each vertex in the surface. The data fields currently allowed in the DFS files are: vertex normals, vertex colors, vertex UV coordinates, vertex labels, and vertex attributes. Vertex normals and vertex colors are represented as 3D vectors. Vertex UV coordinates, which can store information such as flatmap data for surface parameterization, are stored as pairs of floating point data. Vertex labels are 16-bit integers that can be used to identify structures or other regions of interest on the surface. Vertex attributes are 32-bit floating point numbers; this field can be used to store information such as surface curvature.

File Layout

The layout for the file consists of:

DFS Header A file description that provides number of triangles and vertices, as well as pointers to other data in the file
metadata embedded XML (not used)
subject data embedded XML (not used)
triangle data a list of triangles, specified by an (a,b,c) triple of 32-bit integer numbers
vertices a list of vertices, specified by an (x,y,z) triple of 32-bit floating point numbers
vertex normals vertex normal data (0 if not in file) (nx,ny,nz) in 32-bit floating point
vertex UV coordinates surface parameterization data (u,v) in 32-bit floating point
vertex colors per vertex color data in (r,g,b) format in 32-bit floating point ([0-1])
vertex labels per vertex label index specified in 16-bit integer format
vertex attributes vertex attributes (float32 array of length NV)

The header portion contains information such as the number of triangles (NT), the number of vertices (NV), and pointers to each of the data fields. The metadata and subject data areas are not currently used, but the layout is designed to store embedded XML to allow a variety of information to be stored in the file. The triangle data is a vector of NT triangles. Each triangle consists of 3 32-bit integers, so this data block is NT * 3 * 4 bytes in length. Each triangle specifying a triple of vertex indices that point into the vertex data block. The vertex indices are specified starting from zero with a maximum value of (NV-1). The vertex data block is of length NV * 3 * 4, as each vertex is represented by a triple of 32-bit floating point numbers.

All fields after the triangle and vertex data are optional. Each data field has NV elements, with the size of the element depending on the particular attribute. For example, UV coordinates are specified as pairs of 32-bit floating point numbers, so the vertex UV block will be of length NV * 2 * 4 if it is present.

The label and attribute fields can be used to store various types of scalar data. For example, the labels may be used to indicate anatomical areas or regions of interest. Similarly, the vertex attribute may be used to store curvature measures or activation measures.

C++ BrainSuite Surface File Reader/Writer

A reference implementation of a class that provides reading/writing capability for the BrainSuite surface files is provided here: dfsurface.h.

An example showing the use of this header is provided here: dfsexample.cpp