MATLAB files#
The viewer opens MATLAB .mat files, such as the results MRIToolkit and ExploreDTI save. One file holds many values,
so the viewer asks what to load from it, and as what; it never decides alone.
File > Open…, with the MATLAB files filter, opens the import dialog. It offers:
Load as tensor fit: a DTI or DKI fit (
DT,FA,eigval,FE,DWI,hdr). FA, MD and the eigenvalues are added as volumes, the first eigenvector as a volume with DTI colours modulated by the FA, and the DWI.Load as FOD fit: the result of a GRL or mFOD fit (a struct with
FOD,fractionsandRSS). Each FOD goes into FODs, in the MRtrix basis, and the fractions and residuals into Volumes.Load as tractography: tracts (
Tracts), as a tractogram in world coordinates.Load manually: a table of every variable, struct field and cell, with its size, MATLAB class and bytes. For each row, choose Volume, Overlay, FODs (SH coefficients), Peaks, Tractogram (a cell of N x 3 point arrays), Values per point (one value per point of a loaded tractogram, which it is then coloured by), Surface (a struct with
verticesand 1-basedfaces) or Nothing. A row whose shape cannot be that type says why, and Load stays off until every row fits. Peaks and FODs are taken to be in MRIToolkit’s frame, as its own results are, and are turned to world coordinates: peaks as x, y, z per peak, FODs as 300 amplitudes on its directions or as SH coefficients in the MRtrix basis.
The dialog selects the preset that fits the file, and greys out the ones that do not, with the reason as their tip.
Reference grid. FOD results and tracts store no image grid. The dialog fills in the fit beside the file
(dwi.mat first) when there is one; otherwise choose the fit’s .mat or a NIfTI of the same image. Images are
read in MRIToolkit’s layout (its first two axes swapped and reversed) and placed on that grid.
Sessions store, for each item, the variable and the type it came from, so a session reopens without the dialog.
From Python and for agents, viewer.load_matlab takes the same choices:
viewer.load_matlab("dwi.mat", MatlabPreset.TENSOR_FIT)
viewer.load_matlab("tracks.mat", MatlabPreset.TRACTOGRAPHY, reference="dwi.mat")
viewer.load_matlab("dwi.mat", MatlabPreset.MANUAL, variables={"FA": LoadAs.OVERLAY})
lar convert writes the same results to NIfTI, TCK or TRK for other tools.