Exemple #1
0
def main():
    parser = ArgumentParser(description=DESCRIP,
                            epilog=EPILOG,
                            formatter_class=RawDescriptionHelpFormatter)
    parser.add_argument('filename', type=str,
                        help='4D image filename')
    parser.add_argument('--out-path', type=str,
                        help='path for output image files')
    parser.add_argument('--out-fname-label', type=str,
                        help='mid part of output image filenames')
    parser.add_argument('--ncomponents', type=int, default=10,
                        help='number of PCA components to write')
    # parse the command line
    args = parser.parse_args()
    # process inputs
    filename = args.filename
    out_path = args.out_path
    out_root = args.out_fname_label
    ncomps = args.ncomponents
    # collect extension for output images
    froot, ext, gz = splitext_addext(filename)
    pth, fname = os.path.split(froot)
    if out_path is None:
        out_path = pth
    if out_root is None:
        out_root = fname
    img = nipy.load_image(filename)
    res = nads.screen(img, ncomps)
    nads.write_screen_res(res, out_path, out_root, ext + gz)
def main():
    try:
        DATA_PATH = sys.argv[1]
    except IndexError:
        raise RuntimeError("Pass data path on command line")
    for name, subject in get_subjects(DATA_PATH).items():
        for run in subject['functionals']:
            fname = run['filename']
            print("Diagnosing functional " + fname)
            img = nipy.load_image(fname)
            res = screens.screen(img, slice_axis=0)
            pth, fname = os.path.split(fname)
            froot, ext = os.path.splitext(fname)
            if ext in ('.gz', '.bz2'): # discard compressed exts
                froot, ext = os.path.splitext(froot)
            screens.write_screen_res(res, pth, froot)
Exemple #3
0
def main():
    try:
        DATA_PATH = sys.argv[1]
    except IndexError:
        raise RuntimeError("Pass data path on command line")
    for name, subject in get_subjects(DATA_PATH).items():
        for run in subject['functionals']:
            fname = run['filename']
            print("Diagnosing functional " + fname)
            img = nipy.load_image(fname)
            res = screens.screen(img, slice_axis=0)
            pth, fname = os.path.split(fname)
            froot, ext = os.path.splitext(fname)
            if ext in ('.gz', '.bz2'):  # discard compressed exts
                froot, ext = os.path.splitext(froot)
            screens.write_screen_res(res, pth, froot)
Exemple #4
0
import os

import nipy
from nipy.algorithms.diagnostics import screens
from openfmri import get_subjects

for name, subject in get_subjects('ds105').items():
    for run in subject['functionals']:
        fname = run['filename']
        img = nipy.load_image(fname)
        res = screens.screen(img, slice_axis=0)
        pth, fname = os.path.split(fname)
        froot, ext = os.path.splitext(fname)
        screens.write_screen_res(res, pth, froot)
import os

import nipy
from nipy.algorithms.diagnostics import screens
from openfmri import get_visits

for name, visit in get_visits('ds105').items():
    for functional in visit['functionals']:
        filename = functional['filename']
        img = nipy.load_image(filename)
        res = screens.screen(img, slice_axis=0)
        pth, fname = os.path.split(filename)
        froot, ext = os.path.splitext(fname)
        screens.write_screen_res(res, pth, froot)