BVQX fileformats - GLM
From BVwiki
GLM files
A GLM file contains the result of a multiple regression analysis, either performed on a single or across multiple runs (of multiple subjects). In the most simple case, a GLM is based on the functional data (time course data) of one experimental run in slice space (FMR project), transformed 3D space (VMR/VTC project), or from a mesh (SRF/MTC). The binary file contains a variable-length header followed by the actual stack of 3D mapped data.
In the following, the header definition is shown as introduced with BrainVoyager 2000, version 4.4, and extended to version 3 in BrainVoyagerQX version 1.6. Older GLM's with header version 1 can still be read by the latest BrainVoyagerQX versions. Because of the newly introduced features, it is, however, recommended to recompute GLM's. All names, i.e. for files or predictors, are C-type strings with characters represented by unsigned chars. All strings are terminated with '\0'. Therefore an empty string consists of just one byte ('\0').
All datatypes with more than one byte (short int, long int, float, etc.) are stored in little endian format into the files.
Fileformat (all versions)
| C-style header fieldname | Datatype | Bytes | Sample/default value | Description |
| versionNr | short int | 2 | 0x0003 | File version (1, 2, or 3) |
| projectType | unsigned char | 1 | 0x0001 | Project type, 0x0: FMR-GLM, 0x1: VTC-GLM, 0x2: MTC-GLM |
| projectTypeRFX | unsigned char | 1 | 0x0001 | Is GLM a RFX-GLM (only present for Fileversion > 2) |
| nrOfSubjects | long int | 4 | 0x0000000a | Number of subjects (only present if projectTypeRFX > 0) |
| nrOfSubjectPredictors | long int | 4 | 0x00000004 | Number of predictors per subject (only present if projectTypeRFX > 0) |
| nrOfTimePoints | long int | 4 | 0x000000fa | Number of time points (overall number, all runs) |
| nrOfPredictors | long int | 4 | 0x00000004 | Number of predictors (one map per predictor is stored) |
| nrOfStudies | long int | 4 | 0x00000001 | Number of studies (overall number of analyzed runs) |
| sepFlag | unsigned char | 1 | 0x00 | Separate predictors for 0x0: none, 0x1: each study, 0x2: each subject |
| zFlag | unsigned char | 1 | 0x00 | Time course z-Transform flag, 0x0: untransformed, 0x1: z-transformed, 0x3: percent-transformed |
| resolution | short int | 2 | 0x0003 | Voxel resolution in mm |
| From here, the file format differs for versions! Fields in File version 1: | ||||
| XStart | short int | 2 | 0x0039 | XStart position |
| XEnd | short int | 2 | 0x00e7 | XEnd position |
| YStart | short int | 2 | 0x0034 | YStart position |
| YEnd | short int | 2 | 0x00ac | YEnd position |
| ZStart | short int | 2 | 0x003b | ZStart position |
| ZEnd | short int | 2 | 0x00c5 | ZEnd position |
| Fields in File version 2/3: | ||||
| sercorFlag | unsigned char | 1 | 0x0000 | Serial correlation flag, 0x0: not performed, 0x1: performed |
| meanAR1Pre | float | 4 | 0xc0000000 | Mean auto regression lag1 without correction (-2.0, not used) |
| meanAR1Post | float | 4 | 0xc0000000 | Mean auto regression lag1 after correction (-2.0, not used) |
| From here, the file format differs for Project type (File version 2/3)! Fields in files for FMR-GLM (Type 0): | ||||
| NrOfColumns | short int | 2 | 0x0040 | X resolution, number of columns |
| NrOfRows | short int | 2 | 0x0040 | Y resolution, number of rows |
| NrOfSlices | short int | 2 | 0x001b | Z resolution, number of slices |
| Fields in files for File version 2/3, VTC-GLM (Type 1): | ||||
| XStart | short int | 2 | 0x0039 | XStart position |
| XEnd | short int | 2 | 0x00e7 | XEnd position |
| YStart | short int | 2 | 0x0034 | YStart position |
| YEnd | short int | 2 | 0x00ac | YEnd position |
| ZStart | short int | 2 | 0x003b | ZStart position |
| ZEnd | short int | 2 | 0x00c5 | ZEnd position |
| Fields in files for File version 2/3, MTC-GLM (Type 2): | ||||
| nrVertices | long int | 4 | 0x0000a002 | Number of vertices in mesh (40962 for standard spheres) |
| Further fields for File version 2/3, all Types: | ||||
| cbsFlag | unsigned char | 1 | 0x00 | Cortex based statistics used, 0x0: no, 0x1: yes |
| nrOfVoxelsBonfCorr | long int | 4 | 0xffffffff | Number of voxels for Bonferroni correction (-1: disabled) |
| cortexBasedFile | char[] | 1+N | '\0' | Name of cortex based stastics mask file (default: empty) |
| Remaining fields for all File versions again: | ||||
| Begin of loop 1:Number of studies | ||||
| nrOfTimePoints | long int | 4 | 0x000000fa | Number of time points for this MTC |
| analyzedFilename | char[] | 1+N | '\0' | Filename of file analyzed |
| ssmFilename | char[] | 1+N | '\0' | Filename of SSM file (only for Project Type MTC=2) |
| rtcFilename | char[] | 1+N | '\0' | Filename of RTC file |
| End of loop 1:Number of studies | ||||
| Begin of loop 1:Number of predictors | ||||
| predictorName1 | char[] | 1+N | '\0' | Internal name of predictor |
| predictorName2 | char[] | 1+N | '\0' | User specified name of predictor |
| predictorColorCodes | unsigned char | 4*3 | RGB color coding | |
| End of loop 1:Number of predictors | ||||
| From here, the file format differs, for non-RFX GLM's: | ||||
| designMatrix | float32 | 4*t*p | Design matrix (t = Number of time points, p = Number of predictors) | |
| iXX | float32 | 4*p*p | Pseudo inverse of XX (only present in File versions > 1) | |
| multipleRegrR | float32 | 4*d | Multiple regression R values (d = Number of voxels/vertices) | |
| mCorrSS | float32 | 4*d | Sum of Squares | |
| BetaMaps | float32 | 4*d*p | Beta maps | |
| XY | float32 | 4*d*p | Fitted data after regression (only present in File versions > 1) | |
| timeCourseMean | float32 | 4*d | Time course mean (only present in File versions > 1) | |
| arLag1 | float32 | 4*d | Auto-regression Lag value (only if SerialCorrelation > 0) | |
| From here, fields are for RFX GLM's: | ||||
| rfxGlobalMap | float32 | 4*d | 1 ... | Currently unused map |
| Begin of loop 1:Number of subjects | ||||
| Begin of loop 1:Number of subject predictors | ||||
| subjectPredictorMap | float32 | 4*d | 1 ... | Beta maps for unique subject/predictor combinations |
| End of loop 1:Number of subject predictors | ||||
| End of loop 1:Number of subjects | ||||
Sample file (hexdumped)
00000000 03 00 01 00 fa 00 00 00 04 00 00 00 01 00 00 00 |................| 00000010 00 00 03 00 00 00 00 00 00 00 00 00 00 39 00 e7 |.............9..| 00000020 00 34 00 ac 00 3b 00 c5 00 00 6f d3 00 00 00 fa |.4...;....o.....| 00000030 00 00 00 43 3a 2f 54 45 4d 50 2f 44 54 2f 47 4c |...C:/TEMP/DT/GL| 00000040 4d 33 2f 43 47 5f 4f 42 4a 45 43 54 53 5f 33 44 |M3/CG_OBJECTS_3D| 00000050 4d 43 5f 53 43 53 41 49 5f 53 44 33 44 53 53 34 |MC_SCSAI_SD3DSS4| 00000060 2e 30 30 6d 6d 5f 4c 54 52 5f 54 48 50 33 63 5f |.00mm_LTR_THP3c_| 00000070 54 41 4c 2e 76 74 63 00 49 6e 74 65 72 61 63 74 |TAL.vtc.Interact| 00000080 69 76 65 00 50 72 65 64 69 63 74 6f 72 3a 20 31 |ive.Predictor: 1| 00000090 00 49 6d 61 67 65 73 20 69 6e 20 4c 56 46 00 00 |.Images in LVF..| 000000a0 00 00 00 c8 00 00 00 00 00 00 00 50 72 65 64 69 |...........Predi| 000000b0 63 74 6f 72 3a 20 32 00 49 6d 61 67 65 73 20 69 |ctor: 2.Images i| 000000c0 6e 20 52 56 46 00 c8 00 00 00 00 00 00 00 00 00 |n RVF...........| 000000d0 00 00 50 72 65 64 69 63 74 6f 72 3a 20 33 00 49 |..Predictor: 3.I| 000000e0 6d 61 67 65 73 20 69 6e 20 42 56 46 00 00 00 00 |mages in BVF....| 000000f0 00 00 00 00 00 96 00 00 00 50 72 65 64 69 63 74 |.........Predict| 00000100 6f 72 3a 20 34 00 4d 65 61 6e 20 28 63 6f 6e 66 |or: 4.Mean (conf| 00000110 6f 75 6e 64 29 00 ff 00 00 00 ff 00 00 00 ff 00 |ound)...........| 00000120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000130 80 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |.?..............|
