Skip to content

Commit 0e11cea

Browse files
authored
Merge pull request #3067 from effigies/mnt/workflows_to_niflows
RF: Redirect nipype.workflows to niflow.nipype1.workflows
2 parents 9e19349 + 5c9e571 commit 0e11cea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+48
-14357
lines changed

docker/generate_dockerfiles.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ function generate_main_dockerfile() {
9393
--miniconda create_env=neuro \
9494
conda_install='python=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
9595
libxml2 libxslt matplotlib mkl "numpy!=1.16.0" paramiko
96-
pandas psutil scikit-learn scipy traits' \
97-
pip_install="pytest-xdist" \
96+
pandas psutil scikit-learn scipy traits rdflib' \
97+
pip_install="pytest-xdist niflow-nipype1-workflows" \
9898
activate=true \
9999
--copy docker/files/run_builddocs.sh docker/files/run_examples.sh \
100100
docker/files/run_pytests.sh nipype/external/fsl_imglob.py /usr/bin/ \

nipype/interfaces/fsl/dti.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ class BEDPOSTX5(FSLXCommand):
424424
425425
426426
.. note:: Consider using
427-
:func:`nipype.workflows.fsl.dmri.create_bedpostx_pipeline` instead.
427+
:func:`niflow.nipype1.workflows.fsl.dmri.create_bedpostx_pipeline` instead.
428428
429429
430430
Example

nipype/interfaces/fsl/epi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ class EPIDeWarp(FSLCommand):
11001100
<http://surfer.nmr.mgh.harvard.edu/fswiki/epidewarp.fsl>`_.
11011101
11021102
.. warning:: deprecated in FSL, please use
1103-
:func:`nipype.workflows.dmri.preprocess.epi.sdc_fmb` instead.
1103+
:func:`niflow.nipype1.workflows.dmri.preprocess.epi.sdc_fmb` instead.
11041104
11051105
Examples
11061106
--------

nipype/interfaces/mrtrix/convert.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,34 @@
1515

1616
from ... import logging
1717
from ...utils.filemanip import split_filename
18-
from ...workflows.misc.utils import get_data_dims, get_vox_dims
1918
from ..base import TraitedSpec, File, isdefined
2019
from ..dipy.base import DipyBaseInterface, HAVE_DIPY as have_dipy
2120

2221
iflogger = logging.getLogger('nipype.interface')
2322

2423

24+
def get_vox_dims(volume):
25+
import nibabel as nb
26+
from nipype.utils import NUMPY_MMAP
27+
if isinstance(volume, list):
28+
volume = volume[0]
29+
nii = nb.load(volume, mmap=NUMPY_MMAP)
30+
hdr = nii.header
31+
voxdims = hdr.get_zooms()
32+
return [float(voxdims[0]), float(voxdims[1]), float(voxdims[2])]
33+
34+
35+
def get_data_dims(volume):
36+
import nibabel as nb
37+
from nipype.utils import NUMPY_MMAP
38+
if isinstance(volume, list):
39+
volume = volume[0]
40+
nii = nb.load(volume, mmap=NUMPY_MMAP)
41+
hdr = nii.header
42+
datadims = hdr.get_data_shape()
43+
return [int(datadims[0]), int(datadims[1]), int(datadims[2])]
44+
45+
2546
def transform_to_affine(streams, header, affine):
2647
from dipy.tracking.utils import move_streamlines
2748
rotation, scale = np.linalg.qr(affine)

nipype/workflows/__init__.py

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
11
# -*- coding: utf-8 -*-
22
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
33
# vi: set ft=python sts=4 ts=4 sw=4 et:
4+
5+
_msg = ["Nipype 1 workflows have been moved to the niflow-nipype1-workflows package."]
6+
try:
7+
from niflow.nipype1.workflows import data, dmri, fmri, misc, rsfmri, smri
8+
except ImportError:
9+
_msg.append("pip install niflow-nipype1-workflows to continue using them.")
10+
else:
11+
import sys
12+
# Hack to make `from nipype.workflows.X import Y` work
13+
sys.modules['nipype.workflows.data'] = data
14+
sys.modules['nipype.workflows.dmri'] = dmri
15+
sys.modules['nipype.workflows.fmri'] = fmri
16+
sys.modules['nipype.workflows.misc'] = misc
17+
sys.modules['nipype.workflows.rsfmri'] = rsfmri
18+
sys.modules['nipype.workflows.smri'] = smri
19+
_msg.append("nipype.workflows.* provides a reference for backwards compatibility. "
20+
"Please use niflow.nipype1.workflows.* to avoid this warning.")
21+
del sys
22+
23+
import warnings
24+
warnings.warn(' '.join(_msg))
25+
del warnings, _msg

nipype/workflows/data/__init__.py

-17
This file was deleted.

nipype/workflows/data/ecc.sch

-67
This file was deleted.

nipype/workflows/data/hmc.sch

-64
This file was deleted.

nipype/workflows/dmri/__init__.py

-4
This file was deleted.

nipype/workflows/dmri/camino/__init__.py

-5
This file was deleted.

0 commit comments

Comments
 (0)