Ejemplo n.º 1
0
    for subject in list_subjects_update:
        clean_subject(subject)
        if len(subject['session_id']) > 0:
            print(len(subject['session_id']))
        if len(subject['session_id']) > 0:
            #if protocol == 'retino':
            #    first_level(subject, compcorr=True,
            #                additional_regressors=RETINO_REG,
            #                smooth=None, surface=True)
            #else:
            first_level(subject, compcorr=True, smooth=None, surface=True)
            fixed_effects_analysis(subject, surface=True, lowres=True)


if __name__ == '__main__':
    protocols = ['preference', 'mtt1', 'mtt2', 'tom', 'self']
    protocols = ['retino']
    protocols = [
        'lyon1', 'lyon2', 'audio1', 'audio2', 'stanford1', 'stanford2',
        'stanford3'
    ]
    protocols = ['archi', 'screening', 'rsvp-language', 'hcp1', 'hcp2']
    for protocol in protocols:
        jobfile = 'ini_files/IBC_preproc_%s.ini' % protocol
        acquisition = protocol  # 'clips4' #
        lowres = False
        subject_session = sorted(get_subject_session(acquisition))
        Parallel(n_jobs=4)(delayed(run_subject_surface_glm)(
            jobfile, subject, session, protocol, lowres=lowres)
                           for (subject, session) in subject_session)
"""
import os
import nibabel as nib
import numpy as np
from ibc_public.utils_pipeline import fixed_effects_img, fixed_effects_surf
from pipeline import get_subject_session
from nilearn.plotting import plot_stat_map
from nilearn.image import math_img

# where to work and write
SMOOTH_DERIVATIVES = '/neurospin/ibc/smooth_derivatives'
DERIVATIVES = '/neurospin/ibc/derivatives'
THREE_MM = '/neurospin/ibc/3mm'

# misc info on preference protocol
subject_session = get_subject_session('preference')
categories = ['Faces', 'Food', 'Houses', 'Paintings']
categories_ = categories
contrasts = ['constant', 'linear', 'quadratic']

# mask image
_package_directory = os.path.dirname(os.path.abspath(__file__))
mask_img = os.path.join(_package_directory, '../ibc_data',
                        'gm_mask_1_5mm.nii.gz')


def compute_contrast(con_imgs, var_imgs, mask_img):
    if isinstance(mask_img, str):
        mask_img = nib.load(mask_img)

    mask = mask_img.get_fdata().astype(np.bool)
Ejemplo n.º 3
0
            print(
                os.system(
                    '$FREESURFER_HOME/bin/mri_vol2surf --src %s --o %s '
                    '--out_type gii --srcreg %s --hemi rh --projfrac-avg 0 2 0.1'
                    % (fmri_session, right_fmri_tex, regheader)))

            # resample to fsaverage
            left_fsaverage_fmri_tex = os.path.join(
                fs_dir, basename + '_fsaverage_lh.gii')
            right_fsaverage_fmri_tex = os.path.join(
                fs_dir, basename + '_fsaverage_rh.gii')

            print(
                os.system('$FREESURFER_HOME/bin/mri_surf2surf --srcsubject %s '
                          '--srcsurfval %s --trgsurfval %s --trgsubject ico '
                          '--trgicoorder 7 --hemi lh --nsmooth-out 5' %
                          (subject, left_fmri_tex, left_fsaverage_fmri_tex)))
            print(
                os.system('$FREESURFER_HOME/bin/mri_surf2surf --srcsubject %s '
                          '--srcsurfval %s --trgsubject ico --trgicoorder 7 '
                          '--trgsurfval %s --hemi rh --nsmooth-out 5' %
                          (subject, right_fmri_tex, right_fsaverage_fmri_tex)))


subject_sessions = sorted(get_subject_session('enumeration'))

Parallel(n_jobs=4)(delayed(project_volume)(
    work_dir, subject_session[0], [subject_session[1]], do_bbr=True)
                   for subject_session in subject_sessions)
Ejemplo n.º 4
0
        if len(subject['session_id']) > 0:
            if protocol == 'clips4':
                first_level(subject, compcorr=True, additional_regressors=RETINO_REG,
                            smooth=smooth, mask_img=mask_img)
            else:
                first_level(subject, compcorr=True, smooth=smooth, mask_img=mask_img)
                fixed_effects_analysis(subject, mask_img=mask_img)


if __name__ == '__main__':
    prepare_derivatives(IBC)
    
    smooth = 5
    for protocol in ['enumeration']:  # ['hcp1', 'hcp2', 'rsvp-language', 'mtt2' 'preferences', 'tom']
        jobfile = 'ini_files/IBC_preproc_%s.ini' % protocol
        subject_session = get_subject_session(protocol)
        subject_session = [('sub-01', 'ses-20'), ('sub-09', 'ses-18')]
        Parallel(n_jobs=4)(
            delayed(run_subject_glm)(jobfile, protocol, subject, session, smooth)
            for (subject, session) in subject_session)
    
    smooth = None
    for protocol in ['enumeration']:
        jobfile = 'ini_files/IBC_preproc_%s.ini' % protocol
        Parallel(n_jobs=4)(
            delayed(run_subject_glm)(jobfile, protocol, subject, session, smooth)
            for (subject, session) in subject_session)
    
    
    for protocol in ['enumeration']:  # ['lyon1', 'preferences', 'screening', 'hcp1', 'hcp2', , 'mtt2' 'preferences', 'screening', 'rsvp-language', 'clips4' 'archi', ]
        jobfile = 'ini_files/IBC_preproc_%s.ini' % protocol
Ejemplo n.º 5
0
            # resample to fsaverage5
            left_fsaverage_fmri_tex = os.path.join(
                fs_dir, basename + '_fsaverage5_lh.gii')
            right_fsaverage_fmri_tex = os.path.join(
                fs_dir, basename + '_fsaverage5_rh.gii')

            print(os.system(
                '$FREESURFER_HOME/bin/mri_surf2surf --srcsubject %s '
                '--srcsurfval %s --trgsurfval %s --trgsubject ico '
                '--trgicoorder 5 --hemi lh --nsmooth-out 5' %
                (subject, left_fmri_tex, left_fsaverage_fmri_tex)))
            print(os.system(
                '$FREESURFER_HOME/bin/mri_surf2surf --srcsubject %s '
                '--srcsurfval %s --trgsubject ico --trgicoorder 5 '
                '--trgsurfval %s --hemi rh --nsmooth-out 5' %
                (subject, right_fmri_tex, right_fsaverage_fmri_tex)))


protocols = ['archi', 'screening', 'rsvp-language', 'hcp1', 'hcp2']
protocols = ['preference', 'mtt1', 'mtt2', 'clips4', 'tom', 'self']
protocols = ['clips1', 'clips2', 'clips3']
protocols = ['lyon1', 'lyon2', 'audio1', 'audio2', 'stanford1',
             'stanford2', 'stanford3']
subject_sessions = sorted(get_subject_session(protocols))

Parallel(n_jobs=4)(
    delayed(project_volume)(work_dir, subject_session[0], [subject_session[1]],
                            do_bbr=True)
    for subject_session in subject_sessions)