示例#1
0
def _run_demo(func, anat):
    # fit
    coreg = Coregister().fit(anat, func)

    # apply coreg
    VFk = coreg.transform(func)

    # QA
    plot_registration(anat, VFk, title="before coreg")
    plot_registration(VFk, anat, title="after coreg")
    plt.show()
示例#2
0
def _run_demo(func, anat):
    # fit
    coreg = Coregister().fit(anat, func)

    # apply coreg
    VFk = coreg.transform(func)

    # QA
    plot_registration(anat, VFk, title="before coreg")
    plot_registration(VFk, anat, title="after coreg")
    plt.show()
示例#3
0
subject_data = do_preproc(funcfile, anatfile, args.subject, decimate=False)
subject_data.func

# #### Perform some quality checks for one subject
#
# First we can check the motion parameters:
plot_spm_motion_parameters(
    subject_data.nipype_results["realign"].outputs.realignment_parameters,
    title="Realign: estimated motion.")
plt.savefig(os.path.join(outdir, filename_prefix + '_motion_params.png'))
plt.close()

# We can also check the coregistration:
plot_registration(
    anatfile,
    subject_data.nipype_results["coreg"].outputs.coregistered_files,
    close=False,
    cut_coords=(-10, 20, 5),
    title="Coregister outline.")
plt.savefig(os.path.join(outdir, filename_prefix + '_coregistration.png'))
plt.close()

# And the normalization:
from pypreprocess.nipype_preproc_spm_utils import SPM_T1_TEMPLATE

plot_registration(
    SPM_T1_TEMPLATE,
    subject_data.nipype_results["normalize"].outputs.normalized_source,
    close=False,
    cut_coords=(-10, 0, 5),
    title="Normalization outline.")
plt.savefig(os.path.join(outdir, filename_prefix + '_normalization.png'))
示例#4
0
from pypreprocess import coreg

BASE_DIR = os.path.join('/', 'shfj', 'Ppsypim', 'PSYDAT', 'Subjects')
FIG_BASE_DIR = os.path.join('figures')

subject_path_list = glob.glob(os.path.join(BASE_DIR, 'S*'))

for sp in subject_path_list:
    root, subject_id = os.path.split(sp)

    # Plot Coreg
    mid_dir = os.path.join(sp, 'MRI', 'MID')
    fmri = glob.glob(os.path.join(mid_dir, '[se]*.nii'))
    
    t1_dir = os.path.join(sp, 'MRI', 'T1MRI')
    t1mri = glob.glob(os.path.join(t1_dir, '*.hdr'))


    coreg_fig = os.path.join(FIG_BASE_DIR, 'coregister', subject_id)
    if len(fmri)>0 and len(t1mri)>0:
        c = coreg.Coregister()
        c.fit(fmri[0], t1mri[0])
        transf = c.transform(t1mri[0])
        plot_registration(transf, fmri[0], 
                          title=subject_id,
                          output_filename=coreg_fig)