How to use the mriqc.MRIQC_LOG.info function in mriqc

To help you get started, we’ve selected a few mriqc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github poldracklab / mriqc / mriqc / utils / mriqc_run.py View on Github external
from yaml import load as loadyml
        with open(opts.use_plugin) as pfile:
            plugin_settings = loadyml(pfile)
    else:
        # Setup multiprocessing
        if settings['n_procs'] == 0:
            settings['n_procs'] = 1
            max_parallel_ants = cpu_count() // settings['ants_nthreads']
            if max_parallel_ants > 1:
                settings['n_procs'] = max_parallel_ants

        if settings['n_procs'] > 1:
            plugin_settings['plugin'] = 'MultiProc'
            plugin_settings['plugin_args'] = {'n_procs': settings['n_procs']}

    MRIQC_LOG.info(
        'Running MRIQC-%s (analysis_level=%s, participant_label=%s)\n\tSettings=%s',
        __version__, opts.analysis_level, opts.participant_label, settings)

    # Set up participant level
    if opts.analysis_level == 'participant':
        for qctype in opts.data_type:
            ms_func = getattr(mwc, 'ms_' + qctype)
            workflow = ms_func(subject_id=opts.participant_label, session_id=opts.session_id,
                               run_id=opts.run_id, settings=settings)
            if workflow is None:
                MRIQC_LOG.warn(
                    '%s QC workflow - no scans were found for the given inputs',
                    'Anatomical' if qctype[:4] == 'anat' else 'Functional')
                continue

            workflow.base_dir = settings['work_dir']
github poldracklab / mriqc / mriqc / utils / mriqc_run.py View on Github external
qcjson = op.join(derivatives_dir, '{}*.json'.format(qctype[:4]))

            # If there are no iqm.json files, nothing to do.
            if not qcjson:
                MRIQC_LOG.warn(
                    'Generating group-level report for the "%s" data type - '
                    'no IQM-JSON files were found in "%s"', qctype, derivatives_dir)
                continue

            # If some were found, generate the CSV file and group report
            out_csv = op.join(settings['output_dir'], qctype[:4] + 'MRIQC.csv')
            out_html = op.join(reports_dir, qctype[:4] + '_group.html')
            generate_csv(glob(qcjson), out_csv)
            MRIQC_LOG.info('Summary CSV table has been written to %s', out_csv)
            group_html(out_csv, qctype, out_file=out_html)
            MRIQC_LOG.info('Group HTML report has been written to %s', out_html)
github poldracklab / mriqc / mriqc / bin / mriqc_run.py View on Github external
if settings['ants_nthreads'] == 0:
            if settings['n_procs'] > 1:
                # always leave one extra thread for non ANTs work,
                # don't use more than 8 threads - the speed up is minimal
                settings['ants_nthreads'] = min(settings['n_procs'] - 1, 8)
            else:
                settings['ants_nthreads'] = 1

        if settings['n_procs'] > 1:
            plugin_settings['plugin'] = 'MultiProc'
            plugin_settings['plugin_args'] = {'n_procs': settings['n_procs']}
            if opts.mem_gb:
                plugin_settings['plugin_args']['memory_gb'] = opts.mem_gb

    MRIQC_LOG.info(
        'Running MRIQC-%s (analysis_levels=[%s], participant_label=%s)\n\tSettings=%s',
        __version__, ', '.join(analysis_levels), opts.participant_label, settings)

    # Process data types
    modalities = opts.modalities

    dataset = collect_bids_data(settings['bids_dir'],
                                participant_label=opts.participant_label)

    # Set up participant level
    if 'participant' in analysis_levels:
        workflow = Workflow(name='workflow_enumerator')
        workflow.base_dir = settings['work_dir']

        wf_list = []
        for mod in modalities:
github poldracklab / mriqc / mriqc / utils / mriqc_run.py View on Github external
derivatives_dir = op.join(settings['output_dir'], 'derivatives')
        for qctype in opts.data_type:
            qcjson = op.join(derivatives_dir, '{}*.json'.format(qctype[:4]))

            # If there are no iqm.json files, nothing to do.
            if not qcjson:
                MRIQC_LOG.warn(
                    'Generating group-level report for the "%s" data type - '
                    'no IQM-JSON files were found in "%s"', qctype, derivatives_dir)
                continue

            # If some were found, generate the CSV file and group report
            out_csv = op.join(settings['output_dir'], qctype[:4] + 'MRIQC.csv')
            out_html = op.join(reports_dir, qctype[:4] + '_group.html')
            generate_csv(glob(qcjson), out_csv)
            MRIQC_LOG.info('Summary CSV table has been written to %s', out_csv)
            group_html(out_csv, qctype, out_file=out_html)
            MRIQC_LOG.info('Group HTML report has been written to %s', out_html)
github poldracklab / mriqc / mriqc / bin / mriqc_run.py View on Github external
'No IQM-JSON files were found for the %s data type in %s. The group-level '
                    'report was not generated.', mod, derivatives_dir)
                continue

            MRIQC_LOG.info('Summary CSV table for the %s data generated (%s)', mod, out_csv)

            # out_pred = generate_pred(derivatives_dir, settings['output_dir'], mod)
            # if out_pred is not None:
            #     MRIQC_LOG.info('Predicted QA CSV table for the %s data generated (%s)',
            #                    mod, out_pred)

            out_html = op.join(reports_dir, mod + '_group.html')
            group_html(out_csv, mod,
                       csv_failed=op.join(settings['output_dir'], 'failed_' + mod + '.csv'),
                       out_file=out_html)
            MRIQC_LOG.info('Group-%s report generated (%s)', mod, out_html)
            n_group_reports += 1

        if n_group_reports == 0:
            raise Exception("No data found. No group level reports were generated.")
github poldracklab / mriqc / mriqc / bin / mriqc_run.py View on Github external
reports_dir = check_folder(op.join(settings['output_dir'], 'reports'))
        derivatives_dir = op.join(settings['output_dir'], 'derivatives')

        n_group_reports = 0
        for mod in modalities:
            dataframe, out_csv = generate_csv(derivatives_dir,
                                              settings['output_dir'], mod)

            # If there are no iqm.json files, nothing to do.
            if dataframe is None:
                MRIQC_LOG.warn(
                    'No IQM-JSON files were found for the %s data type in %s. The group-level '
                    'report was not generated.', mod, derivatives_dir)
                continue

            MRIQC_LOG.info('Summary CSV table for the %s data generated (%s)', mod, out_csv)

            # out_pred = generate_pred(derivatives_dir, settings['output_dir'], mod)
            # if out_pred is not None:
            #     MRIQC_LOG.info('Predicted QA CSV table for the %s data generated (%s)',
            #                    mod, out_pred)

            out_html = op.join(reports_dir, mod + '_group.html')
            group_html(out_csv, mod,
                       csv_failed=op.join(settings['output_dir'], 'failed_' + mod + '.csv'),
                       out_file=out_html)
            MRIQC_LOG.info('Group-%s report generated (%s)', mod, out_html)
            n_group_reports += 1

        if n_group_reports == 0:
            raise Exception("No data found. No group level reports were generated.")