def _build_arg_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('input', metavar='fODFs', help='Path of the fODF volume in spherical harmonics (SH).') p.add_argument('fa', metavar='FA', help='Path to the FA volume.') p.add_argument('md', metavar='MD', help='Path to the mean diffusivity (MD) volume.') p.add_argument( '--fa_t', dest='fa_threshold', type=float, default='0.1', help='Maximal threshold of FA (voxels under that threshold are ' 'considered for evaluation, default: 0.1)') p.add_argument( '--md_t', dest='md_threshold', type=float, default='0.003', help='Minimal threshold of MD in mm2/s (voxels above that threshold ' 'are considered for evaluation, default: 0.003)') p.add_argument( '--max_value_output', metavar='file', help='Output path for the text file containing the value. If not set ' 'the file will not be saved.') p.add_argument( '--mask_output', metavar='file', help='Output path for the ventricule mask. If not set, the mask will ' 'not be saved.') add_sh_basis_args(p) add_overwrite_arg(p) p.add_argument('-v', action='store_true', dest='verbose', help='Use verbose output. Default: false.') return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_sh', help='Path to the input file.') p.add_argument('out_sh', help='File name for averaged signal.') p.add_argument('--out_sym', default=None, help='Name of optional symmetric output. [%(default)s]') add_sh_basis_args(p) p.add_argument('--sphere', default='repulsion724', choices=sorted(SPHERE_FILES.keys()), help='Sphere used for the SH to SF projection. ' '[%(default)s]') p.add_argument('--sharpness', default=1.0, type=float, help='Specify sharpness factor to use for weighted average.' ' [%(default)s]') p.add_argument('--sigma', default=1.0, type=float, help='Sigma of the gaussian to use. [%(default)s]') add_verbose_arg(p) add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=__doc__, epilog=EPILOG) p.add_argument('in_fodfs', metavar='fODFs', help='Path of the fODF volume in spherical harmonics (SH).') p.add_argument('in_fa', metavar='FA', help='Path to the FA volume.') p.add_argument('in_md', metavar='MD', help='Path to the mean diffusivity (MD) volume.') p.add_argument('--fa_t', dest='fa_threshold', type=float, default='0.1', help='Maximal threshold of FA (voxels under that threshold' ' are considered for evaluation, [%(default)s]).') p.add_argument('--md_t', dest='md_threshold', type=float, default='0.003', help='Minimal threshold of MD in mm2/s (voxels above that ' 'threshold are considered for ' 'evaluation, [%(default)s]).') p.add_argument('--max_value_output', metavar='file', help='Output path for the text file containing the value. ' 'If not set the file will not be saved.') p.add_argument('--mask_output', metavar='file', help='Output path for the ventricule mask. If not set, ' 'the mask will not be saved.') add_sh_basis_args(p) add_verbose_arg(p) add_overwrite_arg(p) return p
def add_tracking_options(p): track_g = p.add_argument_group('Tracking options') track_g.add_argument('--step', dest='step_size', type=float, default=0.5, help='Step size in mm. [%(default)s]') track_g.add_argument('--min_length', type=float, default=10., metavar='m', help='Minimum length of a streamline in mm. ' '[%(default)s]') track_g.add_argument('--max_length', type=float, default=300., metavar='M', help='Maximum length of a streamline in mm. ' '[%(default)s]') track_g.add_argument('--theta', type=float, help='Maximum angle between 2 steps.\n' '["eudx"=60, "det"=45, "prob"=20]') track_g.add_argument('--sfthres', dest='sf_threshold', metavar='sf_th', type=float, default=0.1, help='Spherical function relative threshold. ' '[%(default)s]') add_sh_basis_args(track_g) return track_g
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.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( formatter_class=argparse.RawTextHelpFormatter, description=__doc__, epilog=EPILOG, ) p.add_argument('bundle_filename', help='Input bundle filename.') p.add_argument('fod_filename', help='Input FOD filename.') p.add_argument('mask_filename', help='Mask to constrain the TODI spatial smoothing,\n' 'for example a WM mask.') add_sh_basis_args(p) p.add_argument('--todi_sigma', choices=[0, 1, 2, 3, 4], default=1, type=int, help='Smooth the orientation histogram.') p.add_argument('--sf_threshold', default=0.2, type=float, help='Relative threshold for sf masking (0.0-1.0).') p.add_argument('--output_prefix', default='', help='Add a prefix to all output filename, \n' 'default is no prefix.') p.add_argument('--output_dir', default='./', help='Output directory for all generated files,\n' 'default is current directory.') add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, epilog=EPILOG, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_sh', help='Input SH image.') p.add_argument('--mask', default='', help='Optional mask.') # outputs p.add_argument('--cos_asym_map', default='', help='Output asymmetry map using cos similarity.') p.add_argument('--odd_power_map', default='', help='Output odd power map.') p.add_argument('--peaks', default='', help='Output filename for the extracted peaks.') p.add_argument('--peak_values', default='', help='Output filename for the extracted peaks values.') p.add_argument('--peak_indices', default='', help='Output filename for the generated peaks indices on ' 'the sphere.') p.add_argument('--nupeaks', default='', help='Output filename for the nupeaks file.') p.add_argument('--not_all', action='store_true', help='If set, only saves the files specified using the ' 'file flags [%(default)s].') p.add_argument('--at', dest='a_threshold', type=float, default='0.0', help='Absolute threshold on fODF amplitude. This ' 'value should be set to\napproximately 1.5 to 2 times ' 'the maximum fODF amplitude in isotropic voxels\n' '(ie. ventricles).\n' 'Use compute_fodf_max_in_ventricles.py to find the ' 'maximal value.\n' 'See [Dell\'Acqua et al HBM 2013] [%(default)s].') p.add_argument('--rt', dest='r_threshold', type=float, default='0.1', help='Relative threshold on fODF amplitude in percentage ' '[%(default)s].') p.add_argument('--sphere', default='symmetric724', choices=sorted(SPHERE_FILES.keys()), help='Sphere to use for peak directions estimation ' '[%(default)s].') add_processes_arg(p) add_sh_basis_args(p) 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.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', metavar='fODFs', help='Path of the fODF volume in spherical harmonics (SH).') p.add_argument( 'at', metavar='a_threshold', type=float, help='WARNING!!! EXTREMELY IMPORTANT PARAMETER, VARIABLE ' 'ACROSS DATASETS!!!\nAbsolute threshold on fODF amplitude.\nThis ' 'value should set to approximately 1.5 to 2 times the maximum\n' 'fODF amplitude in isotropic voxels (ex. ventricles).\n' 'compute_fodf_max_in_ventricles.py can be used to find the ' 'maximal value.\nSee [Dell\'Acqua et al HBM 2013].') p.add_argument( '--sphere', metavar='string', default='repulsion724', choices=['repulsion100', 'repulsion724'], help='Discrete sphere to use in the processing. [%(default)s].') p.add_argument( '--mask', metavar='', help='Path to a binary mask. Only the data inside the mask will be ' 'used for computations and reconstruction [%(default)s].') p.add_argument( '--rt', dest='r_threshold', type=float, default='0.1', help='Relative threshold on fODF amplitude in percentage ' '[%(default)s].') add_sh_basis_args(p) add_overwrite_arg(p) p.add_argument( '--vis', dest='visu', action='store_true', help='Export map for better visualization in FiberNavigator.\n' '!WARNING! these maps should not be used to compute statistics ' '[%(default)s].') p.add_argument( '--not_all', action='store_true', help='If set, only saves the files specified using the file flags ' '[%(default)s].') g = p.add_argument_group(title='File flags') g.add_argument( '--afd', metavar='file', default='', help='Output filename for the AFD_max map.') g.add_argument( '--afd_total', metavar='file', default='', help='Output filename for the AFD_total map (SH coeff = 0).') g.add_argument( '--afd_sum', metavar='file', default='', help='Output filename for the sum of all peak contributions (sum of ' 'fODF lobes on the sphere).') g.add_argument('--nufo', metavar='file', default='', help='Output filename for the NuFO map.') g.add_argument('--peaks', metavar='file', default='', help='Output filename for the extracted peaks.') return p
def _build_arg_parser(): p = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=__doc__) p.add_argument('input_sh', help='Input SH filename. (nii or nii.gz)') p.add_argument('output_name', help='Name of the output file.') add_sh_basis_args(p, mandatory=True) add_overwrite_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__, epilog=EPILOG, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_tractogram', help='Input streamlines file.') add_reference_arg(p) p.add_argument('--sphere', default='repulsion724', help='sphere used for the angular discretization. ' '[%(default)s]') p.add_argument('--mask', help='Use the given mask.') p.add_argument('--out_mask', help='Mask showing where TDI > 0.') p.add_argument('--out_tdi', help='Output Track Density Image (TDI).') p.add_argument('--out_todi_sf', help='Output TODI, with SF (each directions\n' 'on the sphere, requires a lot of memory)') p.add_argument('--out_todi_sh', help='Output TODI, with SH coefficients.') p.add_argument('--sh_order', type=int, default=8, help='Order of the original SH. [%(default)s]') p.add_argument('--normalize_per_voxel', action='store_true', help='Normalize each SF/SH at each voxel [%(default)s].') p.add_argument('--smooth_todi', action='store_true', help='Smooth TODI (angular and spatial) [%(default)s].') p.add_argument('--asymmetric', action='store_true', help='Compute asymmetric TODI [%(default)s].') p.add_argument('--n_steps', default=1, type=int, help='Number of steps for streamline segments ' 'subdivision prior to binning [%(default)s].') add_sh_basis_args(p) add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_fODF', help='Path of the fODF volume in spherical harmonics (SH).') p.add_argument('--sphere', metavar='string', default='repulsion724', choices=['repulsion100', 'repulsion724'], help='Discrete sphere to use in the processing ' '[%(default)s].') p.add_argument('--mask', metavar='', help='Path to a binary mask. Only the data inside the mask\n' 'will beused for computations and reconstruction ' '[%(default)s].') p.add_argument('--at', dest='a_threshold', type=float, default='0.0', help='Absolute threshold on fODF amplitude. This ' 'value should be set to\napproximately 1.5 to 2 times ' 'the maximum fODF amplitude in isotropic voxels\n' '(ie. ventricles).\nUse compute_fodf_max_in_ventricles.py ' 'to find the maximal value.\n' 'See [Dell\'Acqua et al HBM 2013] [%(default)s].') p.add_argument('--rt', dest='r_threshold', type=float, default='0.1', help='Relative threshold on fODF amplitude in percentage ' '[%(default)s].') add_sh_basis_args(p) add_overwrite_arg(p) add_processes_arg(p) p.add_argument('--not_all', action='store_true', help='If set, only saves the files specified using the ' 'file flags [%(default)s].') g = p.add_argument_group(title='File flags') g.add_argument('--afd_max', metavar='file', default='', help='Output filename for the AFD_max map.') g.add_argument('--afd_total', metavar='file', default='', help='Output filename for the AFD_total map (SH coeff = 0).') g.add_argument('--afd_sum', metavar='file', default='', help='Output filename for the sum of all peak contributions\n' '(sum of fODF lobes on the sphere).') g.add_argument('--nufo', metavar='file', default='', help='Output filename for the NuFO map.') g.add_argument('--rgb', metavar='file', default='', help='Output filename for the RGB map.') g.add_argument('--peaks', metavar='file', default='', help='Output filename for the extracted peaks.') g.add_argument('--peak_values', metavar='file', default='', help='Output filename for the extracted peaks values.') g.add_argument('--peak_indices', metavar='file', default='', help='Output filename for the generated peaks indices on ' 'the sphere.') 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_sh', help='Path to the input file.') p.add_argument('out_sh', help='File name for averaged signal.') p.add_argument('--out_asymmetry', default='asym_map.nii.gz', help='File name for asymmetry map. Can only be outputed' ' when the output SH basis is full. [%(default)s]') p.add_argument('--sh_order', default=8, type=int, help='SH order of the input. [%(default)s]') add_sh_basis_args(p) p.add_argument('--sphere', default='repulsion724', choices=sorted(SPHERE_FILES.keys()), help='Sphere used for the SH to SF projection. ' '[%(default)s]') p.add_argument('--sharpness', default=1.0, type=float, help='Specify sharpness factor to use for weighted average.' ' [%(default)s]') p.add_argument('--sigma', default=1.0, type=float, help='Sigma of the gaussian to use. [%(default)s]') p.add_argument('--out_sym', action='store_true', help='If set, saves output in symmetric SH basis.') add_verbose_arg(p) add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, epilog=EPILOG, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_bundle', help='Path of the bundle file.') p.add_argument('in_fodf', help='Path of the fODF volume in spherical harmonics (SH).') p.add_argument('afd_mean_map', help='Path of the output mean AFD map.') p.add_argument('--length_weighting', action='store_true', help='If set, will weigh the AFD values according to ' 'segment lengths. [%(default)s]') add_reference_arg(p) add_sh_basis_args(p) add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, epilog=EPILOG, formatter_class=argparse.RawTextHelpFormatter) p.add_argument('in_hdf5', help='HDF5 filename (.h5) containing decomposed ' 'connections.') p.add_argument('in_fodf', help='Path of the fODF volume in spherical harmonics (SH).') p.add_argument('out_hdf5', help='Path of the output HDF5 filenames (.h5).') p.add_argument('--length_weighting', action='store_true', help='If set, will weigh the AFD values according to ' 'segment lengths. [%(default)s]') add_processes_arg(p) add_sh_basis_args(p) add_overwrite_arg(p) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, epilog=EPILOG, formatter_class=argparse.RawTextHelpFormatter) # TODO Rename argument in_bundle p.add_argument('tract_filename', help='Input streamlines file.') add_reference_arg(p) # TODO Uniformize argparse p.add_argument('--sphere', default='repulsion724', help='sphere used for the angular discretization.') p.add_argument('--mask', help='Use the given mask') p.add_argument('--out_mask', help='Mask showing where TDI > 0.') p.add_argument('--out_lw_tdi', help='Output length-weighted TDI map.') p.add_argument('--out_lw_todi', help='Output length-weighted TODI map.') p.add_argument('--out_lw_todi_sh', help='Output length-weighted TODI map, ' 'with SH coefficient.') p.add_argument('--sh_order', type=int, default=8, help='Order of the original SH.') p.add_argument('--sh_normed', action='store_true', help='Normalize sh.') p.add_argument('--smooth', action='store_true', help='Smooth todi (angular and spatial).') add_sh_basis_args(p) 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 to the input file.') p.add_argument('out_sh', help='File name for averaged signal.') add_sh_basis_args(p) p.add_argument('--out_sym', default=None, help='Name of optional symmetric output. [%(default)s]') p.add_argument('--sphere', default='repulsion724', choices=sorted(SPHERE_FILES.keys()), help='Sphere used for the SH to SF projection. ' '[%(default)s]') p.add_argument('--sigma_angular', default=1.0, type=float, help='Standard deviation for angular distance.' ' [%(default)s]') p.add_argument('--sigma_spatial', default=1.0, type=float, help='Standard deviation for spatial distance.' ' [%(default)s]') p.add_argument('--sigma_range', default=1.0, type=float, help='Standard deviation for range filter.' ' [%(default)s]') p.add_argument('--use_gpu', action='store_true', help='Use GPU for computation.') add_verbose_arg(p) add_overwrite_arg(p) add_processes_arg(p) return p
def _build_args_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter, epilog='References: [1] Girard, G., Whittingstall K., Deriche, R., ' 'and Descoteaux, M. (2014). Towards quantitative connectivity ' 'analysis: reducing tractography biases. Neuroimage, 98, ' '266-278.') p._optionals.title = 'Generic options' p.add_argument( 'sh_file', help='Spherical harmonic file. Data must be aligned with \nseed_file ' '(isotropic resolution, nifti, see --basis).') p.add_argument('seed_file', help='Seeding mask (isotropic resolution, nifti).') p.add_argument( 'map_include_file', help='The probability map of ending the streamline and \nincluding it ' 'in the output (CMC, PFT [1]). \n(isotropic resolution, nifti).') p.add_argument( 'map_exclude_file', help='The probability map of ending the streamline and \nexcluding it ' 'in the output (CMC, PFT [1]). \n(isotropic resolution, nifti).') p.add_argument('output_file', help='Streamline output file (must be trk or tck).') track_g = p.add_argument_group('Tracking options') track_g.add_argument( '--algo', default='prob', choices=['det', 'prob'], help='Algorithm to use (must be "det" or "prob"). [%(default)s]') track_g.add_argument('--step', dest='step_size', type=float, default=0.5, help='Step size in mm. [%(default)s]') track_g.add_argument( '--min_length', type=float, default=10., help='Minimum length of a streamline in mm. [%(default)s]') track_g.add_argument( '--max_length', type=float, default=300., help='Maximum length of a streamline in mm. [%(default)s]') track_g.add_argument( '--theta', type=float, help='Maximum angle between 2 steps. ["det"=45, "prob"=20]') track_g.add_argument( '--act', action='store_true', help='If set, uses anatomically-constrained tractography (ACT)\n' 'instead of continuous map criterion (CMC).') track_g.add_argument( '--sfthres', dest='sf_threshold', type=float, default=0.1, help='Spherical function relative threshold. [%(default)s]') track_g.add_argument( '--sfthres_init', dest='sf_threshold_init', type=float, default=0.5, help='Spherical function relative threshold value for the \ninitial ' 'direction. [%(default)s]') add_sh_basis_args(track_g) seed_group = p.add_argument_group( 'Seeding options', 'When no option is provided, uses --npv 1.') seed_sub_exclusive = seed_group.add_mutually_exclusive_group() seed_sub_exclusive.add_argument('--npv', type=int, help='Number of seeds per voxel.') seed_sub_exclusive.add_argument('--nt', type=int, help='Total number of seeds to use.') pft_g = p.add_argument_group('PFT options') pft_g.add_argument( '--particles', type=int, default=15, help='Number of particles to use for PFT. [%(default)s]') pft_g.add_argument('--back', dest='back_tracking', type=float, default=2., help='Length of PFT back tracking in mm. [%(default)s]') pft_g.add_argument( '--forward', dest='forward_tracking', type=float, default=1., help='Length of PFT forward tracking in mm. [%(default)s]') out_g = p.add_argument_group('Output options') out_g.add_argument( '--compress', type=float, help='If set, will compress streamlines. The parameter\nvalue is the ' 'distance threshold. A rule of thumb\nis to set it to 0.1mm for ' 'deterministic\nstreamlines and 0.2mm for probabilitic ' 'streamlines.') out_g.add_argument('--all', dest='keep_all', action='store_true', help='If set, keeps "excluded" streamlines.\n' 'NOT RECOMMENDED, except for debugging.') out_g.add_argument('--seed', type=int, help='Random number generator seed.') add_overwrite_arg(out_g) log_g = p.add_argument_group('Logging options') add_verbose(log_g) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, epilog=EPILOG, formatter_class=argparse.RawTextHelpFormatter) # rename `optional arguments` group to `Generic options` p._optionals.title = 'Generic options' # mandatory tracking options add_mandatory_options_tracking(p) track_g = p.add_argument_group('Tracking options') track_g.add_argument('--step_size', type=float, default=0.5, help='Step size in mm. [%(default)s]') track_g.add_argument('--theta', type=float, nargs='+', default=20.0, help='Maximum angle between 2 steps. If more than one' ' value\nare given, the maximum angle will be ' 'drawn at random\nfrom the distribution for each' ' streamline. [%(default)s]') track_g.add_argument('--min_length', type=float, default=20.0, help='Minimum length of the streamline ' 'in mm. [%(default)s]') track_g.add_argument('--max_length', type=float, default=300.0, help='Maximum length of the streamline ' 'in mm. [%(default)s]') track_g.add_argument('--forward_only', action='store_true', help='Only perform forward tracking.') add_sh_basis_args(track_g) # seeding options add_seeding_options(p) out_g = p.add_argument_group('Output options') out_g.add_argument('--save_seeds', action='store_true', help='Save seed positions in data_per_streamline.') out_g.add_argument('--compress', type=float, help='Compress streamlines using the given threshold.') # random number generator for SF sampling out_g.add_argument('--rng_seed', type=int, help='Random number generator seed.') add_overwrite_arg(out_g) gpu_g = p.add_argument_group('GPU options') gpu_g.add_argument('--batch_size', type=int, default=100000, help='Approximate size of GPU batches (number\n' 'of streamlines to track in parallel).' ' [%(default)s]') log_g = p.add_argument_group('Logging options') add_verbose_arg(log_g) return p
def _build_arg_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) p._optionals.title = 'Generic options' p.add_argument('sh_file', help='Spherical harmonic file. \n' '(isotropic resolution, nifti, see --basis).') p.add_argument('seed_file', help='Seeding mask (isotropic resolution, nifti).') p.add_argument('mask_file', help='Seeding mask(isotropic resolution, nifti).\n' + 'Tracking will stop outside this mask') p.add_argument('output_file', help='Streamline output file (must be trk or tck).') track_g = p.add_argument_group('Tracking options') track_g.add_argument( '--algo', default='prob', choices=['det', 'prob'], help='Algorithm to use (must be "det" or "prob"). [%(default)s]') track_g.add_argument('--step', dest='step_size', type=float, default=0.5, help='Step size in mm. [%(default)s]') track_g.add_argument( '--min_length', type=float, default=10., help='Minimum length of a streamline in mm. [%(default)s]') track_g.add_argument( '--max_length', type=float, default=300., help='Maximum length of a streamline in mm. [%(default)s]') track_g.add_argument( '--theta', type=float, help='Maximum angle between 2 steps. ["eudx"=60, det"=45, "prob"=20]') track_g.add_argument( '--sfthres', dest='sf_threshold', type=float, default=0.1, help='Spherical function relative threshold. [%(default)s]') add_sh_basis_args(track_g) seed_group = p.add_argument_group( 'Seeding options', 'When no option is provided, uses --npv 1.') seed_sub_exclusive = seed_group.add_mutually_exclusive_group() seed_sub_exclusive.add_argument('--npv', type=int, help='Number of seeds per voxel.') seed_sub_exclusive.add_argument('--nt', type=int, help='Total number of seeds to use.') p.add_argument('--sphere', choices=sorted(SPHERE_FILES.keys()), default='symmetric724', help='Set of directions to be used for tracking') out_g = p.add_argument_group('Output options') out_g.add_argument( '--compress', type=float, help='If set, will compress streamlines. The parameter\nvalue is the ' 'distance threshold. A rule of thumb\nis to set it to 0.1mm for ' 'deterministic\nstreamlines and 0.2mm for probabilitic ' 'streamlines.') out_g.add_argument('--seed', type=int, help='Random number generator seed.') add_overwrite_arg(out_g) log_g = p.add_argument_group('Logging options') add_verbose(log_g) return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) # Positional arguments p.add_argument('in_fodf', default=None, help='Input SH image file.') # Window configuration options p.add_argument('--slice_index', type=int, help='Index of the slice to visualize along a given axis. ' 'Defaults to middle of volume.') p.add_argument('--win_dims', nargs=2, metavar=('WIDTH', 'HEIGHT'), default=(768, 768), type=int, help='The dimensions for the vtk window. [%(default)s]') p.add_argument('--interactor', default='trackball', choices={'image', 'trackball'}, help='Specify interactor mode for vtk window. ' '[%(default)s]') p.add_argument('--axis_name', default='axial', type=str, choices={'axial', 'coronal', 'sagittal'}, help='Name of the axis to visualize. [%(default)s]') p.add_argument('--silent', action='store_true', help='Disable interactive visualization.') p.add_argument('--output', help='Path to output file.') add_overwrite_arg(p) # Optional FODF personalization arguments add_sh_basis_args(p) sphere_choices = { 'symmetric362', 'symmetric642', 'symmetric724', 'repulsion724', 'repulsion100', 'repulsion200' } p.add_argument('--sphere', default='symmetric724', choices=sphere_choices, help='Name of the sphere used to reconstruct SF. ' '[%(default)s]') p.add_argument('--sph_subdivide', type=int, help='Number of subdivisions for given sphere. If not ' 'supplied, use the given sphere as is.') p.add_argument('--mask', help='Optional mask file. Only fODF inside ' 'the mask are displayed.') p.add_argument('--colormap', default=None, help='Colormap for the ODF slicer. If None, ' 'then a RGB colormap will be used. [%(default)s]') p.add_argument('--scale', default=0.5, type=float, help='Scaling factor for FODF. [%(default)s]') p.add_argument('--radial_scale_off', action='store_true', help='Disable radial scale for ODF slicer.') p.add_argument('--norm_off', action='store_true', help='Disable normalization of ODF slicer.') # Background image options p.add_argument('--background', help='Background image file. If RGB, values must ' 'be between 0 and 255.') p.add_argument('--bg_range', nargs=2, metavar=('MIN', 'MAX'), type=float, help='The range of values mapped to range [0, 1] ' 'for background image. [(bg.min(), bg.max())]') p.add_argument('--bg_opacity', type=float, default=1.0, help='The opacity of the background image. Opacity of 0.0 ' 'means transparent and 1.0 is completely visible. ' '[%(default)s]') p.add_argument('--bg_offset', type=float, default=0.5, help='The offset of the background image. [%(default)s]') p.add_argument('--bg_interpolation', default='nearest', choices={'linear', 'nearest'}, help='Interpolation mode for the background image. ' '[%(default)s]') # Peaks input file options p.add_argument('--peaks', help='Peaks image file.') p.add_argument('--peaks_color', nargs=3, type=float, help='Color used for peaks. If None, ' 'then a RGB colormap is used. [%(default)s]') p.add_argument('--peaks_width', default=1.0, type=float, help='Width of peaks segments. [%(default)s]') peaks_scale_group = p.add_mutually_exclusive_group() peaks_scale_group.add_argument('--peaks_values', help='Peaks values file.') peaks_scale_group.add_argument('--peaks_length', default=0.65, type=float, help='Length of the peaks segments. ' '[%(default)s]') return p
def _build_arg_parser(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) p._optionals.title = 'Generic options' p.add_argument('in_sh', help='Spherical harmonic file (.nii.gz) OR \n' 'peaks/evecs (.nii.gz) for EUDX tracking.') p.add_argument('in_seed', help='Seeding mask (.nii.gz).') p.add_argument('in_mask', help='Seeding mask (.nii.gz).\n' 'Tracking will stop outside this mask.') p.add_argument('out_tractogram', help='Tractogram output file (must be .trk or .tck).') track_g = p.add_argument_group('Tracking options') track_g.add_argument('--algo', default='prob', choices=['det', 'prob', 'eudx'], help='Algorithm to use [%(default)s]') track_g.add_argument('--step', dest='step_size', type=float, default=0.5, help='Step size in mm. [%(default)s]') track_g.add_argument('--min_length', type=float, default=10., help='Minimum length of a streamline in mm. ' '[%(default)s]') track_g.add_argument('--max_length', type=float, default=300., help='Maximum length of a streamline in mm. ' '[%(default)s]') track_g.add_argument('--theta', type=float, help='Maximum angle between 2 steps.\n' '["eudx"=60, "det"=45, "prob"=20]') track_g.add_argument('--sfthres', dest='sf_threshold', type=float, default=0.1, help='Spherical function relative threshold. ' '[%(default)s]') add_sh_basis_args(track_g) seed_group = p.add_argument_group( 'Seeding options', 'When no option is provided, uses --npv 1.') seed_sub_exclusive = seed_group.add_mutually_exclusive_group() seed_sub_exclusive.add_argument('--npv', type=int, help='Number of seeds per voxel.') seed_sub_exclusive.add_argument('--nt', type=int, help='Total number of seeds to use.') p.add_argument('--sphere', choices=sorted(SPHERE_FILES.keys()), default='symmetric724', help='Set of directions to be used for tracking.') out_g = p.add_argument_group('Output options') out_g.add_argument('--compress', type=float, help='If set, will compress streamlines.\n' 'The parameter value is the distance threshold.') out_g.add_argument('--seed', type=int, help='Random number generator seed.') add_overwrite_arg(out_g) out_g.add_argument('--save_seeds', action='store_true', help='If set, save the seeds used for the tracking \n ' 'in the data_per_streamline property.') log_g = p.add_argument_group('Logging options') add_verbose_arg(log_g) return p