def extract_eigenv_roi(bold_image, mask, csvpath, sub, run):
    """
    Use fsl.ImageMeants to extract eigenvariate
    """

    if not os.path.exists(csvpath):
        os.makedirs(csvpath)

    extract_eigv = ImageMeants(in_file=bold_image,
                               terminal_output='file',
                               eig=True,
                               mask=mask,
                               out_file=os.path.join(
                                   csvpath, '{}_{}_{}.csv'.format(
                                       sub, run,
                                       mask.replace('_mask.nii.gz', '')[-4:])))
    extract_eigv.run()
Exemple #2
0
    #         #"sub-184420", ¿?¿?¿? NO BOLD
    #        "sub-185225","sub-187232",
    "sub-48296",
    "sub-49664",
    "sub-50000",
    "sub-73417",
    "sub-84766",
    "sub-86143",
    "sub-88604",
    "sub-92889",
    "sub-92918",
    "sub-93338"
]

#extracting timesieries
extraction = ImageMeants()

for subject_id in list_subjs:
    #defines WF
    wf_reg = get_nuisance_regressors_wf(outdir=root_path +
                                        '/nuisance_correction',
                                        subject_id=subject_id,
                                        timepoints=490)

    #sets necessary inputs
    wf_reg.inputs.input_node.realign_movpar_txt = root_path + '/fmri2standard/{subject_id}/realign_fmri2SBref/{subject_id}_ses-01_run-01_rest_bold_ap_roi_mcf.nii.gz.par'.format(
        subject_id=subject_id)
    wf_reg.inputs.input_node.rfmri_unwarped_imgs = root_path + '/fmri2standard/{subject_id}/spm_coregister2T1_bold/{subject_id}_ses-01_run-01_rest_bold_ap_roi_mcf_corrected_coregistered2T1.nii.gz'.format(
        subject_id=subject_id)
    #wf_reg.inputs.input_node.masks_imgs = root_path+'/nuisance_correction/{subject_id}/masks_csf_wm/wm_binmask.nii.gz'.format(subject_id=subject_id)
    wf_reg.inputs.input_node.mask_wm = root_path + '/nuisance_correction/{subject_id}/masks_csf_wm/wm_binmask.nii.gz'.format(
Exemple #3
0
selectfiles = Node(SelectFiles(templates), name='selectfiles')

# Datasink- where our select outputs will go
datasink = Node(DataSink(), name='datasink')
datasink.inputs.base_directory = output_dir
datasink.inputs.container = output_dir
substitutions = [('_subject_id_', ''),
                 ('_ROIs_..home..camachocm2..Box_home..CARS_rest..ROIs..', '')]
datasink.inputs.substitutions = substitutions

# In[3]:

## Seed-based level 1

# Extract ROI timeseries
ROI_timeseries = Node(ImageMeants(), name='ROI_timeseries', iterfield='mask')


def converthex(orig):
    from numpy import genfromtxt, savetxt
    from os.path import abspath

    orig = genfromtxt(orig, delimiter='  ', dtype=None, skip_header=0)
    new = 'func_roi_ts.txt'
    savetxt(new, orig, delimiter='  ')

    new_file = abspath(new)
    return (new_file)


converthex = Node(name='converthex',