Example #1
0
    nargs=1)

options.add_argument('-num_tracks',
                     type=int,
                     default='20000000',
                     help='define the number of streamlines to be computed '
                     'when performing tractography on the FOD template. '
                     '(group3 analysis level only)')
options.add_argument('-num_tracks_sift',
                     type=int,
                     default='2000000',
                     help='define the number of streamlines to '
                     'remain after performing SIFT on the tractogram'
                     '(group3 analysis level only)')

app.parse()

if app.isWindows():
    app.error('Script cannot be run on Windows due to FSL dependency')

subjects_to_analyze = []
# only for a subset of subjects
if app.args.participant_label:
    subjects_to_analyze = app.args.participant_label
# for all subjects
else:
    subject_dirs = glob.glob(os.path.join(app.args.in_dir, 'sub-*'))
    subjects_to_analyze = [
        subject_dir.split("-")[-1] for subject_dir in subject_dirs
    ]
options.add_argument('-WMTIparams', action='store_true', help='Include DKI parameters in output folder (awf,ias_params,eas_params)')
options.add_argument('-akc', action='store_true', help='brute force K tensor outlier rejection')
options.add_argument('-kcumulants', action='store_true',help='output the kurtosis tensor with W cumulant rather than K')
options.add_argument('-mask', action='store_true',help='compute a brain mask prior to tensor fitting to stip skull and improve efficientcy')
options.add_argument('-datatype', metavar=('<spec>'), help='If using the "-processing_only" option, you can specify the output datatype. Valid options are float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit')
options.add_argument('-fit_constraints',help='constrain the wlls fit (default 0,1,0)')
options.add_argument('-outliers',action='store_true',help='Perform IRWLLS outlier detection')
options.add_argument('-fslbvec',metavar=('<bvecs>'),help='specify bvec path if path is different from the path to the dwi or the file has an unusual extention')
options.add_argument('-fslbval',metavar=('<bvals>'),help='specify bval path if path is different from the path to the dwi or the file has an unusual extention')
rpe_options = app.cmdline.add_argument_group('Options for specifying the acquisition phase-encoding design')
rpe_options.add_argument('-rpe_none', action='store_true', help='Specify that no reversed phase-encoding image data is being provided; eddy will perform eddy current and motion correction only')
rpe_options.add_argument('-rpe_pair', metavar=('<reverse PE b=0 image>'), help='Specify the reverse phase encoding image')
rpe_options.add_argument('-rpe_all', metavar=('<reverse PE dwi volume>'), help='Specify that ALL DWIs have been acquired with opposing phase-encoding; this information will be used to perform a recombination of image volumes (each pair of volumes with the same b-vector but different phase encoding directions will be combined together into a single volume). The argument to this option is the set of volumes with reverse phase encoding but the same b-vectors as the input image')
rpe_options.add_argument('-rpe_header', action='store_true', help='Specify that the phase-encoding information can be found in the image header(s), and that this is the information that the script should use')
rpe_options.add_argument('-pe_dir', metavar=('<phase encoding direction>'), help='Specify the phase encoding direction of the input series (required if using the eddy option). Can be a signed axis number (e.g. -0, 1, +2), an axis designator (e.g. RL, PA, IS), or NIfTI axis codes (e.g. i-, j, k)')
app.parse()

def splitext_(path):
    for ext in ['.tar.gz', '.tar.bz2','.nii.gz']:
        if path.endswith(ext):
            return path[:-len(ext)], path[-len(ext):]
    return os.path.splitext(path)

designer_root = os.path.dirname(os.path.realpath(__file__))
DKI_root = os.path.abspath(os.path.join(designer_root,'..'))

app.makeTempDir()

fsl_suffix = fsl.suffix()

UserCpath = app.args.input.rsplit(',')