File formats#
The formats Larmor reads and writes, with the Python functions for each. The load_ and save_ functions of
larmor.io, and the lar commands, choose the format from the end of the file name; the read_ and
write_ functions of larmor.io.formats read or write one format.
Images#
Format |
File names |
Read |
Write |
Python |
|---|---|---|---|---|
NIfTI-1 and NIfTI-2 |
|
yes |
yes (NIfTI-2 only when a dimension needs it) |
|
MRtrix image (MIF) |
|
yes |
yes |
A MIF header can hold the gradient table (dw_scheme), which load_dwi() reads with the image
and save_volume() writes into it.
Gradient tables#
Format |
File names |
Read |
Write |
Python |
|---|---|---|---|---|
FSL bvals and bvecs |
any, often |
yes |
yes |
|
MRtrix gradient table |
any, often |
yes |
yes |
|
b-matrix, one row per volume |
any |
yes |
yes |
Tractograms#
Format |
File names |
Read |
Write |
Python |
|---|---|---|---|---|
MRtrix tracks (TCK) |
|
yes |
yes |
|
TrackVis (TRK) |
|
yes |
yes (version 2) |
|
Legacy VTK polydata |
|
yes |
yes |
|
MRIToolkit tractography |
|
yes |
no |
Large uncompressed TCK and TRK files can be read and written batch by batch, with iter_tractogram() and
open_tractogram_writer().
Values along streamlines#
Format |
File names |
Read |
Write |
Python |
|---|---|---|---|---|
MRtrix track scalar file (TSF): one value per point |
|
yes |
yes |
|
Streamline weights, as tcksift2 writes them: one value per streamline |
any text file |
yes |
yes |
Surfaces#
Format |
File names |
Read |
Write |
Python |
|---|---|---|---|---|
GIfTI surface |
|
yes |
yes |
|
GIfTI values per vertex |
|
yes |
yes ( |
|
FreeSurfer surface |
no extension, such as |
yes |
yes |
|
FreeSurfer values per vertex (“new curv”) |
such as |
yes |
yes |
|
FreeSurfer label |
|
yes |
no |
Registrations#
Transforms are read, not written; load_transform() tells the format from the file
where it can.
Format |
File names |
Read |
Write |
Python |
|---|---|---|---|---|
ANTs (ITK) affine |
binary |
yes |
no |
|
ANTs displacement field |
NIfTI, such as |
yes |
no |
|
FSL FLIRT matrix |
text, such as |
yes |
no |
|
FSL warp field |
NIfTI (fnirt |
yes |
no |
|
MRtrix3 linear transform |
text (mrregister, transformconvert) |
yes |
no |
|
MRtrix3 deformation or displacement field |
|
yes |
no |
MATLAB and MRIToolkit#
Format |
File names |
Read |
Write |
Python |
|---|---|---|---|---|
MATLAB file, versions 4, 5 to 7 and 7.3 |
|
yes |
no |
|
MRIToolkit DTI or DKI fit |
|
yes |
no |
|
MRIToolkit image, its values as stored |
|
yes |
no |
|
MRIToolkit FODs |
|
yes |
no |
|
MRIToolkit peaks |
|
yes |
no |
Tables and other text files#
Format |
File names |
Read |
Write |
Python |
|---|---|---|---|---|
Lookup table, FreeSurfer or MRtrix layout |
text, such as |
yes |
no |
|
Connectome matrix with region names |
|
no |
yes |
|
Regions of each streamline’s endpoints, as tck2connectome writes them |
text |
no |
yes |
|
Seeds, one row per seed |
text |
yes |
yes |
|
Tract profile, one row per point |
|
no |
yes |
|
BrainViewer session |
|
yes |
yes |