def _build_arg_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_dwi', help='Path of the input diffusion volume.') p.add_argument('in_bval', help='Path of the bvals file, in FSL format.') p.add_argument('in_bvec', help='Path of the bvecs file, in FSL format.') p.add_argument('frf_file', help='Path of the FRF file') p.add_argument('out_fODF', help='Output path for the fiber ODF coefficients.') p.add_argument( '--sh_order', metavar='int', default=8, type=int, help='SH order used for the CSD. (Default: 8)') p.add_argument( '--mask', metavar='', help='Path to a binary mask. Only the data inside the mask will be ' 'used for computations and reconstruction.') add_force_b0_arg(p) add_sh_basis_args(p) add_processes_arg(p) add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_dwi', help='DWI Nifti image.') p.add_argument('in_bval', help='b-values filename, in FSL format (.bval).') p.add_argument('in_bvec', help='b-values filename, in FSL format (.bvec).') p.add_argument('out_b0', help='Output b0 file(s).') p.add_argument('--b0_thr', type=float, default=0.0, help='All b-values with values less than or equal ' 'to b0_thr are considered as b0s i.e. without ' 'diffusion weighting.') group = p.add_mutually_exclusive_group() group.add_argument('--all', action='store_true', help='Extract all b0. Index number will be appended to ' 'the output file.') group.add_argument('--mean', action='store_true', help='Extract mean b0.') add_force_b0_arg(p) add_verbose_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_dwi', help='Path of the dwi volume.') p.add_argument('in_bval', help='Path of the b-value file, in FSL format.') p.add_argument('in_bvec', help='Path of the b-vector file, in FSL format.') p.add_argument('out_sh', help='Name of the output SH file to save.') p.add_argument('--sh_order', type=int, default=4, help='SH order to fit (int). [%(default)s]') add_sh_basis_args(p) p.add_argument('--smooth', type=float, default=0.006, help='Lambda-regularization coefficient in the SH fit ' '(float). [%(default)s]') p.add_argument('--use_attenuation', action='store_true', help='If set, will use signal attenuation before fitting ' 'the SH (i.e. divide by the b0).') add_force_b0_arg(p) p.add_argument('--mask', help='Path to a binary mask.\nOnly data inside the mask ' 'will be used for computations and reconstruction ') add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) p.add_argument('in_dwi', help='Path of the input diffusion volume.') p.add_argument('in_bval', help='Path of the bval file, in FSL format.') p.add_argument('in_bvec', help='Path of the bvec file, in FSL format.') p.add_argument('in_wm_frf', help='Text file of WM response function.') p.add_argument('in_gm_frf', help='Text file of GM response function.') p.add_argument('in_csf_frf', help='Text file of CSF response function.') p.add_argument('--sh_order', metavar='int', default=8, type=int, help='SH order used for the CSD. (Default: 8)') p.add_argument('--mask', metavar='', help='Path to a binary mask. Only the data inside the ' 'mask will be used for computations and reconstruction.') add_force_b0_arg(p) add_sh_basis_args(p) add_processes_arg(p) add_overwrite_arg(p) p.add_argument('--not_all', action='store_true', help='If set, only saves the files specified using the ' 'file flags. (Default: False)') g = p.add_argument_group(title='File flags') g.add_argument('--wm_out_fODF', metavar='file', default='', help='Output filename for the WM fODF coefficients.') g.add_argument('--gm_out_fODF', metavar='file', default='', help='Output filename for the GM fODF coefficients.') g.add_argument('--csf_out_fODF', metavar='file', default='', help='Output filename for the CSF fODF coefficients.') g.add_argument('--vf', metavar='file', default='', help='Output filename for the volume fractions map.') g.add_argument('--vf_rgb', metavar='file', default='', help='Output filename for the volume fractions map in rgb.') return p
def _build_arg_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, epilog="References: [1] Tournier et al. NeuroImage 2007") p.add_argument('input', help='Path of the input diffusion volume.') p.add_argument('bvals', help='Path of the bvals file, in FSL format.') p.add_argument('bvecs', help='Path of the bvecs file, in FSL format.') p.add_argument('frf_file', help='Path to the output FRF file, in .txt format, ' 'saved by Numpy.') add_force_b0_arg(p) p.add_argument( '--mask', help='Path to a binary mask. Only the data inside the mask will be ' 'used for computations and reconstruction. Useful if no white ' 'matter mask is available.') p.add_argument( '--mask_wm', metavar='', help='Path to a binary white matter mask. Only the data inside this ' 'mask and above the threshold defined by --fa will be used to ' 'estimate the fiber response function.') p.add_argument( '--fa', dest='fa_thresh', default=0.7, type=float, help='If supplied, use this threshold as the initial threshold ' 'to select single fiber voxels. [%(default)s]') p.add_argument( '--min_fa', dest='min_fa_thresh', default=0.5, type=float, help='If supplied, this is the minimal value that will be tried ' 'when looking for single fiber voxels. [%(default)s]') p.add_argument( '--min_nvox', default=300, type=int, help='Minimal number of voxels needing to be identified as single ' 'fiber voxels in the automatic estimation. [%(default)s]') p.add_argument( '--roi_radius', default=10, type=int, help='If supplied, use this radius to select single fibers from the ' 'tensor to estimate the FRF. The roi will be a cube spanning ' 'from the middle of the volume in each direction. [%(default)s]') p.add_argument( '--roi_center', metavar='tuple(3)', help='If supplied, use this center to span the roi of size ' 'roi_radius. [center of the 3D volume]') add_overwrite_arg(p) p.add_argument('--verbose', '-v', action='store_true', help='Produce verbose output.') return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_dwi', help='Path of the input diffusion volume.') p.add_argument('in_bval', help='Path of the bvals file, in FSL format.') p.add_argument('in_bvec', help='Path of the bvecs file, in FSL format.') add_overwrite_arg(p) p.add_argument('--sh_order', default=4, type=int, help='Spherical harmonics order. Must be a positive even ' 'number [%(default)s].') p.add_argument('--mask', help='Path to a binary mask. Only data inside the mask will' ' be used for computations and reconstruction ' '[%(default)s].') p.add_argument('--use_qball', action='store_true', help='If set, qball will be used as the odf reconstruction' ' model instead of CSA.') p.add_argument('--not_all', action='store_true', help='If set, will only save the files specified using the ' 'following flags.') g = p.add_argument_group(title='File flags') g.add_argument('--gfa', default='', help='Output filename for the generalized fractional ' 'anisotropy [gfa.nii.gz].') g.add_argument('--peaks', default='', help='Output filename for the extracted peaks ' '[peaks.nii.gz].') g.add_argument('--peak_indices', default='', help='Output filename for the generated peaks ' 'indices on the sphere [peaks_indices.nii.gz].') g.add_argument('--sh', default='', help='Output filename for the spherical harmonics ' 'coefficients [sh.nii.gz].') g.add_argument('--nufo', default='', help='Output filename for the NUFO map [nufo.nii.gz].') g.add_argument('--a_power', default='', help='Output filename for the anisotropic power map' '[anisotropic_power.nii.gz].') add_force_b0_arg(p) add_sh_basis_args(p) add_processes_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('input', help='Path of the input diffusion volume.') p.add_argument('bvals', help='Path of the bvals file, in FSL format.') p.add_argument('bvecs', help='Path of the bvecs file, in FSL format.') p.add_argument('frf_file', help='Path of the FRF file') p.add_argument('--sh_order', metavar='int', default=8, type=int, help='SH order used for the CSD. (Default: 8)') p.add_argument( '--mask', metavar='', help='Path to a binary mask. Only the data inside the mask will be ' 'used for computations and reconstruction.') p.add_argument( '--processes', dest='nbr_processes', metavar='NBR', type=int, help='Number of sub processes to start. Default : cpu count') p.add_argument( '--not_all', action='store_true', help='If set, only saves the files specified using the file flags. ' '(Default: False)') add_force_b0_arg(p) add_sh_basis_args(p) g = p.add_argument_group(title='File flags') g.add_argument('--fodf', metavar='file', default='', help='Output filename for the fiber ODF coefficients.') g.add_argument('--peaks', metavar='file', default='', help='Output filename for the extracted peaks.') g.add_argument( '--peak_indices', metavar='file', default='', help='Output filename for the generated peaks indices on the sphere.') add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_sh', help='Path of the SH volume.') p.add_argument('out_sf', help='Name of the output SF file to save (bvals/bvecs will ' 'be automatically named when necessary).') # Sphere vs bvecs choice for SF directions = p.add_mutually_exclusive_group(required=True) directions.add_argument('--sphere', choices=sorted(SPHERE_FILES.keys()), help='Sphere used for the SH to SF projection. ') directions.add_argument( '--in_bvec', help="Directions used for the SH to SF projection.") p.add_argument('--dtype', default="float32", choices=["float32", "float64"], help="Datatype to use for SF computation and output array." "'[%(default)s]'") # Optional args for a DWI-like volume p.add_argument('--in_bval', help='b-value file, in FSL format, ' 'used to assign a b-value to the ' 'output SF and generate a `.bval` file.') p.add_argument('--in_b0', help='b0 volume to concatenate to the ' 'final SF volume.') p.add_argument('--out_bval', help="Optional output bval file.") p.add_argument('--out_bvec', help="Optional output bvec file.") p.add_argument('--b0_scaling', action="store_true", help="Scale resulting SF by the b0 image.") add_sh_basis_args(p) p.add_argument('--full_basis', action="store_true", help="If true, use a full basis for the input SH " "coefficients.") add_processes_arg(p) add_overwrite_arg(p) add_force_b0_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_dwi', help='DWI Nifti image.') p.add_argument('in_bval', help='b-values filename, in FSL format (.bval).') p.add_argument('in_bvec', help='b-values filename, in FSL format (.bvec).') p.add_argument('out_b0', help='Output b0 file(s).') p.add_argument('--b0_thr', type=float, default=0.0, help='All b-values with values less than or equal ' 'to b0_thr are considered as b0s i.e. without ' 'diffusion weighting. [%(default)s]') group = p.add_mutually_exclusive_group() group.add_argument('--all', action='store_true', help='Extract all b0. Index number will be appended to ' 'the output file.') group.add_argument('--mean', action='store_true', help='Extract mean b0.') group.add_argument('--cluster-mean', action='store_true', help='Extract mean of each continuous cluster of b0s.') group.add_argument('--cluster-first', action='store_true', help='Extract first b0 of each ' 'continuous cluster of b0s.') p.add_argument('--block-size', '-s', metavar='INT', type=int, help='Load the data using this block size. ' 'Useful\nwhen the data is too large to be ' 'loaded in memory.') p.add_argument('--single-image', action='store_true', help='If output b0 volume has multiple time points, only ' 'outputs a single image instead of a numbered series ' 'of images.') add_force_b0_arg(p) add_verbose_arg(p) return p
def _build_args_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('input', help='Path of the input diffusion volume.') p.add_argument('bvals', help='Path of the bvals file, in FSL format.') p.add_argument('bvecs', help='Path of the bvecs file, in FSL format.') add_overwrite_arg(p) p.add_argument( '--mask', help='Path to a binary mask.\nOnly data inside the mask will be used ' 'for computations and reconstruction. (Default: %(default)s)') p.add_argument( '--method', dest='method', metavar='method_name', default='WLS', choices=['WLS', 'LS', 'NLLS', 'restore'], help='Tensor fit method.\nWLS for weighted least squares' + '\nLS for ordinary least squares' + '\nNLLS for non-linear least-squares' + '\nrestore for RESTORE robust tensor fitting. (Default: %(default)s)') p.add_argument( '--not_all', action='store_true', dest='not_all', help='If set, will only save the metrics explicitly specified using ' 'the other metrics flags. (Default: not set).') g = p.add_argument_group(title='Metrics files flags') g.add_argument('--ad', dest='ad', metavar='file', default='', help='Output filename for the axial diffusivity.') g.add_argument( '--evecs', dest='evecs', metavar='file', default='', help='Output filename for the eigenvectors of the tensor.') g.add_argument( '--evals', dest='evals', metavar='file', default='', help='Output filename for the eigenvalues of the tensor.') g.add_argument( '--fa', dest='fa', metavar='file', default='', help='Output filename for the fractional anisotropy.') g.add_argument( '--ga', dest='ga', metavar='file', default='', help='Output filename for the geodesic anisotropy.') g.add_argument( '--md', dest='md', metavar='file', default='', help='Output filename for the mean diffusivity.') g.add_argument( '--mode', dest='mode', metavar='file', default='', help='Output filename for the mode.') g.add_argument( '--norm', dest='norm', metavar='file', default='', help='Output filename for the tensor norm.') g.add_argument( '--rgb', dest='rgb', metavar='file', default='', help='Output filename for the colored fractional anisotropy.') g.add_argument( '--rd', dest='rd', metavar='file', default='', help='Output filename for the radial diffusivity.') g.add_argument( '--tensor', dest='tensor', metavar='file', default='', help='Output filename for the tensor coefficients.') g = p.add_argument_group(title='Quality control files flags') g.add_argument( '--non-physical', dest='p_i_signal', metavar='file', default='', help='Output filename for the voxels with physically implausible ' 'signals \nwhere the mean of b=0 images is below one or more ' 'diffusion-weighted images.') g.add_argument( '--pulsation', dest='pulsation', metavar='string', default='', help='Standard deviation map across all diffusion-weighted images ' 'and across b=0 images if more than one is available.\nShows ' 'pulsation and misalignment artifacts.') g.add_argument( '--residual', dest='residual', metavar='file', default='', help='Output filename for the map of the residual of the tensor fit.') add_force_b0_arg(p) return p
def _build_args_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('input', help='Path of the input multi-shell DWI dataset.') p.add_argument('bvals', help='Path of the bvals file, in FSL format.') p.add_argument('bvecs', help='Path of the bvecs file, in FSL format.') p.add_argument('--mask', help='Path to a binary mask.' + '\nOnly data inside the mask will be used ' 'for computations and reconstruction. ' + '\n[Default: None]') p.add_argument('--tolerance', '-t', metavar='INT', type=int, default=20, help='The tolerated distance between the b-values to ' 'extract\nand the actual b-values [Default: %(default)s].') p.add_argument('--min_k', type=float, default=0.0, help='Minimum kurtosis value in the output maps ' + '\n(ak, mk, rk). In theory, -3/7 is the min kurtosis ' + '\nlimit for regions that consist of water confined ' + '\nto spherical pores (see DIPY example and ' + '\ndocumentation) [Default: %(default)s].') p.add_argument('--max_k', type=float, default=3.0, help='Maximum kurtosis value in the output maps ' + '\n(ak, mk, rk). In theory, 10 is the max kurtosis' + '\nlimit for regions that consist of water confined' + '\nto spherical pores (see DIPY example and ' + '\ndocumentation) [Default: %(default)s].') p.add_argument('--smooth', type=float, default=2.5, help='Smooth input DWI with a 3D Gaussian filter with ' + '\nfull-width-half-max (fwhm). Kurtosis fitting is ' + '\nsensitive and outliers occur easily. According to' + '\ntests on HCP, CB_Brain, Penthera3T, this smoothing' + '\nis thus turned ON by default with fwhm=2.5. ' + '\n[Default: %(default)s].') p.add_argument('--not_all', action='store_true', help='If set, will only save the metrics explicitly ' + '\nspecified using the other metrics flags. ' + '\n[Default: not set].') g = p.add_argument_group(title='Metrics files flags') g.add_argument('--ak', metavar='file', default='', help='Output filename for the axial kurtosis.') g.add_argument('--mk', metavar='file', default='', help='Output filename for the mean kurtosis.') g.add_argument('--rk', metavar='file', default='', help='Output filename for the radial kurtosis.') g.add_argument('--msk', metavar='file', default='', help='Output filename for the mean signal kurtosis.') g.add_argument('--dki_fa', metavar='file', default='', help='Output filename for the fractional anisotropy ' + 'from DKI.') g.add_argument('--dki_md', metavar='file', default='', help='Output filename for the mean diffusivity from DKI.') g.add_argument('--dki_ad', metavar='file', default='', help='Output filename for the axial diffusivity from DKI.') g.add_argument('--dki_rd', metavar='file', default='', help='Output filename for the radial diffusivity from DKI.') g = p.add_argument_group(title='Quality control files flags') g.add_argument('--dki_residual', metavar='file', default='', help='Output filename for the map of the residual ' + 'of the tensor fit.') g.add_argument('--msd', metavar='file', default='', help='Output filename for the mean signal diffusion ' + '(powder-average).') add_force_b0_arg(p) add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, epilog="References: [1] Tournier et al. NeuroImage 2007") p.add_argument('in_dwi', help='Path of the input diffusion volume.') p.add_argument('in_bval', help='Path of the bvals file, in FSL format.') p.add_argument('in_bvec', help='Path of the bvecs file, in FSL format.') p.add_argument('frf_file', help='Path to the output FRF file, in .txt format, ' 'saved by Numpy.') add_force_b0_arg(p) p.add_argument('--mask', help='Path to a binary mask. Only the data inside the ' 'mask will be used for computations and ' 'reconstruction. Useful if no white matter mask ' 'is available.') p.add_argument('--mask_wm', help='Path to a binary white matter mask. Only the data ' 'inside this mask and above the threshold defined ' 'by --fa will be used to estimate the fiber response ' 'function.') p.add_argument('--fa', dest='fa_thresh', default=0.7, type=float, help='If supplied, use this threshold as the initial ' 'threshold to select single fiber voxels. ' '[%(default)s]') p.add_argument('--min_fa', dest='min_fa_thresh', default=0.5, type=float, help='If supplied, this is the minimal value that will be ' 'tried when looking for single fiber ' 'voxels. [%(default)s]') p.add_argument('--min_nvox', default=300, type=int, help='Minimal number of voxels needing to be identified ' 'as single fiber voxels in the automatic ' 'estimation. [%(default)s]') p.add_argument('--roi_radii', nargs='+', default=[20], type=int, help='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 or an array-like (3,). [%(default)s]') p.add_argument('--roi_center', metavar='tuple(3)', nargs=3, type=int, help='If supplied, use this center to span the roi of size ' 'roi_radius. [center of the 3D volume]') add_overwrite_arg(p) add_verbose_arg(p) return p
def buildArgsParser(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) p.add_argument('in_dwi', help='Path to the input diffusion volume.') p.add_argument('in_bval', help='Path to the bval file, in FSL format.') p.add_argument('in_bvec', help='Path to the bvec file, in FSL format.') p.add_argument('out_wm_frf', help='Path to the output WM frf file, in .txt format.') p.add_argument('out_gm_frf', help='Path to the output GM frf file, in .txt format.') p.add_argument('out_csf_frf', help='Path to the output CSF frf file, in .txt format.') p.add_argument( '--mask', help='Path to a binary mask. Only the data inside the mask will be ' 'used for\ncomputations and reconstruction. Useful if no tissue ' 'masks are available.') p.add_argument( '--mask_wm', help='Path to the input WM mask file, used to improve the final WM ' 'frf mask.') p.add_argument( '--mask_gm', help='Path to the input GM mask file, used to improve the final GM ' 'frf mask.') p.add_argument( '--mask_csf', help='Path to the input CSF mask file, used to improve the final CSF ' 'frf mask.') p.add_argument( '--fa_thr_wm', default=0.7, type=float, help='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. [%(default)s]') p.add_argument( '--fa_thr_gm', default=0.2, type=float, help='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. [%(default)s]') p.add_argument( '--fa_thr_csf', default=0.1, type=float, help='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. [%(default)s]') p.add_argument( '--md_thr_gm', default=0.0007, type=float, help='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. [%(default)s]') p.add_argument( '--md_thr_csf', default=0.003, type=float, help='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. [%(default)s]') p.add_argument( '--min_nvox', default=100, type=int, help='Minimal number of voxels needed for each tissue masks ' 'in order to proceed to frf estimation. [%(default)s]') p.add_argument( '--tolerance', type=int, default=20, help='The tolerated gap between the b-values to ' 'extract and the current b-value. [%(default)s]') p.add_argument( '--dti_bval_limit', type=int, default=1200, help='The highest b-value taken for the DTI model. [%(default)s]') p.add_argument( '--roi_radii', default=[10], nargs='+', type=int, help='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). [%(default)s]') p.add_argument( '--roi_center', metavar='tuple(3)', nargs=3, type=int, help='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)') p.add_argument( '--wm_frf_mask', metavar='file', default='', help='Path to the output WM frf mask file, the voxels used ' 'to compute the WM frf.') p.add_argument( '--gm_frf_mask', metavar='file', default='', help='Path to the output GM frf mask file, the voxels used ' 'to compute the GM frf.') p.add_argument( '--csf_frf_mask', metavar='file', default='', help='Path to the output CSF frf mask file, the voxels used ' 'to compute the CSF frf.') p.add_argument( '--frf_table', metavar='file', default='', help='Path to the output frf table file. Saves the frf for ' 'each b-value, in .txt format.') add_force_b0_arg(p) add_overwrite_arg(p) add_verbose_arg(p) return p