Exemplo n.º 1
0
def post_script(args):
    from src.utils import figures_utils as fu
    from src.mmvt_addon import fMRI_panel as fmri
    from src.utils import utils

    subject_fol = op.join(su.get_mmvt_dir(), args.subject)
    figures_fol = op.join(subject_fol, 'figures')
    clusters_file_names, _, _ = fmri.get_clusters_files(subject_fol)
    clusters_names = [
        f for f in clusters_file_names if args.clusters_type in f
    ]
    print('clusters_names: {}'.format(clusters_names))
    fmri_files_minmax_fname = op.join(subject_fol, 'fmri',
                                      'fmri_files_minmax_cm.pkl')
    data_min, data_max, colors_map_name = utils.load(fmri_files_minmax_fname)
    for clusters_name, inflated, background_color in product(
            clusters_names, args.inflated, args.background_color):
        print('Combing figures for {}, inflated: {}, background color: {}'.
              format(clusters_name, inflated, background_color))
        perspectives_image_fname = fu.combine_four_brain_perspectives(
            figures_fol, inflated, args.dpi, background_color, clusters_name,
            args.inflated_ratio, True, args.overwrite)
        fu.combine_brain_with_color_bar(
            data_max, data_min, perspectives_image_fname, colors_map_name,
            args.overwrite, args.dpi, args.x_left_crop, args.x_right_crop,
            args.y_top_crop, args.y_buttom_crop, args.w_fac, args.h_fac,
            background_color)
Exemplo n.º 2
0
def check_if_all_figures_were_rendered(args):
    from src.utils import figures_utils as fu
    from src.mmvt_addon import fMRI_panel as fmri

    subject_fol = op.join(su.get_mmvt_dir(), args.subject)
    figures_fol = op.join(subject_fol, 'figures')
    clusters_file_names, _ = fmri.get_clusters_files(subject_fol)
    clusters_names = [f for f in clusters_file_names if args.clusters_type in f]
    render_figures = False
    all_figures = []
    for clusters_name, inflated, background_color in product(clusters_names, args.inflated, args.background_color):
        figures_fnames = fu.get_brain_perspectives_figures(
            figures_fol, inflated, background_color, clusters_name, args.inflated_ratio)
        all_figures.extend(figures_fnames)
        if any(not op.isfile(f) for f in figures_fnames):
            render_figures = True
            break
    return render_figures
Exemplo n.º 3
0
def post_script(args):
    from src.utils import figures_utils as fu
    from src.mmvt_addon import fMRI_panel as fmri
    from src.utils import utils

    subject_fol = op.join(su.get_mmvt_dir(), args.subject)
    figures_fol = op.join(subject_fol, 'figures')
    clusters_file_names, _ = fmri.get_clusters_files(subject_fol)
    clusters_names = [f for f in clusters_file_names if args.clusters_type in f]
    print('clusters_names: {}'.format(clusters_names))
    fmri_files_minmax_fname = op.join(subject_fol, 'fmri', 'fmri_files_minmax_cm.pkl')
    data_min, data_max, colors_map_name = utils.load(fmri_files_minmax_fname)
    for clusters_name, inflated, background_color in product(clusters_names, args.inflated, args.background_color):
        print('Combing figures for {}, inflated: {}, background color: {}'.format(
            clusters_name, inflated, background_color))
        perspectives_image_fname = fu.combine_four_brain_perspectives(
            figures_fol, inflated, args.dpi, background_color,
            clusters_name, args.inflated_ratio, True, args.overwrite)
        fu.combine_brain_with_color_bar(
            data_max, data_min, perspectives_image_fname, colors_map_name, args.overwrite, args.dpi,
            args.x_left_crop, args.x_right_crop, args.y_top_crop, args.y_buttom_crop,
            args.w_fac, args.h_fac, background_color)
Exemplo n.º 4
0
def check_if_all_figures_were_rendered(args):
    from src.utils import figures_utils as fu
    from src.mmvt_addon import fMRI_panel as fmri

    subject_fol = op.join(su.get_mmvt_dir(), args.subject)
    figures_fol = op.join(subject_fol, 'figures')
    clusters_file_names, _, _ = fmri.get_clusters_files(subject_fol)
    clusters_names = [
        f for f in clusters_file_names if args.clusters_type in f
    ]
    render_figures = False
    all_figures = []
    for clusters_name, inflated, background_color in product(
            clusters_names, args.inflated, args.background_color):
        figures_fnames = fu.get_brain_perspectives_figures(
            figures_fol, inflated, background_color, clusters_name,
            args.inflated_ratio)
        all_figures.extend(figures_fnames)
        if any(not op.isfile(f) for f in figures_fnames):
            render_figures = True
            break
    return render_figures