def test_ImageMeants_outputs():
    output_map = dict(out_file=dict(),
    )
    outputs = ImageMeants.output_spec()

    for key, metadata in output_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(outputs.traits()[key], metakey), value
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()
def test_ImageMeants_inputs():
    input_map = dict(args=dict(argstr='%s',
    ),
    eig=dict(argstr='--eig',
    ),
    environ=dict(nohash=True,
    usedefault=True,
    ),
    ignore_exception=dict(nohash=True,
    usedefault=True,
    ),
    in_file=dict(argstr='-i %s',
    mandatory=True,
    position=0,
    ),
    mask=dict(argstr='-m %s',
    ),
    nobin=dict(argstr='--no_bin',
    ),
    order=dict(argstr='--order=%d',
    usedefault=True,
    ),
    out_file=dict(argstr='-o %s',
    genfile=True,
    hash_files=False,
    ),
    output_type=dict(),
    show_all=dict(argstr='--showall',
    ),
    spatial_coord=dict(argstr='-c %s',
    ),
    terminal_output=dict(mandatory=True,
    nohash=True,
    ),
    transpose=dict(argstr='--transpose',
    ),
    use_mm=dict(argstr='--usemm',
    ),
    )
    inputs = ImageMeants.input_spec()

    for key, metadata in input_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(inputs.traits()[key], metakey), value
예제 #4
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(
예제 #5
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',