diff --git a/CHANGES.rst b/CHANGES.rst index c25b2d148c..8ddfbaea31 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,7 @@ +1.2.4 (May 4, 2020) +=================== +Bug-fix release to ensure backwards compatibility with previous fMRIPrep versions. + 1.2.3 (April 16, 2020) ====================== Bug-fix release enforcing BIDS-Derivatives labels on ``dseg`` file. diff --git a/docs/requirements.txt b/docs/requirements.txt index c2cdd9ab7d..308005c90a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,7 +3,7 @@ git+https://github.com/rwblair/sphinxcontrib-versioning.git@39b40b0b84bf872fc398 nbsphinx niflow-nipype1-workflows ~= 0.0.1 nipype>=1.3.1 -niworkflows >=1.2.0rc4,<1.4 +niworkflows ~= 1.1.12 packaging pydot>=1.2.3 pydotplus diff --git a/sdcflows/interfaces/__init__.py b/sdcflows/interfaces/__init__.py index e69de29bb2..ee6c942a70 100644 --- a/sdcflows/interfaces/__init__.py +++ b/sdcflows/interfaces/__init__.py @@ -0,0 +1,21 @@ +# Backports + + +def dseg_label(in_seg, label, newpath=None): + """Extract a particular label from a discrete segmentation.""" + from pathlib import Path + import nibabel as nb + import numpy as np + from nipype.utils.filemanip import fname_presuffix + + newpath = Path(newpath or '.') + + nii = nb.load(in_seg) + data = np.int16(nii.dataobj) == label + + out_file = fname_presuffix(in_seg, suffix='_mask', + newpath=str(newpath.absolute())) + new = nii.__class__(data, nii.affine, nii.header) + new.set_data_dtype(np.uint8) + new.to_filename(out_file) + return out_file diff --git a/sdcflows/workflows/outputs.py b/sdcflows/workflows/outputs.py index b94e51dfbd..13b8c8c943 100644 --- a/sdcflows/workflows/outputs.py +++ b/sdcflows/workflows/outputs.py @@ -41,9 +41,9 @@ def init_sdc_unwarp_report_wf(name='sdc_unwarp_report_wf', forcedsyn=False): Affine transform from T1 space to BOLD space (ITK format) """ + from ..interfaces import dseg_label as _dseg_label from niworkflows.interfaces import SimpleBeforeAfter from niworkflows.interfaces.fixes import FixHeaderApplyTransforms as ApplyTransforms - from niworkflows.utils.images import dseg_label as _dseg_label DEFAULT_MEMORY_MIN_GB = 0.01 @@ -58,7 +58,10 @@ def init_sdc_unwarp_report_wf(name='sdc_unwarp_report_wf', forcedsyn=False): sel_wm = pe.Node(niu.Function(function=_dseg_label), name='sel_wm', mem_gb=DEFAULT_MEMORY_MIN_GB) - sel_wm.inputs.label = 2 + # API CHANGE: sMRIPrep 0.6.x + # https://github.com/poldracklab/smriprep/issues/176 + # https://github.com/poldracklab/smriprep/pull/177 changes this to 2 + sel_wm.inputs.label = 3 bold_rpt = pe.Node(SimpleBeforeAfter(), name='bold_rpt', mem_gb=0.1) diff --git a/setup.cfg b/setup.cfg index 16bf545af0..0113f42d29 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,7 +29,7 @@ install_requires = nibabel >=3.0.1 niflow-nipype1-workflows ~= 0.0.1 nipype >=1.3.1,<2.0 - niworkflows >=1.2.0rc4,<1.4 + niworkflows ~= 1.1.12 numpy pybids >= 0.9.2 templateflow >=0.4