BrainSuite Curve Format
BrainSuite uses a special format for storing curve data, such as for representing sulcal landmarks on the cortical surface. This format, which uses the extension .dfc, can store multiple curves in a single file, as well as metadata that represents names and colors for each curve. It can also store an entire delineation protocol, which will be displayed in the sulcal delineation tool. The layout of the file is as follows
|DFC Header||A file description that provides number of curves, as well as pointers to other data in the file|
|subject data||embedded XML (not used)|
|curve data||number of points in curve, followed by float triples|
The header portion, detailed below, includes information about the number of curves stored in the file, as well as pointers to the start of the data fields. The metadata field is used to indicate curve colors, and can also include an XML description of a delineation protocol.
|0||magic||char||An 8 character string designating the filetype (‘DFC_LE\0\0’ or ‘DFC_BE\0\0’*).|
|8||version||uint8||4 unsigned characters, representing the version number (e.g., 188.8.131.52)|
|12||header size||int32||size of the stored header|
|16||data start||int32||offset from beginning of file to where the curves are stored|
|20||metadata offset||int32||offset from beginning of file to where the metadata are stored|
|24||subject data offset||int32||offset from beginning of file to where the subject data are stored (not currently used)|
|28||# of contours||int32||number of curves stored in file|
*DFC_LE or DFC_BE can specify the endianess of the data.
The curve data section of the file begins at position
datastart, and is stored sequentially as
where NC is the number of curves stored in the file.
Each curve is represented as:
where N is a 32-bit integer representing the number of points in the curve, and (xn,yn,zn) is the n-th point, represented by 3 32-bit floating point numbers. Thus, a curve with N curves will be stored in 4 + 3*4*N bytes. The curves are stored contiguously.
MATLAB Curve File Reader
The following is a simple implementation of a function to read DFC files in MATLAB.