Skip to content

[RTM] RF: Assume phase-encoding direction is A-P unless specified L-R #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 7, 2017
Merged
9 changes: 8 additions & 1 deletion fmriprep/interfaces/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

FUNCTIONAL_TEMPLATE = """\t\t<h3 class="elem-title">Summary</h3>
\t\t<ul class="elem-desc">
\t\t\t<li>Phase-encoding (PE) direction: {pedir}</li>
\t\t\t<li>Slice timing correction: {stc}</li>
\t\t\t<li>Susceptibility distortion correction: {sdc}</li>
\t\t\t<li>Registration: {registration}</li>
Expand Down Expand Up @@ -141,6 +142,8 @@ class FunctionalSummaryInputSpec(BaseInterfaceInputSpec):
distortion_correction = traits.Enum('epi', 'fieldmap', 'phasediff', 'SyN', 'None',
desc='Susceptibility distortion correction method',
mandatory=True)
pe_direction = traits.Enum(None, 'i', 'i-', 'j', 'j-', mandatory=True,
desc='Phase-encoding direction detected')
registration = traits.Enum('FLIRT', 'bbregister', mandatory=True,
desc='Functional/anatomical registration method')
output_spaces = traits.List(desc='Target spaces')
Expand All @@ -163,7 +166,11 @@ def _generate_segment(self):
reg = {'FLIRT': 'FLIRT with boundary-based registration (BBR) metric',
'bbregister': 'FreeSurfer boundary-based registration (bbregister)'
}[self.inputs.registration]
return FUNCTIONAL_TEMPLATE.format(stc=stc, sdc=sdc, registration=reg,
if self.inputs.pe_direction is None:
pedir = 'MISSING - Assuming Anterior-Posterior'
else:
pedir = {'i': 'Left-Right', 'j': 'Anterior-Posterior'}[self.inputs.pe_direction[0]]
return FUNCTIONAL_TEMPLATE.format(pedir=pedir, stc=stc, sdc=sdc, registration=reg,
output_spaces=', '.join(self.inputs.output_spaces),
confounds=', '.join(self.inputs.confounds))

Expand Down
17 changes: 11 additions & 6 deletions fmriprep/workflows/anatomical.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def init_anat_preproc_wf(skull_strip_ants, output_spaces, template, debug, frees
FreeSurfer SUBJECTS_DIR
subject_id
FreeSurfer subject ID
fs_2_t1_transform
t1_2_fsnative_reverse_transform
Affine transform from FreeSurfer subject space to T1w space
surfaces
GIFTI surfaces (gray/white boundary, midthickness, pial, inflated)
Expand All @@ -174,7 +174,7 @@ def init_anat_preproc_wf(skull_strip_ants, output_spaces, template, debug, frees
fields=['t1_preproc', 't1_brain', 't1_mask', 't1_seg', 't1_tpms',
't1_2_mni', 't1_2_mni_forward_transform', 't1_2_mni_reverse_transform',
'mni_mask', 'mni_seg', 'mni_tpms',
'subjects_dir', 'subject_id', 'fs_2_t1_transform', 'surfaces']),
'subjects_dir', 'subject_id', 't1_2_fsnative_reverse_transform', 'surfaces']),
name='outputnode')

# 0. Reorient T1w image(s) to RAS and resample to common voxel space
Expand Down Expand Up @@ -314,7 +314,7 @@ def len_above_thresh(in_list, threshold, longitudinal):
(surface_recon_wf, outputnode, [
('outputnode.subjects_dir', 'subjects_dir'),
('outputnode.subject_id', 'subject_id'),
('outputnode.fs_2_t1_transform', 'fs_2_t1_transform'),
('outputnode.t1_2_fsnative_reverse_transform', 't1_2_fsnative_reverse_transform'),
('outputnode.surfaces', 'surfaces')]),
])

Expand Down Expand Up @@ -499,7 +499,7 @@ def init_surface_recon_wf(omp_nthreads, hires, name='surface_recon_wf'):
FreeSurfer SUBJECTS_DIR
subject_id
FreeSurfer subject ID
fs_2_t1_transform
t1_2_fsnative_reverse_transform
FSL-style affine matrix translating from FreeSurfer T1.mgz to T1w
surfaces
GIFTI surfaces for gray/white matter boundary, pial surface,
Expand All @@ -521,7 +521,8 @@ def init_surface_recon_wf(omp_nthreads, hires, name='surface_recon_wf'):
name='inputnode')
outputnode = pe.Node(
niu.IdentityInterface(
fields=['subjects_dir', 'subject_id', 'fs_2_t1_transform', 'surfaces', 'out_report']),
fields=['subjects_dir', 'subject_id', 't1_2_fsnative_reverse_transform', 'surfaces',
'out_report']),
name='outputnode')

recon_config = pe.Node(FSDetectInputs(hires_enabled=hires), name='recon_config',
Expand All @@ -542,6 +543,7 @@ def init_surface_recon_wf(omp_nthreads, hires, name='surface_recon_wf'):
fs_transform = pe.Node(
fs.Tkregister2(fsl_out='freesurfer2subT1.mat', reg_header=True),
name='fs_transform')
fsl2lta = pe.Node(fs.utils.LTAConvert(out_lta=True), name='fsl2lta')

autorecon_resume_wf = init_autorecon_resume_wf(omp_nthreads=omp_nthreads)
gifti_surface_wf = init_gifti_surface_wf()
Expand Down Expand Up @@ -572,12 +574,15 @@ def init_surface_recon_wf(omp_nthreads, hires, name='surface_recon_wf'):
# reoriented image
(inputnode, fs_transform, [('t1w', 'target_image')]),
(autorecon1, fs_transform, [('T1', 'moving_image')]),
(inputnode, fsl2lta, [('t1w', 'target_file')]),
(autorecon1, fsl2lta, [('T1', 'source_file')]),
(fs_transform, fsl2lta, [('fsl_file', 'in_fsl')]),
# Output
(autorecon_resume_wf, outputnode, [('outputnode.subjects_dir', 'subjects_dir'),
('outputnode.subject_id', 'subject_id'),
('outputnode.out_report', 'out_report')]),
(gifti_surface_wf, outputnode, [('outputnode.surfaces', 'surfaces')]),
(fs_transform, outputnode, [('fsl_file', 'fs_2_t1_transform')]),
(fsl2lta, outputnode, [('out_lta', 't1_2_fsnative_reverse_transform')]),
])

return workflow
Expand Down
3 changes: 2 additions & 1 deletion fmriprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ def init_single_subject_wf(subject_id, task_id, name,
(anat_preproc_wf, func_preproc_wf,
[('outputnode.subjects_dir', 'inputnode.subjects_dir'),
('outputnode.subject_id', 'inputnode.subject_id'),
('outputnode.fs_2_t1_transform', 'inputnode.fs_2_t1_transform')]),
('outputnode.t1_2_fsnative_reverse_transform',
'inputnode.t1_2_fsnative_reverse_transform')]),
])

return workflow
Loading