# dipy_fit_sfm

## Synopsis

Workflow for Sparse Fascicle Model (SFM)

See [1] for further details about the method.

## Usage

    dipy_fit_sfm [OPTIONS] input_files bvalues_files bvectors_files mask_files

## Input Parameters

- `input_files`

  Path to the input volumes. This path may contain wildcards to

- `bvalues_files`

  Path to the bvalues files. This path may contain wildcards to use multiple bvalues files at once.

- `bvectors_files`

  Path to the bvalues files. This path may contain wildcards to use

- `mask_files`

  Path to the input masks. This path may contain wildcards to use

## General Options

- `--sphere_name`

  Sphere name on which to reconstruct the fODFs. (default: None)

- `--response`

  Response function to use. If None, the response function will be defined automatically. (default: None)

- `--solver`

  This will determine the algorithm used to solve the set of linear equations underlying this model. It needs to be one of the following: {‘ElasticNet’, ‘NNLS’} (default: ElasticNet)

- `--l1_ratio`

  The ElasticNet mixing parameter, with 0 <= l1_ratio <= 1. For l1_ratio = 0 the penalty is an L2 penalty. For l1_ratio = 1 it is an L1 penalty. For 0 < l1_ratio < 1, the penalty is a combination of L1 and L2. (default: 0.5)

- `--alpha`

  Sets the balance between least-squares error and L1/L2 regularization in ElasticNet :footcite:p`Zou2005`. (default: 0.001)

- `--seed`

  Seed for the random number generator. (default: 42)

- `--b0_threshold`

  Threshold used to find b0 volumes. (default: 50.0)

- `--bvecs_tol`

  Bvecs should be unit vectors. (default: 0.01)

- `--sh_order_max`

  Maximum spherical harmonics order (l) used in the SFM fit. (default: 8)

- `--relative_peak_threshold`

  Only return peaks greater than `relative_peak_threshold * m` where m is the largest peak. (default: 0.5)

- `--min_separation_angle`

  The angle tolerance between directions. (default: 25)

- `--parallel`

  Whether to use parallelization in peak-finding. (default: False)

- `--extract_pam_values`

  Save or not to save pam volumes as single nifti files. (default: False)

- `--num_processes`

  If parallel is True, the number of subprocesses to use (default: None)

## Output Options

- `--out_dir`

  Output directory. (default: current directory)

- `--out_pam`

  Name of the peaks volume to be saved. (default: peaks.pam5)

- `--out_shm`

  Name of the spherical harmonics volume to be saved. (default: shm.nii.gz)

- `--out_peaks_dir`

  Name of the peaks directions volume to be saved. (default: peaks_dirs.nii.gz)

- `--out_peaks_values`

  Name of the peaks values volume to be saved. (default: peaks_values.nii.gz)

- `--out_peaks_indices`

  Name of the peaks indices volume to be saved. (default: peaks_indices.nii.gz)

- `--out_gfa`

  Name of the generalized FA volume to be saved. (default: gfa.nii.gz)

- `--out_sphere`

  Sphere vertices name to be saved. (default: sphere.txt)

- `--out_b`

  Name of the B Matrix to be saved. (default: B.nii.gz)

- `--out_qa`

  Name of the Quantitative Anisotropy to be saved. (default: qa.nii.gz)

## References

[1]

Ariel Rokem, Jason D. Yeatman, Franco Pestilli, Kendrick N. Kay, Aviv Mezer, Stefan van der Walt, and Brian A. Wandell. Evaluating the Accuracy of Diffusion MRI Models in White Matter. PLOS ONE, 10(4):1–26, April 2015. URL: https://doi.org/10.1371/journal.pone.0123272, doi:10.1371/journal.pone.0123272.

Garyfallidis, E., M. Brett, B. Amirbekian, A. Rokem, S. Van Der Walt, M. Descoteaux, and I. Nimmo-Smith. Dipy, a library for the analysis of diffusion MRI data. Frontiers in Neuroinformatics, 1-18, 2014.