def _get_parser(): """ Parses command line inputs for tedana Returns ------- parser.parse_args() : argparse dict """ parser = argparse.ArgumentParser() parser.add_argument('-d', dest='data', nargs='+', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Multi-echo dataset for analysis. May be a ' 'single file with spatially concatenated data ' 'or a set of echo-specific files, in the same ' 'order as the TEs are listed in the -e ' 'argument.'), required=True) parser.add_argument('-e', dest='tes', nargs='+', metavar='TE', type=float, help='Echo times (in ms). E.g., 15.0 39.0 63.0', required=True) parser.add_argument('--mask', dest='mask', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Binary mask of voxels to include in TE ' 'Dependent ANAlysis. Must be in the same ' 'space as `data`.'), default=None) parser.add_argument('--fitmode', dest='fitmode', action='store', choices=['all', 'ts'], help=('Monoexponential model fitting scheme. ' '"all" means that the model is fit, per voxel, ' 'across all timepoints. ' '"ts" means that the model is fit, per voxel ' 'and per timepoint.'), default='all') parser.add_argument('--combmode', dest='combmode', action='store', choices=['t2s', 'ste'], help=('Combination scheme for TEs: ' 't2s (Posse 1999, default), ste (Poser)'), default='t2s') parser.add_argument('--label', dest='label', type=str, help='Label for output directory.', default=None) return parser
def _get_parser(): """ Parses command line inputs for tedana Returns ------- parser.parse_args() : argparse dict """ parser = argparse.ArgumentParser() # Argument parser follow templtate provided by RalphyZ # https://stackoverflow.com/a/43456577 optional = parser._action_groups.pop() required = parser.add_argument_group('Required Arguments') required.add_argument('-d', dest='data', nargs='+', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Multi-echo dataset for analysis. May be a ' 'single file with spatially concatenated data ' 'or a set of echo-specific files, in the same ' 'order as the TEs are listed in the -e ' 'argument.'), required=True) required.add_argument('-e', dest='tes', nargs='+', metavar='TE', type=float, help='Echo times (in ms). E.g., 15.0 39.0 63.0', required=True) optional.add_argument('--out-dir', dest='out_dir', type=str, metavar='PATH', help='Output directory.', default='.') optional.add_argument('--mask', dest='mask', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Binary mask of voxels to include in TE ' 'Dependent ANAlysis. Must be in the same ' 'space as `data`.'), default=None) optional.add_argument('--fittype', dest='fittype', action='store', choices=['loglin', 'curvefit'], help='Desired Fitting Method' '"loglin" means that a linear model is fit' ' to the log of the data, default' '"curvefit" means that a more computationally' 'demanding monoexponential model is fit' 'to the raw data', default='loglin') optional.add_argument( '--fitmode', dest='fitmode', action='store', choices=['all', 'ts'], help=('Monoexponential model fitting scheme. ' '"all" means that the model is fit, per voxel, ' 'across all timepoints. ' '"ts" means that the model is fit, per voxel ' 'and per timepoint.'), default='all') optional.add_argument('--combmode', dest='combmode', action='store', choices=['t2s', 'paid'], help=('Combination scheme for TEs: ' 't2s (Posse 1999, default), paid (Poser)'), default='t2s') optional.add_argument('--n-threads', dest='n_threads', type=int, action='store', help=('Number of threads to use. Used by ' 'threadpoolctl to set the parameter outside ' 'of the workflow function. Higher numbers of ' 'threads tend to slow down performance on ' 'typical datasets. Default is 1.'), default=1) optional.add_argument('--debug', dest='debug', help=argparse.SUPPRESS, action='store_true', default=False) optional.add_argument('--quiet', dest='quiet', help=argparse.SUPPRESS, action='store_true', default=False) parser._action_groups.append(optional) return parser
def _get_parser(): """ Parses command line inputs for tedana Returns ------- parser.parse_args() : argparse dict """ parser = argparse.ArgumentParser() # Argument parser follow templtate provided by RalphyZ # https://stackoverflow.com/a/43456577 optional = parser._action_groups.pop() required = parser.add_argument_group('required arguments') required.add_argument('-d', dest='data', nargs='+', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Multi-echo dataset for analysis. May be a ' 'single file with spatially concatenated data ' 'or a set of echo-specific files, in the same ' 'order as the TEs are listed in the -e ' 'argument.'), required=True) required.add_argument('-e', dest='tes', nargs='+', metavar='TE', type=float, help='Echo times (in ms). E.g., 15.0 39.0 63.0', required=True) optional.add_argument('--mask', dest='mask', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=("Binary mask of voxels to include in TE " "Dependent ANAlysis. Must be in the same " "space as `data`. If an explicit mask is not " "provided, then Nilearn's compute_epi_mask " "function will be used to derive a mask " "from the first echo's data."), default=None) optional.add_argument('--mix', dest='mixm', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('File containing mixing matrix. If not ' 'provided, ME-PCA & ME-ICA is done.'), default=None) optional.add_argument('--ctab', dest='ctab', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('File containing a component table from which ' 'to extract pre-computed classifications.'), default=None) optional.add_argument('--manacc', dest='manacc', help=('Comma separated list of manually ' 'accepted components'), default=None) optional.add_argument('--sourceTEs', dest='source_tes', type=str, help=('Source TEs for models. E.g., 0 for all, ' '-1 for opt. com., and 1,2 for just TEs 1 and ' '2. Default=-1.'), default=-1) optional.add_argument('--combmode', dest='combmode', action='store', choices=['t2s'], help=('Combination scheme for TEs: ' 't2s (Posse 1999, default)'), default='t2s') optional.add_argument('--verbose', dest='verbose', action='store_true', help='Generate intermediate and additional files.', default=False) optional.add_argument('--tedort', dest='tedort', action='store_true', help=('Orthogonalize rejected components w.r.t. ' 'accepted components prior to denoising.'), default=False) optional.add_argument('--gscontrol', dest='gscontrol', required=False, action='store', nargs='+', help=('Perform additional denoising to remove ' 'spatially diffuse noise. Default is None. ' 'This argument can be single value or a space ' 'delimited list'), choices=['t1c', 'gsr'], default=None) optional.add_argument('--tedpca', dest='tedpca', help='Method with which to select components in TEDPCA', choices=['mle', 'kundu', 'kundu-stabilize'], default='mle') optional.add_argument('--out-dir', dest='out_dir', type=str, help='Output directory.', default='.') optional.add_argument('--seed', dest='fixed_seed', type=int, help=('Value passed to repr(mdp.numx_rand.seed()). ' 'Set to an integer value for reproducible ICA results. ' 'Set to -1 for varying results across ICA calls. ' 'Default=42.'), default=42) optional.add_argument('--png', dest='png', action='store_true', help=('Creates a figures folder with static component ' 'maps, timecourse plots and other diagnostic ' 'images'), default=False) optional.add_argument('--png-cmap', dest='png_cmap', type=str, help=('Colormap for figures'), default='coolwarm') optional.add_argument('--maxit', dest='maxit', type=int, help=('Maximum number of iterations for ICA.'), default=500) optional.add_argument('--maxrestart', dest='maxrestart', type=int, help=('Maximum number of attempts for ICA. If ICA ' 'fails to converge, the fixed seed will be ' 'updated and ICA will be run again. If ' 'convergence is achieved before maxrestart ' 'attempts, ICA will finish early.'), default=10) optional.add_argument('--debug', dest='debug', help=argparse.SUPPRESS, action='store_true', default=False) optional.add_argument('--quiet', dest='quiet', help=argparse.SUPPRESS, action='store_true', default=False) parser._action_groups.append(optional) return parser
def _get_parser(): """ Parses command line inputs for tedana Returns ------- parser.parse_args() : argparse dict """ parser = argparse.ArgumentParser() # Argument parser follow templtate provided by RalphyZ # https://stackoverflow.com/a/43456577 optional = parser._action_groups.pop() required = parser.add_argument_group("Required Arguments") required.add_argument( "-d", dest="data", nargs="+", metavar="FILE", type=lambda x: is_valid_file(parser, x), help=("Multi-echo dataset for analysis. May be a " "single file with spatially concatenated data " "or a set of echo-specific files, in the same " "order as the TEs are listed in the -e " "argument."), required=True, ) required.add_argument( "-e", dest="tes", nargs="+", metavar="TE", type=float, help="Echo times (in ms). E.g., 15.0 39.0 63.0", required=True, ) optional.add_argument( "--out-dir", dest="out_dir", type=str, metavar="PATH", help="Output directory.", default=".", ) optional.add_argument( "--mask", dest="mask", metavar="FILE", type=lambda x: is_valid_file(parser, x), help=("Binary mask of voxels to include in TE " "Dependent ANAlysis. Must be in the same " "space as `data`."), default=None, ) optional.add_argument("--prefix", dest="prefix", type=str, help="Prefix for filenames generated.", default="") optional.add_argument( "--convention", dest="convention", action="store", choices=["orig", "bids"], help= ("Filenaming convention. bids will use the latest BIDS derivatives version." ), default="bids", ) optional.add_argument( "--fittype", dest="fittype", action="store", choices=["loglin", "curvefit"], help="Desired Fitting Method" '"loglin" means that a linear model is fit' " to the log of the data, default" '"curvefit" means that a more computationally' "demanding monoexponential model is fit" "to the raw data", default="loglin", ) optional.add_argument( "--fitmode", dest="fitmode", action="store", choices=["all", "ts"], help=("Monoexponential model fitting scheme. " '"all" means that the model is fit, per voxel, ' "across all timepoints. " '"ts" means that the model is fit, per voxel ' "and per timepoint."), default="all", ) optional.add_argument( "--combmode", dest="combmode", action="store", choices=["t2s", "paid"], help= ("Combination scheme for TEs: t2s (Posse 1999, default), paid (Poser)" ), default="t2s", ) optional.add_argument( "--n-threads", dest="n_threads", type=int, action="store", help=("Number of threads to use. Used by " "threadpoolctl to set the parameter outside " "of the workflow function. Higher numbers of " "threads tend to slow down performance on " "typical datasets. Default is 1."), default=1, ) optional.add_argument("--debug", dest="debug", help=argparse.SUPPRESS, action="store_true", default=False) optional.add_argument("--quiet", dest="quiet", help=argparse.SUPPRESS, action="store_true", default=False) parser._action_groups.append(optional) return parser
def _get_parser(): """ Parses command line inputs for tedana Returns ------- parser.parse_args() : argparse dict """ parser = argparse.ArgumentParser() parser.add_argument('-d', dest='data', nargs='+', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Multi-echo dataset for analysis. May be a ' 'single file with spatially concatenated data ' 'or a set of echo-specific files, in the same ' 'order as the TEs are listed in the -e ' 'argument.'), required=True) parser.add_argument('-e', dest='tes', nargs='+', metavar='TE', type=float, help='Echo times (in ms). E.g., 15.0 39.0 63.0', required=True) parser.add_argument('--mask', dest='mask', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Binary mask of voxels to include in TE ' 'Dependent ANAlysis. Must be in the same ' 'space as `data`.'), default=None) parser.add_argument('--mix', dest='mixm', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('File containing mixing matrix. If not ' 'provided, ME-PCA & ME-ICA is done.'), default=None) parser.add_argument('--ctab', dest='ctab', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('File containing a component table from which ' 'to extract pre-computed classifications.'), default=None) parser.add_argument('--manacc', dest='manacc', help=('Comma separated list of manually ' 'accepted components'), default=None) parser.add_argument('--kdaw', dest='kdaw', type=float, help=('Dimensionality augmentation weight (Kappa). ' 'Default=10. -1 for low-dimensional ICA'), default=10.) parser.add_argument('--rdaw', dest='rdaw', type=float, help=('Dimensionality augmentation weight (Rho). ' 'Default=1. -1 for low-dimensional ICA'), default=1.) parser.add_argument('--conv', dest='conv', type=float, help='Convergence limit. Default 2.5e-5', default='2.5e-5') parser.add_argument('--sourceTEs', dest='ste', type=str, help=('Source TEs for models. E.g., 0 for all, ' '-1 for opt. com., and 1,2 for just TEs 1 and ' '2. Default=-1.'), default=-1) parser.add_argument('--combmode', dest='combmode', action='store', choices=['t2s', 'ste'], help=('Combination scheme for TEs: ' 't2s (Posse 1999, default), ste (Poser)'), default='t2s') parser.add_argument('--cost', dest='cost', help=('Cost func. for ICA: ' 'logcosh (default), cube, exp'), choices=['logcosh', 'cube', 'exp'], default='logcosh') parser.add_argument('--denoiseTEs', dest='dne', action='store_true', help='Denoise each TE dataset separately.', default=False) parser.add_argument('--strict', dest='strict', action='store_true', help='Ignore low-variance ambiguous components', default=False) parser.add_argument('--no_gscontrol', dest='gscontrol', action='store_false', help='Disable global signal regression.', default=True) parser.add_argument('--stabilize', dest='stabilize', action='store_true', help=('Stabilize convergence by reducing ' 'dimensionality, for low quality data'), default=False) parser.add_argument('--filecsdata', dest='filecsdata', help='Save component selection data', action='store_true', default=False) parser.add_argument('--wvpca', dest='wvpca', help='Perform PCA on wavelet-transformed data', action='store_true', default=False) parser.add_argument('--label', dest='label', type=str, help='Label for output directory.', default=None) parser.add_argument( '--seed', dest='fixed_seed', type=int, help=('Value passed to repr(mdp.numx_rand.seed()) ' 'Set to an integer value for reproducible ICA results; ' 'otherwise, set to -1 for varying results across calls.'), default=42) parser.add_argument('--debug', dest='debug', help=argparse.SUPPRESS, action='store_true', default=False) parser.add_argument('--quiet', dest='quiet', help=argparse.SUPPRESS, action='store_true', default=False) return parser
def _get_parser(): """ Parses command line inputs for tedana Returns ------- parser.parse_args() : argparse dict """ from ..info import __version__ verstr = 'tedana v{}'.format(__version__) parser = argparse.ArgumentParser() # Argument parser follow templtate provided by RalphyZ # https://stackoverflow.com/a/43456577 optional = parser._action_groups.pop() required = parser.add_argument_group('required arguments') required.add_argument('-d', dest='data', nargs='+', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Multi-echo dataset for analysis. May be a ' 'single file with spatially concatenated data ' 'or a set of echo-specific files, in the same ' 'order as the TEs are listed in the -e ' 'argument.'), required=True) required.add_argument('-e', dest='tes', nargs='+', metavar='TE', type=float, help='Echo times (in ms). E.g., 15.0 39.0 63.0', required=True) optional.add_argument('--out-dir', dest='out_dir', type=str, metavar='PATH', help='Output directory.', default='.') optional.add_argument('--mask', dest='mask', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=("Binary mask of voxels to include in TE " "Dependent ANAlysis. Must be in the same " "space as `data`. If an explicit mask is not " "provided, then Nilearn's compute_epi_mask " "function will be used to derive a mask " "from the first echo's data."), default=None) optional.add_argument('--fittype', dest='fittype', action='store', choices=['loglin', 'curvefit'], help=('Desired T2*/S0 fitting method. ' '"loglin" means that a linear model is fit ' 'to the log of the data. ' '"curvefit" means that a more computationally ' 'demanding monoexponential model is fit ' 'to the raw data. ' 'Default is "loglin".'), default='loglin') optional.add_argument('--combmode', dest='combmode', action='store', choices=['t2s'], help=('Combination scheme for TEs: ' 't2s (Posse 1999, default)'), default='t2s') optional.add_argument( '--tedpca', dest='tedpca', help=('Method with which to select components in TEDPCA. ' 'PCA decomposition with the mdl, kic and aic options ' 'is based on a Moving Average (stationary Gaussian) ' 'process and are ordered from most to least aggresive. ' 'Default=\'mdl\'.'), choices=['kundu', 'kundu-stabilize', 'mdl', 'aic', 'kic'], default='mdl') optional.add_argument('--seed', dest='fixed_seed', metavar='INT', type=int, help=('Value used for random initialization of ICA ' 'algorithm. Set to an integer value for ' 'reproducible ICA results. Set to -1 for ' 'varying results across ICA calls. ' 'Default=42.'), default=42) optional.add_argument('--maxit', dest='maxit', metavar='INT', type=int, help=('Maximum number of iterations for ICA.'), default=500) optional.add_argument('--maxrestart', dest='maxrestart', metavar='INT', type=int, help=('Maximum number of attempts for ICA. If ICA ' 'fails to converge, the fixed seed will be ' 'updated and ICA will be run again. If ' 'convergence is achieved before maxrestart ' 'attempts, ICA will finish early.'), default=10) optional.add_argument('--tedort', dest='tedort', action='store_true', help=('Orthogonalize rejected components w.r.t. ' 'accepted components prior to denoising.'), default=False) optional.add_argument('--gscontrol', dest='gscontrol', required=False, action='store', nargs='+', help=('Perform additional denoising to remove ' 'spatially diffuse noise. Default is None. ' 'This argument can be single value or a space ' 'delimited list'), choices=['t1c', 'gsr'], default=None) optional.add_argument( '--no-png', dest='no_png', action='store_true', help=('Creates a figures folder with static component ' 'maps, timecourse plots and other diagnostic ' 'images'), default=False) optional.add_argument('--png-cmap', dest='png_cmap', type=str, help='Colormap for figures', default='coolwarm') optional.add_argument('--verbose', dest='verbose', action='store_true', help='Generate intermediate and additional files.', default=False) optional.add_argument('--lowmem', dest='low_mem', action='store_true', help=('Enables low-memory processing, including the ' 'use of IncrementalPCA. May increase workflow ' 'duration.'), default=False) optional.add_argument('--debug', dest='debug', action='store_true', help=('Logs in the terminal will have increased ' 'verbosity, and will also be written into ' 'a .tsv file in the output directory.'), default=False) optional.add_argument('--quiet', dest='quiet', help=argparse.SUPPRESS, action='store_true', default=False) optional.add_argument('-v', '--version', action='version', version=verstr) parser._action_groups.append(optional) rerungrp = parser.add_argument_group( 'arguments for rerunning the workflow') rerungrp.add_argument('--t2smap', dest='t2smap', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Precalculated T2* map in the same space as ' 'the input data.'), default=None) rerungrp.add_argument('--mix', dest='mixm', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('File containing mixing matrix. If not ' 'provided, ME-PCA & ME-ICA is done.'), default=None) rerungrp.add_argument('--ctab', dest='ctab', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('File containing a component table from which ' 'to extract pre-computed classifications.'), default=None) rerungrp.add_argument('--manacc', dest='manacc', help=('Comma separated list of manually ' 'accepted components'), default=None) return parser
def _get_parser(): """ Parses command line inputs for tedana Returns ------- parser.parse_args() : argparse dict """ parser = argparse.ArgumentParser() # Argument parser follow templtate provided by RalphyZ # https://stackoverflow.com/a/43456577 optional = parser._action_groups.pop() required = parser.add_argument_group('required arguments') required.add_argument('-d', dest='data', nargs='+', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Multi-echo dataset for analysis. May be a ' 'single file with spatially concatenated data ' 'or a set of echo-specific files, in the same ' 'order as the TEs are listed in the -e ' 'argument.'), required=True) required.add_argument('-e', dest='tes', nargs='+', metavar='TE', type=float, help='Echo times (in ms). E.g., 15.0 39.0 63.0', required=True) optional.add_argument('--mask', dest='mask', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Binary mask of voxels to include in TE ' 'Dependent ANAlysis. Must be in the same ' 'space as `data`.'), default=None) optional.add_argument('--mix', dest='mixm', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('File containing mixing matrix. If not ' 'provided, ME-PCA & ME-ICA is done.'), default=None) optional.add_argument('--ctab', dest='ctab', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('File containing a component table from which ' 'to extract pre-computed classifications.'), default=None) optional.add_argument('--manacc', dest='manacc', help=('Comma separated list of manually ' 'accepted components'), default=None) optional.add_argument('--sourceTEs', dest='ste', type=str, help=('Source TEs for models. E.g., 0 for all, ' '-1 for opt. com., and 1,2 for just TEs 1 and ' '2. Default=-1.'), default=-1) optional.add_argument('--combmode', dest='combmode', action='store', choices=['t2s', 'ste'], help=('Combination scheme for TEs: ' 't2s (Posse 1999, default), ste (Poser)'), default='t2s') optional.add_argument('--verbose', dest='verbose', action='store_true', help='Generate intermediate and additional files.', default=False) optional.add_argument('--tedort', dest='tedort', action='store_true', help=('Orthogonalize rejected components w.r.t. ' 'accepted components prior to denoising.'), default=False) optional.add_argument('--gscontrol', dest='gscontrol', required=False, action='store', nargs='+', help=('Perform additional denoising to remove ' 'spatially diffuse noise. Default is None. ' 'This argument can be single value or a space ' 'delimited list'), choices=['t1c', 'gsr'], default=None) optional.add_argument('--wvpca', dest='wvpca', help='Perform PCA on wavelet-transformed data', action='store_true', default=False) optional.add_argument( '--tedpca', dest='tedpca', help='Method with which to select components in TEDPCA', choices=['mle', 'kundu', 'kundu-stabilize'], default='mle') optional.add_argument('--out-dir', dest='out_dir', type=str, help='Output directory.', default='.') optional.add_argument( '--seed', dest='fixed_seed', type=int, help=('Value passed to repr(mdp.numx_rand.seed()) ' 'Set to an integer value for reproducible ICA results; ' 'otherwise, set to -1 for varying results across calls.'), default=42) optional.add_argument('--debug', dest='debug', help=argparse.SUPPRESS, action='store_true', default=False) optional.add_argument('--quiet', dest='quiet', help=argparse.SUPPRESS, action='store_true', default=False) parser._action_groups.append(optional) return parser
def _get_parser(): """ Parses command line inputs for tedana Returns ------- parser.parse_args() : argparse dict """ from ..info import __version__ verstr = "tedana v{}".format(__version__) parser = argparse.ArgumentParser() # Argument parser follow templtate provided by RalphyZ # https://stackoverflow.com/a/43456577 optional = parser._action_groups.pop() required = parser.add_argument_group("Required Arguments") required.add_argument( "-d", dest="data", nargs="+", metavar="FILE", type=lambda x: is_valid_file(parser, x), help=( "Multi-echo dataset for analysis. May be a " "single file with spatially concatenated data " "or a set of echo-specific files, in the same " "order as the TEs are listed in the -e " "argument." ), required=True, ) required.add_argument( "-e", dest="tes", nargs="+", metavar="TE", type=float, help="Echo times (in ms). E.g., 15.0 39.0 63.0", required=True, ) optional.add_argument( "--out-dir", dest="out_dir", type=str, metavar="PATH", help="Output directory.", default=".", ) optional.add_argument( "--mask", dest="mask", metavar="FILE", type=lambda x: is_valid_file(parser, x), help=( "Binary mask of voxels to include in TE " "Dependent ANAlysis. Must be in the same " "space as `data`. If an explicit mask is not " "provided, then Nilearn's compute_epi_mask " "function will be used to derive a mask " "from the first echo's data." ), default=None, ) optional.add_argument( "--prefix", dest="prefix", type=str, help="Prefix for filenames generated.", default="" ) optional.add_argument( "--convention", dest="convention", action="store", choices=["orig", "bids"], help=("Filenaming convention. bids will use the latest BIDS derivatives version."), default="bids", ) optional.add_argument( "--fittype", dest="fittype", action="store", choices=["loglin", "curvefit"], help=( "Desired T2*/S0 fitting method. " '"loglin" means that a linear model is fit ' "to the log of the data. " '"curvefit" means that a more computationally ' "demanding monoexponential model is fit " "to the raw data. " 'Default is "loglin".' ), default="loglin", ) optional.add_argument( "--combmode", dest="combmode", action="store", choices=["t2s"], help=("Combination scheme for TEs: t2s (Posse 1999, default)"), default="t2s", ) optional.add_argument( "--tedpca", dest="tedpca", type=check_tedpca_value, help=( "Method with which to select components in TEDPCA. " "PCA decomposition with the mdl, kic and aic options " "is based on a Moving Average (stationary Gaussian) " "process and are ordered from most to least aggressive. " "Users may also provide a float from 0 to 1, " "in which case components will be selected based on the " "cumulative variance explained. " "Default='mdl'." ), default="mdl", ) optional.add_argument( "--seed", dest="fixed_seed", metavar="INT", type=int, help=( "Value used for random initialization of ICA " "algorithm. Set to an integer value for " "reproducible ICA results. Set to -1 for " "varying results across ICA calls. " "Default=42." ), default=42, ) optional.add_argument( "--maxit", dest="maxit", metavar="INT", type=int, help=("Maximum number of iterations for ICA."), default=500, ) optional.add_argument( "--maxrestart", dest="maxrestart", metavar="INT", type=int, help=( "Maximum number of attempts for ICA. If ICA " "fails to converge, the fixed seed will be " "updated and ICA will be run again. If " "convergence is achieved before maxrestart " "attempts, ICA will finish early." ), default=10, ) optional.add_argument( "--tedort", dest="tedort", action="store_true", help=("Orthogonalize rejected components w.r.t. accepted components prior to denoising."), default=False, ) optional.add_argument( "--gscontrol", dest="gscontrol", required=False, action="store", nargs="+", help=( "Perform additional denoising to remove " "spatially diffuse noise. Default is None. " "This argument can be single value or a space " "delimited list" ), choices=["mir", "gsr"], default=None, ) optional.add_argument( "--no-reports", dest="no_reports", action="store_true", help=( "Creates a figures folder with static component " "maps, timecourse plots and other diagnostic " "images and displays these in an interactive " "reporting framework" ), default=False, ) optional.add_argument( "--png-cmap", dest="png_cmap", type=str, help="Colormap for figures", default="coolwarm" ) optional.add_argument( "--verbose", dest="verbose", action="store_true", help="Generate intermediate and additional files.", default=False, ) optional.add_argument( "--lowmem", dest="low_mem", action="store_true", help=( "Enables low-memory processing, including the " "use of IncrementalPCA. May increase workflow " "duration." ), default=False, ) optional.add_argument( "--n-threads", dest="n_threads", type=int, action="store", help=( "Number of threads to use. Used by " "threadpoolctl to set the parameter outside " "of the workflow function. Higher numbers of " "threads tend to slow down performance on " "typical datasets. Default is 1." ), default=1, ) optional.add_argument( "--debug", dest="debug", action="store_true", help=( "Logs in the terminal will have increased " "verbosity, and will also be written into " "a .tsv file in the output directory." ), default=False, ) optional.add_argument( "--quiet", dest="quiet", help=argparse.SUPPRESS, action="store_true", default=False ) optional.add_argument("-v", "--version", action="version", version=verstr) parser._action_groups.append(optional) rerungrp = parser.add_argument_group("Arguments for Rerunning the Workflow") rerungrp.add_argument( "--t2smap", dest="t2smap", metavar="FILE", type=lambda x: is_valid_file(parser, x), help=("Precalculated T2* map in the same space as the input data."), default=None, ) rerungrp.add_argument( "--mix", dest="mixm", metavar="FILE", type=lambda x: is_valid_file(parser, x), help=("File containing mixing matrix. If not provided, ME-PCA & ME-ICA is done."), default=None, ) rerungrp.add_argument( "--ctab", dest="ctab", metavar="FILE", type=lambda x: is_valid_file(parser, x), help=( "File containing a component table from which " "to extract pre-computed classifications. " "Requires --mix." ), default=None, ) rerungrp.add_argument( "--manacc", dest="manacc", metavar="INT", type=int, nargs="+", help=("List of manually accepted components. Requires --ctab and --mix."), default=None, ) return parser
def _get_parser(): """ Parses command line inputs for tedana Returns ------- parser.parse_args() : argparse dict """ parser = argparse.ArgumentParser() # Argument parser follow templtate provided by RalphyZ # https://stackoverflow.com/a/43456577 optional = parser._action_groups.pop() required = parser.add_argument_group('required arguments') required.add_argument('-d', dest='data', nargs='+', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Multi-echo dataset for analysis. May be a ' 'single file with spatially concatenated data ' 'or a set of echo-specific files, in the same ' 'order as the TEs are listed in the -e ' 'argument.'), required=True) required.add_argument('-e', dest='tes', nargs='+', metavar='TE', type=float, help='Echo times (in ms). E.g., 15.0 39.0 63.0', required=True) optional.add_argument('--mask', dest='mask', metavar='FILE', type=lambda x: is_valid_file(parser, x), help=('Binary mask of voxels to include in TE ' 'Dependent ANAlysis. Must be in the same ' 'space as `data`.'), default=None) optional.add_argument( '--fitmode', dest='fitmode', action='store', choices=['all', 'ts'], help=('Monoexponential model fitting scheme. ' '"all" means that the model is fit, per voxel, ' 'across all timepoints. ' '"ts" means that the model is fit, per voxel ' 'and per timepoint.'), default='all') optional.add_argument('--combmode', dest='combmode', action='store', choices=['t2s', 'paid'], help=('Combination scheme for TEs: ' 't2s (Posse 1999, default), paid (Poser)'), default='t2s') optional.add_argument('--label', dest='label', type=str, help='Label for output directory.', default=None) optional.add_argument('--debug', dest='debug', help=argparse.SUPPRESS, action='store_true', default=False) optional.add_argument('--quiet', dest='quiet', help=argparse.SUPPRESS, action='store_true', default=False) parser._action_groups.append(optional) return parser