Skip to content
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

FIX: Hard-wire MNI152NLin2009cAsym as standard space for SDC-SyN #63

Merged
merged 1 commit into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions sdcflows/workflows/syn.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


"""
import pkg_resources as pkgr
from pkg_resources import resource_filename

from nipype import logging
from nipype.pipeline import engine as pe
Expand Down Expand Up @@ -74,8 +74,6 @@ def init_syn_sdc_wf(omp_nthreads, epi_pe=None,
reference image
in_reference_brain
skull-stripped reference image
template : str
Name of template targeted by ``template`` output space
t1w_brain
skull-stripped, bias-corrected structural image
std2anat_xfm
Expand Down Expand Up @@ -127,7 +125,7 @@ def init_syn_sdc_wf(omp_nthreads, epi_pe=None,
template [@fieldmapless3].
""".format(ants_ver=Registration().version or '<ver>')
inputnode = pe.Node(
niu.IdentityInterface(['in_reference', 'in_reference_brain', 'template',
niu.IdentityInterface(['in_reference', 'in_reference_brain',
't1w_brain', 'std2anat_xfm']),
name='inputnode')
outputnode = pe.Node(
Expand All @@ -137,10 +135,10 @@ def init_syn_sdc_wf(omp_nthreads, epi_pe=None,

# Collect predefined data
# Atlas image and registration affine
atlas_img = pkgr.resource_filename('sdcflows', 'data/fmap_atlas.nii.gz')
atlas_img = resource_filename('sdcflows', 'data/fmap_atlas.nii.gz')
# Registration specifications
affine_transform = pkgr.resource_filename('sdcflows', 'data/affine.json')
syn_transform = pkgr.resource_filename('sdcflows', 'data/susceptibility_syn.json')
affine_transform = resource_filename('sdcflows', 'data/affine.json')
syn_transform = resource_filename('sdcflows', 'data/susceptibility_syn.json')

invert_t1w = pe.Node(Rescale(invert=True), name='invert_t1w',
mem_gb=0.3)
Expand All @@ -153,6 +151,8 @@ def init_syn_sdc_wf(omp_nthreads, epi_pe=None,
# 1) BOLD -> T1; 2) MNI -> T1; 3) ATLAS -> MNI
transform_list = pe.Node(niu.Merge(3), name='transform_list',
mem_gb=DEFAULT_MEMORY_MIN_GB)
transform_list.inputs.in3 = resource_filename(
'sdcflows', 'data/fmap_atlas_2_MNI152NLin2009cAsym_affine.mat')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In reality, we only have this pre-calculated affine, so offering to switch was asking for trouble.


# Inverting (1), then applying in reverse order:
#
Expand Down Expand Up @@ -193,8 +193,7 @@ def init_syn_sdc_wf(omp_nthreads, epi_pe=None,
(ref_2_t1, t1_2_ref, [('forward_transforms', 'transforms')]),
(ref_2_t1, transform_list, [('forward_transforms', 'in1')]),
(inputnode, transform_list, [
('std2anat_xfm', 'in2'),
(('template', _prior_path), 'in3')]),
('std2anat_xfm', 'in2')]),
(inputnode, atlas_2_ref, [('in_reference', 'reference_image')]),
(transform_list, atlas_2_ref, [('out', 'transforms')]),
(atlas_2_ref, threshold_atlas, [('output_image', 'in_file')]),
Expand All @@ -215,10 +214,3 @@ def init_syn_sdc_wf(omp_nthreads, epi_pe=None,
])

return workflow


def _prior_path(template):
"""Select an appropriate input xform, based on template."""
from pkg_resources import resource_filename
return resource_filename(
'sdcflows', 'data/fmap_atlas_2_{}_affine.mat'.format(template))
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ setup_requires =
install_requires =
nibabel >=2.2.1
niflow-nipype1-workflows ~= 0.0.1
nipype ~= 1.3.0
# nipype @ git+https://github.com/nipy/nipype.git@5058ab7dfa6c32d4f3a16ee698a8fc4e3d28bee7
niworkflows ~= 1.0.0rc1
nipype >= 1.3.1
niworkflows ~= 1.0.0
numpy
pybids ~=0.9.2
templateflow ~= 0.4
Expand Down