scil_frf_memsmt.py

usage: __main__.py [-h] --in_dwis IN_DWIS [IN_DWIS ...] --in_bvals IN_BVALS
                   [IN_BVALS ...] --in_bvecs IN_BVECS [IN_BVECS ...]
                   --in_bdeltas {0,1,-0.5,0.5} [{0,1,-0.5,0.5} ...]
                   [--mask MASK] [--mask_wm MASK_WM] [--mask_gm MASK_GM]
                   [--mask_csf MASK_CSF] [--fa_thr_wm FA_THR_WM]
                   [--fa_thr_gm FA_THR_GM] [--fa_thr_csf FA_THR_CSF]
                   [--md_thr_gm MD_THR_GM] [--md_thr_csf MD_THR_CSF]
                   [--min_nvox MIN_NVOX] [--tolerance tol] [--skip_b0_check]
                   [--dti_bval_limit DTI_BVAL_LIMIT]
                   [--roi_radii ROI_RADII [ROI_RADII ...]]
                   [--roi_center tuple(3) tuple(3) tuple(3)]
                   [--wm_frf_mask file] [--gm_frf_mask file]
                   [--csf_frf_mask file] [-v [{DEBUG,INFO,WARNING}]] [-f]
                   out_wm_frf out_gm_frf out_csf_frf

Script to estimate response functions for multi-encoding multi-shell
multi-tissue (memsmt) constrained spherical deconvolution. In order to operate,
the script only needs the data from one type of b-tensor encoding. However,
giving only a spherical one will not produce good fiber response functions, as
it only probes spherical shapes. As for planar encoding, it should technically
work alone, but seems to be very sensitive to noise and is yet to be properly
documented. We thus suggest to always use at least the linear encoding, which
will be equivalent to standard multi-shell multi-tissue if used alone, in
combinaison with other encodings. Note that custom encodings are not yet
supported, so that only the linear tensor encoding (LTE, b_delta = 1), the
planar tensor encoding (PTE, b_delta = -0.5), the spherical tensor encoding
(STE, b_delta = 0) and the cigar shape tensor encoding (b_delta = 0.5) are
available. Moreover, all of `--in_dwis`, `--in_bvals`, `--in_bvecs` and
`--in_bdeltas` must have the same number of arguments. Be sure to keep the
same order of encodings throughout all these inputs and to set `--in_bdeltas`
accordingly (IMPORTANT).

The script computes a response function for white-matter (wm),
gray-matter (gm), csf and the mean b=0.

In the wm, we compute the response function in each voxels where
the FA is superior at threshold_fa_wm.

In the gm (or csf), we compute the response function in each voxels where
the FA is below at threshold_fa_gm (or threshold_fa_csf) and where
the MD is below threshold_md_gm (or threshold_md_csf).

>>> scil_frf_memsmt.py wm_frf.txt gm_frf.txt csf_frf.txt --in_dwis LTE.nii.gz
    PTE.nii.gz STE.nii.gz --in_bvals LTE.bval PTE.bval STE.bval --in_bvecs
    LTE.bvec PTE.bvec STE.bvec --in_bdeltas 1 -0.5 0 --mask mask.nii.gz

Based on P. Karan et al., Bridging the gap between constrained spherical
deconvolution and diffusional variance decomposition via tensor-valued
diffusion MRI. Medical Image Analysis (2022)

Formerly: scil_compute_memsmt_frf.py

positional arguments:
  out_wm_frf            Path to the output WM frf file, in .txt format.
  out_gm_frf            Path to the output GM frf file, in .txt format.
  out_csf_frf           Path to the output CSF frf file, in .txt format.

options:
  -h, --help            show this help message and exit
  --in_dwis IN_DWIS [IN_DWIS ...]
                        Path to the input diffusion volume for each b-tensor encoding type.
  --in_bvals IN_BVALS [IN_BVALS ...]
                        Path to the bval file, in FSL format, for each b-tensor encoding type.
  --in_bvecs IN_BVECS [IN_BVECS ...]
                        Path to the bvec file, in FSL format, for each b-tensor encoding type.
  --in_bdeltas {0,1,-0.5,0.5} [{0,1,-0.5,0.5} ...]
                        Value of b_delta for each b-tensor encoding type, in the same order as
                        dwi, bval and bvec inputs.
  --mask MASK           Path to a binary mask. Only the data inside the mask will be used for
                        computations and reconstruction. Useful if no tissue masks are available.
  --mask_wm MASK_WM     Path to the input WM mask file, used to improve the final WM frf mask.
  --mask_gm MASK_GM     Path to the input GM mask file, used to improve the final GM frf mask.
  --mask_csf MASK_CSF   Path to the input CSF mask file, used to improve the final CSF frf mask.
  --fa_thr_wm FA_THR_WM
                        If supplied, use this threshold to select single WM fiber voxels from
                        the FA inside the WM mask defined by mask_wm.
                        Each voxel above this threshold will be selected. [0.7]
  --fa_thr_gm FA_THR_GM
                        If supplied, use this threshold to select GM voxels from the FA inside
                        the GM mask defined by mask_gm.
                        Each voxel below this threshold will be selected. [0.2]
  --fa_thr_csf FA_THR_CSF
                        If supplied, use this threshold to select CSF voxels from the FA inside
                        the CSF mask defined by mask_csf.
                        Each voxel below this threshold will be selected. [0.1]
  --md_thr_gm MD_THR_GM
                        If supplied, use this threshold to select GM voxels from the MD inside
                        the GM mask defined by mask_gm.
                        Each voxel below this threshold will be selected. [0.0007]
  --md_thr_csf MD_THR_CSF
                        If supplied, use this threshold to select CSF voxels from the MD inside
                        the CSF mask defined by mask_csf.
                        Each voxel below this threshold will be selected. [0.003]
  --min_nvox MIN_NVOX   Minimal number of voxels needed for each tissue masks in order to
                        proceed to frf estimation. [100]
  --tolerance tol       The tolerated gap between the b-values to extract and the current b-value.
                        [Default: 20]
                        * Note. We would expect to find at least one b-value in the
                          range [0, tolerance]. To skip this check, use --skip_b0_check.
  --skip_b0_check       By default, we supervise that at least one b0 exists in your data
                        (i.e. b-values below the default --tolerance). Use this option to
                        allow continuing even if the minimum b-value is suspiciously high.
                        Use with care, and only if you understand your data.
  --dti_bval_limit DTI_BVAL_LIMIT
                        The highest b-value taken for the DTI model. [1200]
  --roi_radii ROI_RADII [ROI_RADII ...]
                        If supplied, use those radii to select a cuboid roi to estimate the
                        response functions. The roi will be a cuboid spanning from the middle of
                        the volume in each direction with the different radii. The type is either
                        an int (e.g. --roi_radii 10) or an array-like (3,) (e.g. --roi_radii 20 30 10). [[20]]
  --roi_center tuple(3) tuple(3) tuple(3)
                        If supplied, use this center to span the cuboid roi using roi_radii.
                        [center of the 3D volume] (e.g. --roi_center 66 79 79)
  --wm_frf_mask file    Path to the output WM frf mask file, the voxels used to compute the WM frf.
  --gm_frf_mask file    Path to the output GM frf mask file, the voxels used to compute the GM frf.
  --csf_frf_mask file   Path to the output CSF frf mask file, the voxels used to compute the CSF frf.
  -v [{DEBUG,INFO,WARNING}]
                        Produces verbose output depending on the provided level.
                        Default level is warning, default when using -v is info.
  -f                    Force overwriting of the output files.