From cf28b970aeac9bf2611b7330f53725c8ed81edb1 Mon Sep 17 00:00:00 2001 From: oesteban Date: Tue, 26 Nov 2019 22:47:13 -0800 Subject: [PATCH] FIX: Hard-wire ``MNI152NLin2009cAsym`` as standard space for SDC-SyN --- sdcflows/workflows/syn.py | 24 ++++++++---------------- setup.cfg | 5 ++--- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/sdcflows/workflows/syn.py b/sdcflows/workflows/syn.py index 73eaadda3b..fb8a7bbf3d 100644 --- a/sdcflows/workflows/syn.py +++ b/sdcflows/workflows/syn.py @@ -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 @@ -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 @@ -127,7 +125,7 @@ def init_syn_sdc_wf(omp_nthreads, epi_pe=None, template [@fieldmapless3]. """.format(ants_ver=Registration().version or '') 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( @@ -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) @@ -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') # Inverting (1), then applying in reverse order: # @@ -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')]), @@ -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)) diff --git a/setup.cfg b/setup.cfg index a5cdbbd526..95ca771138 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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