I/O functions

This page introduces functions for reading dMRI data and protocols for microstructure imaging.

Read from DWI data and get spherical mean signals & imaging protocols

Microstructure.spherical_meanFunction
spherical_mean(
    image_file::String, 
    save::Bool=true, 
    acq_files::String...
)

Perform direction average on input DWI images image_file and return an MRI object with normalized spherical mean signal and associated imaging protocol. image_file is the full path of the DWI image file; save indicates whether to save the smt and normalized smt image volumes and protocol. If saving the files, nifti and text file (.btable) will be saved in the same path as the input data. Finall, variable number of acq_files are text files that tell you acquistion parameters of each DWI in the image_file. Accepted file extensions are .bvals/.bvecs/.techo/.tdelta/.tsmalldel for b-values, gradient directions, echo times, diffusion gradient seperation and duration times.

Besides .bvals/.bvecs for conventional modelling, .tdelta/.tsmalldel files are needed for any models that estimate size, e.g. axon diameter, soma radius. .techo is needed if your data is collected with multiple echo-time and you want to do combined-diffusion relaxometry modelling. The format of a .tdelta/.tsmalldel/.techo file is similar to a .bvals file (a vector with the length equal to the number of DWI volumes). Unit in the .tdelta/.tsmalldel/.techo file is ms.

source

The dMRI and Protocol type

Microstructure.dMRIType
dMRI(nifti::MRI, 
tdelta::Vector{Float64}, 
dsmalldel::Vector{Float64}, 
techo::Vector{Float64}, 
smt::Bool,
nmeas::Vector{Int})

Return a dMRI Type object with MRI object nifti, and additional volume-wise experimental settings tdelta, tsmalldel, techo, smt for identifing smt signals, and nmeas for the number of measurements.

source
Microstructure.ProtocolType
Protocol(
bval::Vector{Float64}
techo::Vector{Float64}
tdelta::Vector{Float64}
tsmalldel::Vector{Float64}
gvec::Vector{Float64}
bvec::Matrix{Float64}
nmeas::Vector{Float64}
)

Return a Protocol Type object to hold parameters in acquisition protocol relavent for modelling including b-values, tcho times, diffusion gradient seperation, duration, strengh, direction and the number of measurements. Unit convention: most text files use s/mm^2 for b-values and ms for time while they are converted to SI unit in the Protocol. b-values (s/m^2); time (s); size (m); G (T/m)

Protocol(
    filename::String
)

Return a Protocol Type object from a b-table file generated from spherical_mean function.

Protocol(
    bval::Vector{Float64},
    techo::Vector{Float64},
    tdelta::Vector{Float64},
    tsmalldel::Vector{Float64},
)

Calculate gvec and return a Ptotocol Type object from provided parameters; other fields are not useful

Protocol(
    dmri::dMRI
)

Return a Protocol Type object from a dMRI object.

source

Write image and save protocol

Microstructure.dmri_writeFunction
dmri_write(dmri::dMRI, datapath::String, filename::String)

Write the nifti volume in a dMRI object to nifti file and associated protocol as b-table text files in the given datapath and filename.

source