Example #1
0
def _big_plot(in_func,
              in_mask,
              in_segm,
              in_spikes,
              in_spikes_bg,
              fd,
              dvars,
              outliers,
              out_file=None):
    import os.path as op
    import numpy as np
    from mriqc.viz.fmriplots import fMRIPlot
    if out_file is None:
        fname, ext = op.splitext(op.basename(in_func))
        if ext == '.gz':
            fname, _ = op.splitext(fname)
        out_file = op.abspath('{}_fmriplot.svg'.format(fname))

    title = 'fMRI Summary plot'

    myplot = fMRIPlot(in_func, in_mask, in_segm, title=title)
    # myplot.add_spikes(np.loadtxt(in_spikes), title='Axial slice homogeneity (brain mask)')
    myplot.add_spikes(np.loadtxt(in_spikes_bg), zscored=False)

    # Add AFNI ouliers plot
    myplot.add_confounds([np.nan] + np.loadtxt(outliers, usecols=[0]).tolist(),
                         {
                             'name': 'ouliers',
                             'units': '%',
                             'normalize': False,
                             'ylims': (0.0, None)
                         })

    # Pick non-standardize dvars
    myplot.add_confounds([np.nan] +
                         np.loadtxt(dvars, skiprows=1, usecols=[1]).tolist(), {
                             'name': 'DVARS',
                             'units': None,
                             'normalize': False
                         })

    # Add FD
    myplot.add_confounds(
        [np.nan] + np.loadtxt(fd, skiprows=1, usecols=[0]).tolist(), {
            'name': 'FD',
            'units': 'mm',
            'normalize': False,
            'cutoff': [0.2],
            'ylims': (0.0, 0.2)
        })
    myplot.plot()
    myplot.fig.savefig(out_file, bbox_inches='tight')
    myplot.fig.clf()
    return out_file
Example #2
0
def _big_plot(in_func, in_mask, in_segm, in_spikes, in_spikes_bg, fd, dvars, out_file=None):
    import os.path as op
    import numpy as np
    from mriqc.viz.fmriplots import fMRIPlot

    if out_file is None:
        fname, ext = op.splitext(op.basename(in_func))
        if ext == ".gz":
            fname, _ = op.splitext(fname)
        out_file = op.abspath("{}_fmriplot.pdf".format(fname))

    myplot = fMRIPlot(in_func, in_mask, in_segm)
    # myplot.add_spikes(np.loadtxt(in_spikes), title='Axial slice homogeneity (brain mask)')
    myplot.add_spikes(np.loadtxt(in_spikes_bg), zscored=False)
    myplot.add_confounds([np.nan] + np.loadtxt(fd).tolist(), {"name": "FD", "units": "mm"})
    myplot.add_confounds([np.nan] + np.loadtxt(dvars).tolist(), {"name": "DVARS", "units": None, "normalize": False})
    myplot.plot()
    myplot.fig.savefig(out_file, dpi=300, bbox_inches="tight")
    myplot.fig.clf()
    return out_file
Example #3
0
def _big_plot(in_func, in_mask, in_segm, in_spikes_bg,
              fd, fd_thres, dvars, outliers, out_file=None):
    import os.path as op
    import numpy as np
    from mriqc.viz.fmriplots import fMRIPlot
    if out_file is None:
        fname, ext = op.splitext(op.basename(in_func))
        if ext == '.gz':
            fname, _ = op.splitext(fname)
        out_file = op.abspath('{}_fmriplot.svg'.format(fname))

    title = 'fMRI Summary plot'

    myplot = fMRIPlot(
        in_func, in_mask, in_segm, title=title)
    myplot.add_spikes(np.loadtxt(in_spikes_bg), zscored=False)

    # Add AFNI ouliers plot
    myplot.add_confounds([np.nan] + np.loadtxt(outliers, usecols=[0]).tolist(),
                         {'name': 'ouliers', 'units': '%', 'normalize': False,
                          'ylims': (0.0, None)})

    # Pick non-standardize dvars
    myplot.add_confounds([np.nan] + np.loadtxt(dvars, skiprows=1,
                                               usecols=[1]).tolist(),
                         {'name': 'DVARS', 'units': None, 'normalize': False})

    # Add FD
    myplot.add_confounds([np.nan] + np.loadtxt(fd, skiprows=1,
                                               usecols=[0]).tolist(),
                         {'name': 'FD', 'units': 'mm', 'normalize': False,
                          'cutoff': [fd_thres], 'ylims': (0.0, fd_thres)})
    myplot.plot()
    myplot.fig.savefig(out_file, bbox_inches='tight')
    myplot.fig.clf()
    return out_file