|
57 | 57 |
|
58 | 58 | # caveat: Note that it's ambiguous to get the code given the bytespervoxel
|
59 | 59 | # caveat 2: Note that the bytespervox you get is in str ( not an int)
|
| 60 | +# FreeSurfer historically defines codes 0-10 [1], but only a subset is well supported. |
| 61 | +# Here we use FreeSurfer's MATLAB loader [2] as an indication of current support. |
| 62 | +# [1] https://github.com/freesurfer/freesurfer/blob/v8.0.0/include/mri.h#L53-L63 |
| 63 | +# [2] https://github.com/freesurfer/freesurfer/blob/v8.0.0/matlab/load_mgh.m#L195-L207 |
60 | 64 | _dtdefs = ( # code, conversion function, dtype, bytes per voxel
|
61 | 65 | (0, 'uint8', '>u1', '1', 'MRI_UCHAR', np.uint8, np.dtype('u1'), np.dtype('>u1')),
|
62 |
| - (4, 'int16', '>i2', '2', 'MRI_SHORT', np.int16, np.dtype('i2'), np.dtype('>i2')), |
63 | 66 | (1, 'int32', '>i4', '4', 'MRI_INT', np.int32, np.dtype('i4'), np.dtype('>i4')),
|
64 | 67 | (3, 'float', '>f4', '4', 'MRI_FLOAT', np.float32, np.dtype('f4'), np.dtype('>f4')),
|
| 68 | + (4, 'int16', '>i2', '2', 'MRI_SHORT', np.int16, np.dtype('i2'), np.dtype('>i2')), |
| 69 | + (10, 'uint16', '>u2', '2', 'MRI_USHRT', np.uint16, np.dtype('u2'), np.dtype('>u2')), |
65 | 70 | )
|
66 | 71 |
|
67 | 72 | # make full code alias bank, including dtype column
|
|
0 commit comments