Skip to content
Closed
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
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions sdcflows/interfaces/__init__.py
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions sdcflows/workflows/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down