Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
user_args = parser.parse_args()
except:
parser.exit(1)
vis_type = 'collage_t1_mri'
type_of_features = 't1_mri'
in_dir, in_dir_type = check_input_dir_T1w(user_args.fs_dir, user_args.user_dir, user_args.bids_dir)
mri_name = user_args.mri_name
id_list = check_id_list_T1w(in_dir, in_dir_type, user_args.id_list, mri_name, vis_type)
out_dir = check_out_dir(user_args.out_dir, in_dir)
views = check_views(user_args.views)
num_slices_per_view, num_rows_per_view = check_finite_int(user_args.num_slices,
user_args.num_rows)
outlier_method, outlier_fraction, \
outlier_feat_types, disable_outlier_detection = check_outlier_params(
user_args.outlier_method,
user_args.outlier_fraction,
user_args.outlier_feat_types,
user_args.disable_outlier_detection,
id_list, vis_type, type_of_features)
wf = RatingWorkflowT1(id_list, in_dir, out_dir,
cfg.t1_mri_default_issue_list,
mri_name, in_dir_type,
outlier_method, outlier_fraction,
outlier_feat_types, disable_outlier_detection,
user_args.prepare_first,
parser.exit(1)
vis_type, label_set, label_map = check_labels(user_args.vis_type, user_args.label_set)
in_dir, source_of_features = check_input_dir(user_args.fs_dir, None, vis_type,
freesurfer_install_required=False)
mri_name = user_args.mri_name
seg_name = user_args.seg_name
id_list, images_for_id = check_id_list(user_args.id_list, in_dir, vis_type, mri_name,
seg_name)
out_dir = check_out_dir(user_args.out_dir, in_dir)
alpha_set = check_alpha_set(user_args.alpha_set)
views = check_views(user_args.views)
num_slices, num_rows = check_finite_int(user_args.num_slices, user_args.num_rows)
contour_color = user_args.contour_color
if not is_color_like(contour_color):
raise ValueError('Specified color is not valid. Choose a valid spec from\n'
' https://matplotlib.org/users/colors.html')
outlier_method, outlier_fraction, outlier_feat_types, disable_outlier_detection = \
check_outlier_params(user_args.outlier_method, user_args.outlier_fraction,
user_args.outlier_feat_types,
user_args.disable_outlier_detection,
id_list, vis_type, source_of_features)
wf = FreesurferRatingWorkflow(id_list,
images_for_id,
in_dir,
out_dir,
parser.exit(1)
vis_type = cfg.alignment_default_vis_type
type_of_features = 'alignment'
in_dir, in_dir_type = check_input_dir_quantitative_MR(user_args.in_dir)
image_names = user_args.image_names
id_list, images_for_id = check_id_list_quantitative(user_args.id_list, in_dir,
image_names,
in_dir_type=in_dir_type)
delay_in_animation = check_time(user_args.delay_in_animation, var_name='Delay')
out_dir = check_out_dir(user_args.out_dir, in_dir)
views = check_views(user_args.views)
num_slices_per_view, num_rows_per_view = check_finite_int(user_args.num_slices,
user_args.num_rows)
wf = QuantitativeMrRatingWorkflow(id_list,
in_dir,
image_names,
out_dir=out_dir,
in_dir_type=in_dir_type,
prepare_first=user_args.prepare_first,
delay_in_animation=delay_in_animation,
views=views,
num_slices_per_view=num_slices_per_view,
num_rows_per_view=num_rows_per_view)
return wf
id_list = None
name_pattern = None
images_for_id = None
elif user_args.bids_dir is None and user_args.user_dir is not None:
name_pattern = user_args.name_pattern
in_dir = realpath(user_args.user_dir)
in_dir_type = 'generic'
id_list, images_for_id = check_id_list_with_regex(user_args.id_list, in_dir, name_pattern)
else:
raise ValueError('Invalid args: specify only one of bids_dir or user_dir, not both.')
out_dir = check_out_dir(user_args.out_dir, in_dir)
no_preproc = user_args.no_preproc
views = check_views(user_args.views)
num_slices_per_view, num_rows_per_view = check_finite_int(user_args.num_slices,
user_args.num_rows)
outlier_method, outlier_fraction, \
outlier_feat_types, disable_outlier_detection = check_outlier_params(
user_args.outlier_method, user_args.outlier_fraction,
user_args.outlier_feat_types, user_args.disable_outlier_detection,
id_list, vis_type, type_of_features)
wf = FmriRatingWorkflow(in_dir, out_dir,
id_list=id_list,
images_for_id=images_for_id,
issue_list=cfg.func_mri_default_issue_list,
name_pattern=name_pattern, in_dir_type=in_dir_type,
no_preproc=no_preproc,
outlier_method=outlier_method, outlier_fraction=outlier_fraction,
outlier_feat_types=outlier_feat_types,
vis_type, label_set = check_labels(user_args.vis_type, user_args.labels)
in_dir = check_input_dir(user_args.fs_dir, user_args.user_dir, vis_type)
mri_name = user_args.mri_name
seg_name = user_args.seg_name
id_list, images_for_id = check_id_list(user_args.id_list, in_dir, vis_type, mri_name, seg_name)
out_dir = check_out_dir(user_args.out_dir, in_dir)
alpha_set = check_alpha_set(user_args.alpha_set)
views = check_views(user_args.views)
num_slices, num_rows = check_finite_int(user_args.num_slices, user_args.num_rows)
contour_color = user_args.contour_color
if not is_color_like(contour_color):
raise ValueError(
'Specified color is not valid. Choose a valid spec from\n https://matplotlib.org/users/colors.html')
outlier_method, outlier_fraction, outlier_feat_types, no_outlier_detection = check_outlier_params(user_args.outlier_method,
user_args.outlier_fraction,
user_args.outlier_feat_types,
user_args.disable_outlier_detection,
id_list)
qcw = QCWorkflow(in_dir, id_list, images_for_id, out_dir,
user_args.prepare_first,
vis_type, label_set, alpha_set,
outlier_method, outlier_fraction, outlier_feat_types, no_outlier_detection,
id_list = None
name_pattern = None
images_for_id = None
# elif user_args.bids_dir is None and user_args.user_dir is not None:
# name_pattern = user_args.name_pattern
# in_dir = realpath(user_args.user_dir)
# in_dir_type = 'generic'
# id_list, images_for_id = check_id_list_with_regex(user_args.id_list, in_dir, name_pattern)
out_dir = check_out_dir(user_args.out_dir, in_dir)
apply_preproc = user_args.apply_preproc
delay_in_animation = check_time(user_args.delay_in_animation, var_name='Delay')
views = check_views(user_args.views)
num_slices_per_view, num_rows_per_view = check_finite_int(user_args.num_slices,
user_args.num_rows)
outlier_method, outlier_fraction, \
outlier_feat_types, disable_outlier_detection = check_outlier_params(
user_args.outlier_method, user_args.outlier_fraction,
user_args.outlier_feat_types, user_args.disable_outlier_detection,
id_list, vis_type, type_of_features)
wf = DiffusionRatingWorkflow(in_dir, out_dir,
id_list=id_list,
images_for_id=images_for_id,
issue_list=cfg.diffusion_mri_default_issue_list,
name_pattern=name_pattern, in_dir_type=in_dir_type,
apply_preproc=apply_preproc,
delay_in_animation=delay_in_animation,
outlier_method=outlier_method,