from dipy.segment.mask import median_otsu
import numpy as np
from dipy.io.image import load_nifti, save_nifti
from dipy.io.gradients import read_bvals_bvecs
from dipy.core.gradients import gradient_table
import dipy.reconst.dti as dti
SYNOPSIS
Diffusion (kurtosis) tensor estimation
USAGE
dwi2tensor [ options ] dwi dt
dwi the input dwi image.
dt the output dt image.
DESCRIPTION
By default, the diffusion tensor (and optionally its kurtosis) is fitted
to the log-signal in two steps: firstly, using weighted least-squares
(WLS) with weights based on the empirical signal intensities; secondly, by
further iterated weighted least-squares (IWLS) with weights determined by
the signal predictions from the previous iteration (by default, 2
iterations will be performed). This behaviour can be altered in two ways:
* The -ols option will cause the first fitting step to be performed using
ordinary least-squares (OLS); that is, all measurements contribute equally
to the fit, instead of the default behaviour of weighting based on the
empirical signal intensities.
* The -iter option controls the number of iterations of the IWLS
prodedure. If this is set to zero, then the output model parameters will
be those resulting from the first fitting step only: either WLS by
default, or OLS if the -ols option is used in conjunction with -iter 0.
The tensor coefficients are stored in the output image as follows:
volumes 0-5: D11, D22, D33, D12, D13, D23
If diffusion kurtosis is estimated using the -dkt option, these are stored
as follows:
volumes 0-2: W1111, W2222, W3333
volumes 3-8: W1112, W1113, W1222, W1333, W2223, W2333
volumes 9-11: W1122, W1133, W2233
volumes 12-14: W1123, W1223, W1233
OPTIONS
-ols
perform initial fit using an ordinary least-squares (OLS) fit (see
Description).
-mask image
only perform computation within the specified binary brain mask image.
-b0 image
the output b0 image.
-dkt image
the output dkt image.
-iter integer
number of iterative reweightings for IWLS algorithm (default: 2) (see
Description).
-predicted_signal image
the predicted dwi image.
DW gradient table import options
-grad file
Provide the diffusion-weighted gradient scheme used in the acquisition in
a text file. This should be supplied as a 4xN text file with each line is
in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the
applied gradient, and b gives the b-value in units of s/mm^2. If a
diffusion gradient scheme is present in the input image header, the data
provided with this option will be instead used.
-fslgrad bvecs bvals
Provide the diffusion-weighted gradient scheme used in the acquisition in
FSL bvecs/bvals format files. If a diffusion gradient scheme is present in
the input image header, the data provided with this option will be instead
used.
Standard options
-info
display information messages.
-quiet
do not display information messages or progress status; alternatively,
this can be achieved by setting the MRTRIX_QUIET environment variable to a
non-empty string.
-debug
display debugging messages.
-force
force overwrite of output files (caution: using the same file as input and
output might cause unexpected behaviour).
-nthreads number
use this number of threads in multi-threaded applications (set to 0 to
disable multi-threading).
-config key value (multiple uses permitted)
temporarily set the value of an MRtrix config file entry.
-help
display this information page and exit.
-version
display version information and exit.
tensor2metricのヘルプは、次の通り。
クリックして展開
SYNOPSIS
Generate maps of tensor-derived parameters
USAGE
tensor2metric [ options ] tensor
tensor the input tensor image.
OPTIONS
-adc image
compute the mean apparent diffusion coefficient (ADC) of the diffusion
tensor. (sometimes also referred to as the mean diffusivity (MD))
-fa image
compute the fractional anisotropy (FA) of the diffusion tensor.
-ad image
compute the axial diffusivity (AD) of the diffusion tensor. (equivalent to
the principal eigenvalue)
-rd image
compute the radial diffusivity (RD) of the diffusion tensor. (equivalent
to the mean of the two non-principal eigenvalues)
-cl image
compute the linearity metric of the diffusion tensor. (one of the three
Westin shape metrics)
-cp image
compute the planarity metric of the diffusion tensor. (one of the three
Westin shape metrics)
-cs image
compute the sphericity metric of the diffusion tensor. (one of the three
Westin shape metrics)
-value image
compute the selected eigenvalue(s) of the diffusion tensor.
-vector image
compute the selected eigenvector(s) of the diffusion tensor.
-num sequence
specify the desired eigenvalue/eigenvector(s). Note that several
eigenvalues can be specified as a number sequence. For example, '1,3'
specifies the principal (1) and minor (3) eigenvalues/eigenvectors
(default = 1).
-modulate choice
specify how to modulate the magnitude of the eigenvectors. Valid choices
are: none, FA, eigval (default = FA).
-mask image
only perform computation within the specified binary brain mask image.
Standard options
-info
display information messages.
-quiet
do not display information messages or progress status; alternatively,
this can be achieved by setting the MRTRIX_QUIET environment variable to a
non-empty string.
-debug
display debugging messages.
-force
force overwrite of output files (caution: using the same file as input and
output might cause unexpected behaviour).
-nthreads number
use this number of threads in multi-threaded applications (set to 0 to
disable multi-threading).
-config key value (multiple uses permitted)
temporarily set the value of an MRtrix config file entry.
-help
display this information page and exit.
-version
display version information and exit.
Usage:
dtifit -k <filename>
dtifit --verbose
Compulsory arguments (You MUST set one or more of):
-k,--data dti data file
-o,--out Output basename
-m,--mask Bet binary mask file
-r,--bvecs b vectors file
-b,--bvals b values file
Optional arguments (You may optionally specify one or more of):
-V,--verbose switch on diagnostic messages
-h,--help display this message
--cni Input confound regressors
--sse Output sum of squared errors
-w,--wls Fit the tensor with weighted least squares
--kurt Output mean kurtosis map (for multi-shell data)
--kurtdir Output parallel/perpendicular kurtosis maps (for multi-shell data)
--littlebit Only process small area of brain
--save_tensor Save the elements of the tensor
-z,--zmin min z
-Z,--zmax max z
-y,--ymin min y
-Y,--ymax max y
-x,--xmin min x
-X,--xmax max x
--gradnonlin Gradient Nonlinearity Tensor file
SYNOPSIS
Perform diffusion image pre-processing using FSL's eddy tool; including
inhomogeneity distortion correction using FSL's topup tool if possible
USAGE
dwifslpreproc [ options ] input output
input The input DWI series to be corrected
output The output corrected image series
DESCRIPTION
This script is intended to provide convenience of use of the FSL software
tools topup and eddy for performing DWI pre-processing, by encapsulating
some of the surrounding image data and metadata processing steps. It is
intended to simply these processing steps for most commonly-used DWI
acquisition strategies, whilst also providing support for some more exotic
acquisitions. The "example usage" section demonstrates the ways in which
the script can be used based on the (compulsory) -rpe_* command-line
options.
The "-topup_options" and "-eddy_options" command-line options allow the
user to pass desired command-line options directly to the FSL commands
topup and eddy. The available options for those commands may vary between
versions of FSL; users can interrogate such by querying the help pages of
the installed software, and/or the FSL online documentation: (topup)
https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/topup/TopupUsersGuide ; (eddy)
https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/UsersGuide
The script will attempt to run the CUDA version of eddy; if this does not
succeed for any reason, or is not present on the system, the CPU version
will be attempted instead. By default, the CUDA eddy binary found that
indicates compilation against the most recent version of CUDA will be
attempted; this can be over-ridden by providing a soft-link "eddy_cuda"
within your path that links to the binary you wish to be executed.
Note that this script does not perform any explicit registration between
images provided to topup via the -se_epi option, and the DWI volumes
provided to eddy. In some instances (motion between acquisitions) this can
result in erroneous application of the inhomogeneity field during
distortion correction. Use of the -align_seepi option is advocated in this
scenario, which ensures that the first volume in the series provided to
eddy is also the first volume in the series provided to eddy, guaranteeing
alignment. But a prerequisite for this approach is that the image contrast
within the images provided to the -se_epi option must match the b=0 volumes
present within the input DWI series: this means equivalent TE, TR and flip
angle (note that differences in multi-band factors between two acquisitions
may lead to differences in TR).
EXAMPLE USAGES
A basic DWI acquisition, where all image volumes are acquired in a single
protocol with fixed phase encoding:
$ dwifslpreproc DWI_in.mif DWI_out.mif -rpe_none -pe_dir ap -readout_time 0.55
Due to use of a single fixed phase encoding, no EPI distortion correction
can be applied in this case.
DWIs all acquired with a single fixed phase encoding; but additionally a
pair of b=0 images with reversed phase encoding to estimate the
inhomogeneity field:
$ mrcat b0_ap.mif b0_pa.mif b0_pair.mif -axis 3; dwifslpreproc DWI_in.mif DWI_out.mif -rpe_pair -se_epi b0_pair.mif -pe_dir ap -readout_time 0.72 -align_seepi
Here the two individual b=0 volumes are concatenated into a single 4D image
series, and this is provided to the script via the -se_epi option. Note
that with the -rpe_pair option used here, which indicates that the SE-EPI
image series contains one or more pairs of b=0 images with reversed phase
encoding, the FIRST HALF of the volumes in the SE-EPI series must possess
the same phase encoding as the input DWI series, while the second half are
assumed to contain the opposite phase encoding direction but identical
total readout time. Use of the -align_seepi option is advocated as long as
its use is valid (more information in the Description section).
All DWI directions & b-values are acquired twice, with the phase encoding
direction of the second acquisition protocol being reversed with respect to
the first:
$ mrcat DWI_lr.mif DWI_rl.mif DWI_all.mif -axis 3; dwifslpreproc DWI_all.mif DWI_out.mif -rpe_all -pe_dir lr -readout_time 0.66
Here the two acquisition protocols are concatenated into a single DWI
series containing all acquired volumes. The direction indicated via the
-pe_dir option should be the direction of phase encoding used in
acquisition of the FIRST HALF of volumes in the input DWI series; ie. the
first of the two files that was provided to the mrcat command. In this
usage scenario, the output DWI series will contain the same number of image
volumes as ONE of the acquired DWI series (ie. half of the number in the
concatenated series); this is because the script will identify pairs of
volumes that possess the same diffusion sensitisation but reversed phase
encoding, and perform explicit recombination of those volume pairs in such
a way that image contrast in regions of inhomogeneity is determined from
the stretched rather than the compressed image.
Any acquisition scheme that does not fall into one of the example usages
above:
$ mrcat DWI_*.mif DWI_all.mif -axis 3; mrcat b0_*.mif b0_all.mif -axis 3; dwifslpreproc DWI_all.mif DWI_out.mif -rpe_header -se_epi b0_all.mif -align_seepi
With this usage, the relevant phase encoding information is determined
entirely based on the contents of the relevant image headers, and
dwifslpreproc prepares all metadata for the executed FSL commands
accordingly. This can therefore be used if the particular DWI acquisition
strategy used does not correspond to one of the simple examples as
described in the prior examples. This usage is predicated on the headers of
the input files containing appropriately-named key-value fields such that
MRtrix3 tools identify them as such. In some cases, conversion from DICOM
using MRtrix3 commands will automatically extract and embed this
information; however this is not true for all scanner vendors and/or
software versions. In the latter case it may be possible to manually
provide these metadata; either using the -json_import command-line option
of dwifslpreproc, or the -json_import or one of the -import_pe_* command-
line options of MRtrix3's mrconvert command (and saving in .mif format)
prior to running dwifslpreproc.
OPTIONS
-pe_dir PE
Manually specify the phase encoding direction of the input series; can be a
signed axis number (e.g. -0, 1, +2), an axis designator (e.g. RL, PA, IS),
or NIfTI axis codes (e.g. i-, j, k)
-readout_time time
Manually specify the total readout time of the input series (in seconds)
-se_epi image
Provide an additional image series consisting of spin-echo EPI images,
which is to be used exclusively by topup for estimating the inhomogeneity
field (i.e. it will not form part of the output image series)
-align_seepi
Achieve alignment between the SE-EPI images used for inhomogeneity field
estimation, and the DWIs (more information in Description section)
-json_import file
Import image header information from an associated JSON file (may be
necessary to determine phase encoding information)
-topup_options " TopupOptions"
Manually provide additional command-line options to the topup command
(provide a string within quotation marks that contains at least one space,
even if only passing a single command-line option to topup)
-eddy_options " EddyOptions"
Manually provide additional command-line options to the eddy command
(provide a string within quotation marks that contains at least one space,
even if only passing a single command-line option to eddy)
-eddy_mask image
Provide a processing mask to use for eddy, instead of having dwifslpreproc
generate one internally using dwi2mask
-eddy_slspec file
Provide a file containing slice groupings for eddy's slice-to-volume
registration
-eddyqc_text directory
Copy the various text-based statistical outputs generated by eddy, and the
output of eddy_qc (if installed), into an output directory
-eddyqc_all directory
Copy ALL outputs generated by eddy (including images), and the output of
eddy_qc (if installed), into an output directory
Options for specifying the acquisition phase-encoding design; note that one of the -rpe_* options MUST be provided
-rpe_none
Specify that no reversed phase-encoding image data is being provided; eddy
will perform eddy current and motion correction only
-rpe_pair
Specify that a set of images (typically b=0 volumes) will be provided for
use in inhomogeneity field estimation only (using the -se_epi option)
-rpe_all
Specify that ALL DWIs have been acquired with opposing phase-encoding
-rpe_header
Specify that the phase-encoding information can be found in the image
header(s), and that this is the information that the script should use
Options for importing the diffusion gradient table
-grad GRAD
Provide the diffusion gradient table in MRtrix format
-fslgrad bvecs bvals
Provide the diffusion gradient table in FSL bvecs/bvals format
Options for exporting the diffusion gradient table
-export_grad_mrtrix grad
Export the final gradient table in MRtrix format
-export_grad_fsl bvecs bvals
Export the final gradient table in FSL bvecs/bvals format
Additional standard options for Python scripts
-nocleanup
do not delete intermediate files during script execution, and do not delete
scratch directory at script completion.
-scratch /path/to/scratch/
manually specify the path in which to generate the scratch directory.
-continue <ScratchDir> <LastFile>
continue the script from a previous execution; must provide the scratch
directory path, and the name of the last successfully-generated file.
Standard options
-info
display information messages.
-quiet
do not display information messages or progress status. Alternatively, this
can be achieved by setting the MRTRIX_QUIET environment variable to a non-
empty string.
-debug
display debugging messages.
-force
force overwrite of output files.
-nthreads number
use this number of threads in multi-threaded applications (set to 0 to
disable multi-threading).
-config key value (multiple uses permitted)
temporarily set the value of an MRtrix config file entry.
-help
display this information page and exit.
-version
display version information and exit.
SYNOPSIS
Generate a 5TT image suitable for ACT
USAGE
5ttgen [ options ] algorithm ...
algorithm Select the algorithm to be used to complete the script operation;
additional details and options become available once an
algorithm is nominated. Options are: freesurfer, fsl, gif,
hsvs
DESCRIPTION
5ttgen acts as a 'master' script for generating a five-tissue-type (5TT)
segmented tissue image suitable for use in Anatomically-Constrained
Tractography (ACT). A range of different algorithms are available for
completing this task. When using this script, the name of the algorithm to
be used must appear as the first argument on the command-line after
'5ttgen'. The subsequent compulsory arguments and options available depend
on the particular algorithm being invoked.
Each algorithm available also has its own help page, including necessary
references; e.g. to see the help page of the 'fsl' algorithm, type '5ttgen
fsl'.
Options common to all 5ttgen algorithms
-nocrop
Do NOT crop the resulting 5TT image to reduce its size (keep the same
dimensions as the input image)
-sgm_amyg_hipp
Represent the amygdalae and hippocampi as sub-cortical grey matter in the
5TT image
Additional standard options for Python scripts
-nocleanup
do not delete intermediate files during script execution, and do not delete
scratch directory at script completion.
-scratch /path/to/scratch/
manually specify the path in which to generate the scratch directory.
-continue <ScratchDir> <LastFile>
continue the script from a previous execution; must provide the scratch
directory path, and the name of the last successfully-generated file.
Standard options
-info
display information messages.
-quiet
do not display information messages or progress status. Alternatively, this
can be achieved by setting the MRTRIX_QUIET environment variable to a non-
empty string.
-debug
display debugging messages.
-force
force overwrite of output files.
-nthreads number
use this number of threads in multi-threaded applications (set to 0 to
disable multi-threading).
-config key value (multiple uses permitted)
temporarily set the value of an MRtrix config file entry.
-help
display this information page and exit.
-version
display version information and exit.
SYNOPSIS
Perform B1 field inhomogeneity correction for a DWI volume series
USAGE
dwibiascorrect [ options ] algorithm ...
algorithm Select the algorithm to be used to complete the script operation;
additional details and options become available once an
algorithm is nominated. Options are: ants, fsl
Options for importing the diffusion gradient table
-grad GRAD
Provide the diffusion gradient table in MRtrix format
-fslgrad bvecs bvals
Provide the diffusion gradient table in FSL bvecs/bvals format
Options common to all dwibiascorrect algorithms
-mask image
Manually provide a mask image for bias field estimation
-bias image
Output the estimated bias field
Additional standard options for Python scripts
-nocleanup
do not delete intermediate files during script execution, and do not delete
scratch directory at script completion.
-scratch /path/to/scratch/
manually specify the path in which to generate the scratch directory.
-continue <ScratchDir> <LastFile>
continue the script from a previous execution; must provide the scratch
directory path, and the name of the last successfully-generated file.
Standard options
-info
display information messages.
-quiet
do not display information messages or progress status. Alternatively, this
can be achieved by setting the MRTRIX_QUIET environment variable to a non-
empty string.
-debug
display debugging messages.
-force
force overwrite of output files.
-nthreads number
use this number of threads in multi-threaded applications (set to 0 to
disable multi-threading).
-config key value (multiple uses permitted)
temporarily set the value of an MRtrix config file entry.
-help
display this information page and exit.
-version
display version information and exit.
import numpy as np
import matplotlib.pyplot as plt
from time import time
from dipy.denoise.localpca import mppca
from dipy.core.gradients import gradient_table
from dipy.io.image import load_nifti, save_nifti
from dipy.io.gradients import read_bvals_bvecs
from dipy.segment.mask import median_otsu
SYNOPSIS
dMRI noise level estimation and denoising using Marchenko-Pastur PCA
USAGE
dwidenoise [ options ] dwi out
dwi the input diffusion-weighted image.
out the output denoised DWI image.
DESCRIPTION
DWI data denoising and noise map estimation by exploiting data redundancy
in the PCA domain using the prior knowledge that the eigenspectrum of
random covariance matrices is described by the universal Marchenko-Pastur
(MP) distribution. Fitting the MP distribution to the spectrum of
patch-wise signal matrices hence provides an estimator of the noise level
'sigma', as was first shown in Veraart et al. (2016) and later improved in
Cordero-Grande et al. (2019). This noise level estimate then determines
the optimal cut-off for PCA denoising.
Important note: image denoising must be performed as the first step of the
image processing pipeline. The routine will fail if interpolation or
smoothing has been applied to the data prior to denoising.
Note that this function does not correct for non-Gaussian noise biases
present in magnitude-reconstructed MRI images. If available, including the
MRI phase data can reduce such non-Gaussian biases, and the command now
supports complex input data.
OPTIONS
-mask image
Only process voxels within the specified binary brain mask image.
-extent window
Set the patch size of the denoising filter. By default, the command will
select the smallest isotropic patch size that exceeds the number of DW
images in the input data, e.g., 5x5x5 for data with <= 125 DWI volumes,
7x7x7 for data with <= 343 DWI volumes, etc.
-noise level
The output noise map, i.e., the estimated noise level 'sigma' in the data.
Note that on complex input data, this will be the total noise level across
real and imaginary channels, so a scale factor sqrt(2) applies.
-datatype float32/float64
Datatype for the eigenvalue decomposition (single or double precision).
For complex input data, this will select complex float32 or complex
float64 datatypes.
-estimator Exp1/Exp2
Select the noise level estimator (default = Exp2), either:
* Exp1: the original estimator used in Veraart et al. (2016), or
* Exp2: the improved estimator introduced in Cordero-Grande et al. (2019).
Standard options
-info
display information messages.
-quiet
do not display information messages or progress status; alternatively,
this can be achieved by setting the MRTRIX_QUIET environment variable to a
non-empty string.
-debug
display debugging messages.
-force
force overwrite of output files (caution: using the same file as input and
output might cause unexpected behaviour).
-nthreads number
use this number of threads in multi-threaded applications (set to 0 to
disable multi-threading).
-config key value (multiple uses permitted)
temporarily set the value of an MRtrix config file entry.
-help
display this information page and exit.
-version
display version information and exit.
Usage: epi_reg [options] --epi=<EPI image> --t1=<wholehead T1 image> --t1brain=<brain extracted T1 image> --out=<output name>
Optional arguments
--fmap=<image> : fieldmap image (in rad/s)
--fmapmag=<image> : fieldmap magnitude image - wholehead extracted
--fmapmagbrain=<image> : fieldmap magnitude image - brain extracted
--gdc=<image> : Gradient-distortion corection warpfield
--wmseg=<image> : white matter segmentation of T1 image
--echospacing=<val> : Effective EPI echo spacing (sometimes called dwell time) - in seconds
--pedir=<dir> : phase encoding direction, dir = x/y/z/-x/-y/-z
--weight=<image> : weighting image (in T1 space)
--nofmapreg : do not perform registration of fmap to T1 (use if fmap already registered)
--noclean : do not clean up intermediate files
-v : verbose output
-h : display this help message
e.g.: epi_reg --epi=example_func --t1=struct --t1brain=struct_brain --out=epi2struct --fmap=fmap_rads --fmapmag=fmap_mag --fmapmagbrain=fmap_mag_brain --echospacing=0.0005 --pedir=-y
Note that if parallel acceleration is used in the EPI acquisition then the *effective* echo spacing is the actual echo spacing between acquired lines in k-space divided by the acceleration factor.
SYNOPSIS
Extract diffusion-weighted volumes, b=0 volumes, or certain shells from a
DWI dataset
USAGE
dwiextract [ options ] input output
input the input DW image.
output the output image (diffusion-weighted volumes by default).
EXAMPLE USAGES
Calculate the mean b=0 image from a 4D DWI series:
$ dwiextract dwi.mif - -bzero | mrmath - mean mean_bzero.mif -axis 3
The dwiextract command extracts all volumes for which the b-value is
(approximately) zero; the resulting 4D image can then be provided to the
mrmath command to calculate the mean intensity across volumes for each
voxel.
OPTIONS
-bzero
Output b=0 volumes (instead of the diffusion weighted volumes, if
-singleshell is not specified).
-no_bzero
Output only non b=0 volumes (default, if -singleshell is not specified).
-singleshell
Force a single-shell (single non b=0 shell) output. This will include b=0
volumes, if present. Use with -bzero to enforce presence of b=0 volumes
(error if not present) or with -no_bzero to exclude them.
DW gradient table import options
-grad file
Provide the diffusion-weighted gradient scheme used in the acquisition in
a text file. This should be supplied as a 4xN text file with each line is
in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the
applied gradient, and b gives the b-value in units of s/mm^2. If a
diffusion gradient scheme is present in the input image header, the data
provided with this option will be instead used.
-fslgrad bvecs bvals
Provide the diffusion-weighted gradient scheme used in the acquisition in
FSL bvecs/bvals format files. If a diffusion gradient scheme is present in
the input image header, the data provided with this option will be instead
used.
DW shell selection options
-shells b-values
specify one or more b-values to use during processing, as a
comma-separated list of the desired approximate b-values (b-values are
clustered to allow for small deviations). Note that some commands are
incompatible with multiple b-values, and will report an error if more than
one b-value is provided.
WARNING: note that, even though the b=0 volumes are never referred to as
shells in the literature, they still have to be explicitly included in the
list of b-values as provided to the -shell option! Several algorithms
which include the b=0 volumes in their computations may otherwise return
an undesired result.
DW gradient table export options
-export_grad_mrtrix path
export the diffusion-weighted gradient table to file in MRtrix format
-export_grad_fsl bvecs_path bvals_path
export the diffusion-weighted gradient table to files in FSL (bvecs /
bvals) format
Options for importing phase-encode tables
-import_pe_table file
import a phase-encoding table from file
-import_pe_eddy config indices
import phase-encoding information from an EDDY-style config / index file
pair
Options for selecting volumes based on phase-encoding
-pe desc
select volumes with a particular phase encoding; this can be three
comma-separated values (for i,j,k components of vector direction) or four
(direction & total readout time)
Stride options
-strides spec
specify the strides of the output data in memory; either as a
comma-separated list of (signed) integers, or as a template image from
which the strides shall be extracted and used. The actual strides produced
will depend on whether the output image format can support it.
Standard options
-info
display information messages.
-quiet
do not display information messages or progress status; alternatively,
this can be achieved by setting the MRTRIX_QUIET environment variable to a
non-empty string.
-debug
display debugging messages.
-force
force overwrite of output files (caution: using the same file as input and
output might cause unexpected behaviour).
-nthreads number
use this number of threads in multi-threaded applications (set to 0 to
disable multi-threading).
-config key value (multiple uses permitted)
temporarily set the value of an MRtrix config file entry.
-help
display this information page and exit.
-version
display version information and exit.
SYNOPSIS
Generates a whole brain mask from a DWI image
USAGE
dwi2mask [ options ] input output
input the input DWI image containing volumes that are both
diffusion weighted and b=0
output the output whole-brain mask image
DESCRIPTION
All diffusion weighted and b=0 volumes are used to obtain a mask that
includes both brain tissue and CSF.
In a second step peninsula-like extensions, where the peninsula itself is
wider than the bridge connecting it to the mask, are removed. This may
help removing artefacts and non-brain parts, e.g. eyes, from the mask.
OPTIONS
-clean_scale value
the maximum scale used to cut bridges. A certain maximum scale cuts
bridges up to a width (in voxels) of 2x the provided scale. Setting this
to 0 disables the mask cleaning step. (Default: 2)
DW gradient table import options
-grad file
Provide the diffusion-weighted gradient scheme used in the acquisition in
a text file. This should be supplied as a 4xN text file with each line is
in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the
applied gradient, and b gives the b-value in units of s/mm^2. If a
diffusion gradient scheme is present in the input image header, the data
provided with this option will be instead used.
-fslgrad bvecs bvals
Provide the diffusion-weighted gradient scheme used in the acquisition in
FSL bvecs/bvals format files. If a diffusion gradient scheme is present in
the input image header, the data provided with this option will be instead
used.