lar#

Larmor CLI tools

Usage:

$ lar [OPTIONS] COMMAND [ARGS]...

Options:

  • --version: Show the version and exit.

  • --install-completion: Install completion for the current shell.

  • --show-completion: Show completion for the current shell, to copy it or customize the installation.

  • --help: Show this message and exit.

Commands:

  • dti: Compute Diffusion Tensor Imaging (DTI)…

  • dki: Compute Diffusion Kurtosis Imaging (DKI)…

  • denoise: Denoise a DWI volume with MP-PCA and…

  • mask: Generate a binary brain mask from a DWI…

  • degibbs: Remove Gibbs ringing by local sub-voxel…

  • fod: Performs fODF fit with the specified method.

  • info: Prints a short summary of an image or a…

  • convert: Converts a file to another format of the…

  • sh-convert: Converts an FOD image from one SH basis to…

  • peaks: Extracts the peaks of an FOD image.

  • track: Tracks streamlines through an FOD image.

  • tract-edit: Selects streamlines by length, weight and…

  • tract-profile: Writes the profile of maps (FA, MD, …)…

  • tract-density: Counts the streamlines through each voxel:…

  • connectome: Counts the streamlines between each pair…

  • transform: Applies registrations computed by ANTs,…

  • bv: Open the viewer, with files loaded into…

lar dti#

Compute Diffusion Tensor Imaging (DTI) metrics from volume and gradients.

Usage:

$ lar dti [OPTIONS] {volume} {output}

Arguments:

  • volume: Path to the diffusion volume (.nii, .nii.gz, .mif, .mif.gz or .mih). [required]

  • output: Output prefix: ‘out’ writes out_fa.nii.gz, out_md.nii.gz, out_ad.nii.gz, out_rd.nii.gz and out_pe.nii.gz. [required]

Options:

  • --bvals <str>: Path to the b-values file. Needed unless the volume is a .mif with gradients in its header, which the files then override.

  • --bvecs <str>: Path to the b-vectors file. Needed unless the volume is a .mif with gradients in its header, which the files then override.

  • --bvec-frame <fsl|world>: Coordinate frame of the b-vectors: ‘fsl’ (FSL bvecs files: image axes, x flipped when the affine determinant is positive) or ‘world’ (scanner/RAS coordinates). [default: fsl]

  • -m, --mask <str>: Brain mask; voxels outside it are not fitted. Computed from the b0 if omitted.

  • --fit <ols|wls>: ‘ols’: ordinary least squares; ‘wls’: iterated weighted least squares, weights from the predicted signal. [default: ols]

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar dki#

Compute Diffusion Kurtosis Imaging (DKI) metrics from volume and gradients.

Usage:

$ lar dki [OPTIONS] {volume} {output}

Arguments:

  • volume: Path to the diffusion volume (.nii, .nii.gz, .mif, .mif.gz or .mih). [required]

  • output: Output prefix: ‘out’ writes out_fa.nii.gz, out_md.nii.gz, out_ad.nii.gz, out_rd.nii.gz, out_pe.nii.gz, out_mk.nii.gz, out_ak.nii.gz, out_rk.nii.gz and out_ka.nii.gz. [required]

Options:

  • --bvals <str>: Path to the b-values file. Needed unless the volume is a .mif with gradients in its header, which the files then override.

  • --bvecs <str>: Path to the b-vectors file. Needed unless the volume is a .mif with gradients in its header, which the files then override.

  • --bvec-frame <fsl|world>: Coordinate frame of the b-vectors: ‘fsl’ (FSL bvecs files: image axes, x flipped when the affine determinant is positive) or ‘world’ (scanner/RAS coordinates). [default: fsl]

  • -m, --mask <str>: Brain mask; voxels outside it are not fitted. Computed from the b0 if omitted.

  • --fit <ols|wls>: ‘wls’: iterated weighted least squares, weights from the predicted signal; ‘ols’: ordinary least squares. [default: wls]

  • --unconstrained: Fit without the constraints D(n) >= 0, K(n) >= 0 and K(n) <= 3 / (b_max D(n)).

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar denoise#

Denoise a DWI volume with MP-PCA and estimate its noise level.

Usage:

$ lar denoise [OPTIONS] {volume} {output}

Arguments:

  • volume: Path to the diffusion volume (.nii, .nii.gz, .mif, .mif.gz or .mih). [required]

  • output: Path of the denoised volume to write. [required]

Options:

  • --noise <str>: Also write the noise map: the estimated noise level sigma of each voxel.

  • -m, --mask <str>: Denoise only the voxels inside this mask; the others are 0. Every voxel if omitted.

  • --patch-size <int>: Width of the cubic patch in voxels, odd. Default: the smallest with at least as many voxels as volumes (5 for up to 125 volumes, 7 for up to 343).

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar mask#

Generate a binary brain mask from a DWI volume.

Usage:

$ lar mask [OPTIONS] {volume} {output}

Arguments:

  • volume: Path to the diffusion volume (.nii, .nii.gz, .mif, .mif.gz or .mih). [required]

  • output: Path of the mask NIfTI to write. [required]

Options:

  • --bvals <str>: Path to the b-values file. Needed unless the volume is a .mif with gradients in its header, which the files then override.

  • --bvecs <str>: Path to the b-vectors file. Needed unless the volume is a .mif with gradients in its header, which the files then override.

  • --bvec-frame <fsl|world>: Coordinate frame of the b-vectors: ‘fsl’ (FSL bvecs files: image axes, x flipped when the affine determinant is positive) or ‘world’ (scanner/RAS coordinates). [default: fsl]

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar degibbs#

Remove Gibbs ringing by local sub-voxel shifts (run it after denoising).

Usage:

$ lar degibbs [OPTIONS] {volume} {output}

Arguments:

  • volume: Image to correct, 3D or 4D (.nii, .nii.gz, .mif, .mif.gz or .mih). [required]

  • output: Path of the corrected image. [required]

Options:

  • --slice-axis <int range>: Voxel axis across the acquired slices (0, 1 or 2); the other two span each slice. [default: 2; 0<=x<=2]

  • --shifts <int range>: Sub-voxel shifts tried on each side of zero, in steps of 1 / (2 shifts) voxels. [default: 20; x>=1]

  • --window <int int>...: First and last neighbour, in voxels from each voxel, over which the ringing is measured. [default: 1, 3]

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar fod#

Performs fODF fit with the specified method.

Usage:

$ lar fod [OPTIONS] {volume} {mask} {output}

Arguments:

  • volume: Path to the diffusion volume (.nii, .nii.gz, .mif, .mif.gz or .mih). [required]

  • mask: Path to brain mask in dwi space. [required]

  • output: Output prefix: ‘out’ writes the FOD to out.nii.gz (out_fod1.nii.gz, out_fod2.nii.gz, … for several anisotropic response functions), and out_tissue_fraction.nii.gz for a multi-tissue fit. [required]

Options:

  • --bvals <str>: Path to the b-values file. Needed unless the volume is a .mif with gradients in its header, which the files then override.

  • --bvecs <str>: Path to the b-vectors file. Needed unless the volume is a .mif with gradients in its header, which the files then override.

  • --method <grl|mfod>: Deconvolution method. [default: GRL]

  • --solver <drl|l2nnls|lasso>: FOD solver. Defaults to the method’s own.

  • --reg <float>: Penalty weight of the L2NNLS and LASSO solvers. Defaults to the solver’s own.

  • --inner-shell-weight <float>: Weight of the measurements outside the highest shell in a multi-tissue fit; the highest shell has weight 1. Defaults to the method’s own.

  • --bvec-frame <fsl|world>: Coordinate frame of the b-vectors: ‘fsl’ (FSL bvecs files: image axes, x flipped when the affine determinant is positive) or ‘world’ (scanner/RAS coordinates). [default: fsl]

  • --lmax <int>: Maximum spherical harmonics order. Will be downgraded if not enough gradients exist. [default: 8]

  • --wm-rf <float float float>...: WM eigenvalues in mm^2/s, e.g. 1.7e-3 0.2e-3 0.2e-3. Estimated from the data if omitted.

  • --gm-rf <float|none|noddi|auto>: GM isotropic diffusivity in mm^2/s, ‘none’ to leave GM out, ‘noddi’ for the anisotropic NODDI response, or ‘auto’: ‘noddi’ with mFOD, 0.7e-3 with GRL. [default: auto]

  • --csf-rf <float|none>: CSF isotropic diffusivity in mm^2/s, or ‘none’ to leave CSF out. [default: 0.003]

  • --mk <float>: Mean kurtosis of the WM RF. Defaults to the estimated kurtosis when –wm-rf is omitted (0 with fewer than two shells above b = 500), and to 0 with –wm-rf.

  • --basis <tournier|descoteaux|leemans>: SH basis to write the FOD in. The file does not record it, so the basis must be given again when the FOD is read (as in lar peaks). [default: tournier]

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar info#

Prints a short summary of an image or a tractogram.

Usage:

$ lar info [OPTIONS] {path}

Arguments:

  • path: Path to an image or tractogram file. [required]

Options:

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar convert#

Converts a file to another format of the same kind (image or tractogram).

Usage:

$ lar convert [OPTIONS] {input_path} {output_path}

Arguments:

  • input_path: Path to the file to convert, or an MRIToolkit result in a MATLAB .mat file: a DTI or DKI fit, a GRL or mFOD result, or tractography. [required]

  • output_path: Path to the converted file; its extension chooses the format, of the same kind (image or tractogram) as the input. From a .mat fit, ‘out.nii.gz’ writes the DWI there and out_fa, out_md, out_ad, out_rd, out_pe and out_dt (out_kt for DKI) beside it; from a GRL or mFOD result, the FOD (SH in the tournier basis; out_fod1, out_fod2, … for several), out_tissue_fraction and out_rss. [required]

Options:

  • --bvals <str>: b-values file of the input image, with –bvecs; the table goes into the header of a .mif output and to –bvals-out.

  • --bvecs <str>: b-vectors file of the input image, with –bvals.

  • --bvec-frame <fsl|world>: Coordinate frame of the b-vectors: ‘fsl’ (FSL bvecs files: image axes, x flipped when the affine determinant is positive) or ‘world’ (scanner/RAS coordinates). [default: fsl]

  • --bvals-out <path>: Write the gradient table of the image to this b-values file (FSL format), with –bvecs-out.

  • --bvecs-out <path>: Write the gradient table of the image to this b-vectors file (FSL format), with –bvals-out.

  • --reference <path>: Image whose grid a .trk output is written for, or a .trk input is checked against. Needed for a .trk output unless the input is a .trk. For MRIToolkit tracts or a GRL result (.mat), which store no grid: the fit (.mat) they came from, or a NIfTI or MIF file of its image.

  • --to-ras: Reorient an image to its closest RAS orientation: voxel axes are only permuted and flipped, so every voxel keeps its world position.

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar sh-convert#

Converts an FOD image from one SH basis to another.

Usage:

$ lar sh-convert [OPTIONS] {input_path} {output_path}

Arguments:

  • input_path: Path to the FOD image, SH coefficients along the 4th axis. [required]

  • output_path: Path to the converted FOD image. [required]

Options:

  • --from <tournier|descoteaux|leemans>: SH basis the input is stored in. Required: the file does not record it. [required]

  • --to <tournier|descoteaux|leemans>: SH basis to convert to. [required]

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar peaks#

Extracts the peaks of an FOD image.

Usage:

$ lar peaks [OPTIONS] {fod_path} {output_path}

Arguments:

  • fod_path: Path to the FOD image, SH coefficients along the 4th axis: the even degrees of a symmetric FOD, or all degrees of an asymmetric one (read from the number of coefficients). [required]

  • output_path: Path to the peaks image: for each peak, x, y and z of its direction scaled by its amplitude (3 volumes per peak, NaN where there are fewer peaks), largest first. Maxima with an amplitude of 0 or below are dropped, and so are those below –relative-threshold. For an asymmetric FOD a peak and its opposite are two peaks, and the signs of the directions matter. [required]

Options:

  • -m, --mask <path>: Only find peaks inside this mask; others are NaN.

  • --basis <tournier|descoteaux|leemans>: SH basis the FOD is stored in; the file does not record it. [default: tournier]

  • --num <int>: Maximum number of peaks per voxel. Default: 3, or 6 for an asymmetric FOD, where each fibre is two peaks.

  • --relative-threshold <float>: Drop peaks below this fraction of the voxel’s largest peak. [default: 0.1]

  • --threshold <float>: Drop peaks with an amplitude below this. [default: 0.0]

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar track#

Tracks streamlines through an FOD image.

Usage:

$ lar track [OPTIONS] {fod_path} {output_path}

Arguments:

  • fod_path: Path to the FOD image, SH coefficients along the 4th axis: the even degrees of a symmetric FOD, or all degrees of an asymmetric one (read from the number of coefficients). [required]

  • output_path: Path to the tractogram, .tck or .trk, written batch by batch. TRK keeps each streamline’s end status; TCK cannot hold it. [required]

Options:

  • --algorithm <det|prob>: det follows the FOD peak nearest the current direction; prob draws each direction at random according to the FOD. [default: det]

  • --seed-image <path>: Seed at random positions in this mask’s voxels until –select streamlines are accepted (tckgen -seed_image).

  • --seed-random-per-voxel <path int>...: Seed N random positions in every voxel of this mask: IMAGE N (tckgen -seed_random_per_voxel).

  • --seed-file <path>: Seed from a file written by –output-seeds. With the same –seed, the same streamlines are tracked again.

  • --select <int>: Track until this many streamlines are accepted (tckgen -select). Required with –seed-image; otherwise every seed is tracked.

  • -m, --mask <path>: Tracking mask: a streamline stops where it leaves it.

  • --unidirectional: Track from each seed in one direction only, not both.

  • --step-size <float>: Step size in mm. Default: 0.1 x the voxel size.

  • --angle <float>: Maximum angle between steps, in degrees. Default: 60 for det, 15 for prob.

  • --min-length <float>: Reject streamlines shorter than this, in mm. Default: 5 x the voxel size.

  • --max-length <float>: Stop streamlines at this length, in mm. Default: 100 x the voxel size.

  • --cutoff <str>: FOD amplitude below which tracking stops: a number, or ‘auto’ for 0.2 x the mean largest peak of the FOD. [default: auto]

  • --basis <tournier|descoteaux|leemans>: SH basis the FOD is stored in; the file does not record it. [default: tournier]

  • --seed <int>: Seed of the random numbers, in [0, 2^64): the same seed gives the same tractogram, whatever –nt. Default: one is drawn and recorded.

  • --json <path>: Save the run record (every parameter used, counts, versions) as JSON.

  • --output-seeds <path>: Save the seed of each accepted streamline, in output order, for –seed-file (tckgen -output_seeds).

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar tract-edit#

Selects streamlines by length, weight and region, crops and resamples them.

Usage:

$ lar tract-edit [OPTIONS] {INPUT... OUTPUT}

Arguments:

  • INPUT... OUTPUT: One or more input tractograms (.tck, .trk, .vtk, .fib, each also .gz), joined in order, then the output tractogram, of any of these formats. [required]

Options:

  • --include <str>: Keep the streamlines through this region: a sphere x,y,z,r in mm (world coordinates) or a mask image; repeatable.

  • --include-ordered <str>: Keep the streamlines through these regions in the given order: a sphere x,y,z,r in mm (world coordinates) or a mask image; repeatable.

  • --exclude <str>: Drop the streamlines through this region: a sphere x,y,z,r in mm (world coordinates) or a mask image; repeatable.

  • --within <str>: Keep the streamlines that stay entirely inside this region: a sphere x,y,z,r in mm (world coordinates) or a mask image; repeatable.

  • -m, --mask <str>: Crop the streamlines to the parts inside these regions: a sphere x,y,z,r in mm (world coordinates) or a mask image; repeatable.

  • --ends-only: Test only the two endpoints against –include, –include-ordered, –exclude and –within.

  • --inverse: Keep the streamlines that fail at least one length, weight or region test, and crop to the parts outside –mask.

  • --min-length <float>: Keep streamlines at least this long, in mm.

  • --max-length <float>: Keep streamlines at most this long, in mm.

  • --min-weight <float>: Keep streamlines with at least this weight; needs –weights-in or TRK inputs with a weight property.

  • --max-weight <float>: Keep streamlines with at most this weight.

  • --skip <int>: Drop the first N selected streamlines.

  • --every <int>: Keep every N-th selected streamline (after –skip), starting with the first.

  • --number <int>: Keep the first N selected streamlines.

  • --subsample <int>: Keep N selected streamlines chosen at random; not with –number.

  • --seed <int>: Seed of –subsample: the same seed gives the same subset.

  • --step-size <float>: Resample the output streamlines to this step size, in mm.

  • --num-points <int>: Resample the output streamlines to this many points each.

  • --weights-in <path>: Weights file with one value per input streamline (e.g. from tcksift2); replaces a TRK weight property.

  • --weights-out <path>: Write the weights of the output streamlines here.

  • --tsf-in <path>: TSF file with values per point of the input, named after its stem; repeatable.

  • --tsf-out <str>: Write these values per point (a –tsf-in stem or a TRK scalar) as <output name>_<name>.tsf; repeatable.

  • --reference <path>: Image whose grid a .trk output is written for; needed unless every input is a .trk. Also needed for MRIToolkit tracts (.mat), which store no grid: the fit (.mat) they came from, or a NIfTI or MIF file of its image.

  • --lazy: Read, edit and write in batches, for files too large for memory (uncompressed .tck and .trk only; not with –subsample or TSF files).

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar tract-profile#

Writes the profile of maps (FA, MD, …) along a bundle as a CSV table.

Usage:

$ lar tract-profile [OPTIONS] {BUNDLE MAP... OUTPUT}

Arguments:

  • BUNDLE MAP... OUTPUT: The bundle (.tck, .trk, .vtk, .fib, each also .gz), one or more maps (.nii, .nii.gz, .mif, .mif.gz, .mih), each named after its file name in the table, then the output CSV table (.csv). [required]

Options:

  • --num-points <int>: Number of points along the profile. [default: 100]

  • --weighting <gaussian|mean>: gaussian weighs each streamline by its distance from the bundle’s core at each point; mean weighs all streamlines the same. [default: gaussian]

  • --start <str>: A point x,y,z in mm (world coordinates) near the end where the profile starts. Default: the left, posterior or inferior end along the bundle’s main axis. Pass it in group studies, so every subject starts at the same end.

  • --tsf-prefix <str>: Also write, per point of the bundle, its profile point index as <prefix>segment.tsf and each map’s profile value as <prefix><map>.tsf, to colour the bundle in the viewer.

  • --reference <path>: For MRIToolkit tracts (.mat), which store no grid: the fit (.mat) they came from, or a NIfTI or MIF file of its image.

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar tract-density#

Counts the streamlines through each voxel: a track density image.

Usage:

$ lar tract-density [OPTIONS] {tractogram} {reference} {output}

Arguments:

  • tractogram: Input tractogram (.tck, .trk, .vtk, .fib, each also .gz). [required]

  • reference: Image whose grid the density is computed on (.nii, .nii.gz, .mif, .mif.gz, .mih); only its header is read. [required]

  • output: Output image (.nii, .nii.gz, .mif, .mif.gz, .mih). [required]

Options:

  • --voxel-size <str>: Voxel size of the output in mm, one value or three as x,y,z: a grid over the reference’s field of view, finer for super-resolution maps.

  • --ends-only: Count the streamlines’ endpoints instead (endpoint density).

  • --weights-in <path>: Weights file with one value per streamline (e.g. from tcksift2); each streamline adds its weight instead of 1.

  • --upsample <int>: Points added along the spline per step, as a ratio (1: none). By default the point spacing is brought under a tenth of the voxel size.

  • --lazy: Read the tractogram in batches, for files too large for memory (uncompressed .tck and .trk only).

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar connectome#

Counts the streamlines between each pair of regions: a structural connectome.

Usage:

$ lar connectome [OPTIONS] {tractogram} {parcellation} {output}

Arguments:

  • tractogram: Input tractogram (.tck, .trk, .vtk, .fib, each also .gz). [required]

  • parcellation: Parcellation image of integer region labels, 0 for no region (.nii, .nii.gz, .mif, .mif.gz, .mih). The matrix has a row for every label from 1 to the largest: relabel sparse labels first (e.g. with labelconvert). [required]

  • output: Output matrix: .csv (comma-separated, names in the first row and column) or any other extension (space-separated, names on a comment line). [required]

Options:

  • --lut <path>: Lookup table (FreeSurfer or MRtrix layout) whose names label the rows and columns; by default they are the label numbers.

  • --assignment <radial|end-voxel>: ‘radial’: the region of the endpoint’s voxel, else the nearest labelled voxel within –radius; ‘end-voxel’: the endpoint’s voxel only. [default: radial]

  • --radius <float>: Search radius of –assignment radial, in mm. Defaults to 4 mm; not with –assignment end-voxel.

  • --weights-in <path>: Weights file with one value per streamline (e.g. from tcksift2): sum the weights instead of counting streamlines.

  • --mean-length: Each entry is the mean length (mm) of its streamlines, weighted by –weights-in if given.

  • --mean-values <path>: File with one value per streamline (same format as a weights file): each entry is the mean value of its streamlines, weighted by –weights-in if given.

  • --symmetric: Write the full symmetric matrix; by default the lower triangle is 0.

  • --zero-diagonal: Set the diagonal (streamlines within one region) to 0.

  • --assignments-out <path>: Write the two regions of each streamline’s endpoints, one streamline per line.

  • --nt <int>: Number of threads to use for the given command. Default is all (-1) [default: -1]

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar transform#

Applies registrations computed by ANTs, FSL or MRtrix3 to a file.

The transforms bring an image into the reference space: it is resampled onto the reference grid. Tractograms and surfaces are brought into the same space, which moves their points with the inverse transforms.

Usage:

$ lar transform [OPTIONS] {input_path} {output_path}

Arguments:

  • input_path: The file to bring into the reference space: an image, a tractogram (.tck, .trk, .vtk, .fib) or a surface (.gii, or FreeSurfer). [required]

  • output_path: The output file, of the same kind as the input. [required]

Options:

  • -t, --transform <str>: A transform file, repeated for several, in order from the reference space: the first takes the reference grid’s points (for an ANTs registration: -t 1Warp.nii.gz -t 0GenericAffine.mat). ANTs affines (.mat, .txt) and warps (5D NIfTI), FLIRT matrices (.mat), FSL warp fields, MRtrix3 linear transforms (.txt) and deformation fields. Give a warp with the inverse warp its tool wrote as ‘warp.nii.gz,inverse_warp.nii.gz’; otherwise a warp is inverted numerically where needed. [required]

  • --reference <path>: An image of the reference space: the fixed or reference image of the registration. Images are resampled onto its grid; a tractogram or surface takes it as its reference grid (a .trk output needs it).

  • --inverse: Go the other way: bring the input from the reference space into the space the transforms bring images from.

  • --interp <nearest|linear|cubic>: Image interpolation: nearest for labels and parcellations, linear, or cubic (B-spline). [default: linear]

  • --reorient <peaks|tensor>: Reorient the directions an image stores: peaks (as lar peaks writes them, needs –interp nearest) or tensor (6 elements xx, xy, xz, yy, yz, zz).

  • --format <ants|fsl|mrtrix>: The tool that wrote the transforms, when a file does not tell (a 4D NIfTI warp can be FSL’s or MRtrix3’s).

  • --warp-type <deformation|displacement|relative|absolute>: How the warp fields store each voxel’s source: MRtrix3 ‘deformation’ (positions, the default) or ‘displacement’; FSL ‘relative’ (the default) or ‘absolute’. Checked against the field’s values.

  • --fsl-input <path>: For FSL transforms: the input image of the FLIRT or FNIRT run. Default: the input when it is an image (–reference with –inverse).

  • --fsl-reference <path>: For FLIRT matrices: the reference image of the FLIRT run. Default: –reference (the input with –inverse).

  • --force: Overwrite existing output files. If omitted for existing files, the command fails before doing any work.

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.

lar bv#

Open the viewer, with files loaded into their categories.

Usage:

$ lar bv [OPTIONS] [files]...

Arguments:

  • files...: Files to open, by their names: tractograms (.tck, .trk, .vtk, .fib), a session (.lar.json), and volumes (anything else but other .json files, which are skipped).

Options:

  • -v, --volumes <path>: Volume files, such as a T1 or an FA map. Repeat the option for several files.

  • -o, --overlays <path>: Overlay files, shown over the volumes: masks, maps, parcellations. Repeat the option for several files.

  • --tracts <path>: Tractogram files. Repeat the option for several files.

  • -f, --fods <path>: FOD files (SH coefficients along the 4th axis, in the tournier basis unless changed in the viewer), drawn as glyphs in the 2D views. Repeat the option for several files.

  • -p, --peaks <path>: Peaks files, as lar peaks writes them, drawn as lines in the 2D views. Repeat the option for several files.

  • --surfaces <path>: Surface files: GIfTI (.gii) or FreeSurfer (such as lh.white, read with its lh.curv and ../label/lh.cortex.label when they exist). Repeat the option for several files.

  • --max-streamlines <int range>: A tractogram with more streamlines is reduced to a random subset of this size when read; the same file always gives the same subset. Defaults to the read limit in the viewer’s Settings (1,000,000). [x>=0]

  • -s, --session <path>: A session saved from the viewer (File > Save Session), opened before the files of the other options, which are added to it.

  • --mcp: Serve the viewer to agents over MCP at http://127.0.0.1:<port>/mcp; the URL and the token are printed.

  • --mcp-port <int range>: The port for –mcp, which it implies. Defaults to the port in the viewer’s Settings (8765). [1024<=x<=65535]

  • --install-launcher: Add the viewer to the desktop (the application menu on Linux, ~/Applications on macOS, the Start menu on Windows), starting this install, then exit.

  • --uninstall-launcher: Remove what –install-launcher added, then exit.

  • --quiet: Show only errors.

  • --info: Show progress and informational messages.

  • --debug: Show debug messages and full tracebacks.

  • --help: Show this message and exit.