Skip to content

Commit 8375356

Browse files
authored
Merge branch 'master' into mrtrix
2 parents fd470a5 + 1342d62 commit 8375356

37 files changed

+402
-146
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,3 @@ Fixes # .
1717

1818
## List of changes proposed in this PR (pull-request)
1919
<!-- We suggest using bullets (indicated by * or -) and filled checkboxes [x] here -->
20-
21-
## Acknowledgment
22-
23-
- [ ] \(Mandatory\) I acknowledge that this contribution will be available under the Apache 2 license.

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
runs-on: ${{ matrix.os }}
2727
strategy:
2828
matrix:
29-
os: ['ubuntu-18.04']
30-
python-version: [3.6, 3.7, 3.8, 3.9]
29+
os: ['ubuntu-latest']
30+
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
3131
check: ['test']
3232
pip-flags: ['']
3333
depends: ['REQUIREMENTS']

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Kshitij Chawla <kc.insight.pi@gmail.com>
121121
Leonie Lampe <leonie.lampe@gmail.com>
122122
Lukas Snoek <lukassnoek@gmail.com>
123123
Marcel Falkiewicz <mfalkiewicz@gmail.com> <m.falkiewicz@nencki.gov.pl>
124+
Maria de Fatima Dias <mfatimamachado13@gmail.com> <fmachado@dei.uc.pt>
124125
Martin Perez-Guevara <mperezguevara@gmail.com>
125126
Mathias Goncalves <goncalves.mathias@gmail.com> <mathiasg@mit.edu>
126127
Mathias Goncalves <goncalves.mathias@gmail.com> <mathiasg@stanford.edu>

.zenodo.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@
263263
},
264264
{
265265
"affiliation": "CIBIT, UC",
266-
"name": "Machado, F\u00e1tima",
266+
"name": "Dias, Maria de Fatima",
267267
"orcid": "0000-0001-8878-1750"
268268
},
269269
{
@@ -439,7 +439,8 @@
439439
},
440440
{
441441
"affiliation": "Sagol School of Neuroscience, Tel Aviv University",
442-
"name": "Baratz, Zvi"
442+
"name": "Baratz, Zvi",
443+
"orcid": "0000-0001-7159-1387"
443444
},
444445
{
445446
"affiliation": "University of Iowa",
@@ -863,7 +864,13 @@
863864
},
864865
{
865866
"name": "Hui Qian, Tan"
866-
}
867+
},
868+
{
869+
"affiliation": "Insitiute and Polyclinc for Diagnostic and Interventional Neuroradiology, University Hospital Carl Gustav Carus, Dresden, Germany",
870+
"name": "Kuntke, Paul",
871+
"orcid": "0000-0003-1838-2230"
872+
}
873+
867874
],
868875
"keywords": [
869876
"neuroimaging",

nipype/algorithms/confounds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ def compute_noise_components(
14351435
else:
14361436
u = np.full((M.shape[0], 1), np.nan, dtype=np.float32)
14371437

1438-
variance_explained = (s ** 2) / np.sum(s ** 2)
1438+
variance_explained = (s**2) / np.sum(s**2)
14391439
cumulative_variance_explained = np.cumsum(variance_explained)
14401440

14411441
num_components = int(components_criterion)

nipype/algorithms/icc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def ICC_rep_anova(Y):
116116
# Sum Square Error
117117
predicted_Y = dot(dot(dot(X, pinv(dot(X.T, X))), X.T), Y.flatten("F"))
118118
residuals = Y.flatten("F") - predicted_Y
119-
SSE = (residuals ** 2).sum()
119+
SSE = (residuals**2).sum()
120120

121121
residuals.shape = Y.shape
122122

nipype/algorithms/metrics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def _run_interface(self, runtime):
337337
if self.inputs.weighting != "none":
338338
weights = weights / np.array(volumes1)
339339
if self.inputs.weighting == "squared_vol":
340-
weights = weights ** 2
340+
weights = weights**2
341341
weights = weights / np.sum(weights)
342342

343343
both_data = np.zeros(data1.shape)
@@ -500,7 +500,7 @@ def _run_interface(self, runtime):
500500
volumes = np.sum((refdata + tstdata) > 0, axis=1).reshape((-1, ncomp))
501501
weights = 1.0 / volumes
502502
if self.inputs.weighting == "squared_vol":
503-
weights = weights ** 2
503+
weights = weights**2
504504

505505
weights = weights / np.sum(weights)
506506
dices = 2.0 * jaccards / (jaccards + 1.0)
@@ -591,7 +591,7 @@ def _run_interface(self, runtime):
591591

592592
# Scale the difference
593593
if self.inputs.metric == "sqeuclidean":
594-
errvector = diffvector ** 2
594+
errvector = diffvector**2
595595
if comps > 1:
596596
errvector = np.sum(errvector, axis=1)
597597
else:

nipype/algorithms/tests/test_ErrorMap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ def test_errormap(tmpdir):
7575

7676
errmap.inputs.metric = "euclidean"
7777
result = errmap.run()
78-
assert result.outputs.distance == np.float32(1.25 * (2 ** 0.5))
78+
assert result.outputs.distance == np.float32(1.25 * (2**0.5))

nipype/info.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def get_nipype_gitversion():
5757
"Programming Language :: Python :: 3.6",
5858
"Programming Language :: Python :: 3.7",
5959
"Programming Language :: Python :: 3.8",
60+
"Programming Language :: Python :: 3.9",
61+
"Programming Language :: Python :: 3.10",
6062
"Topic :: Scientific/Engineering",
6163
]
6264
PYTHON_REQUIRES = ">= 3.6"
@@ -169,7 +171,6 @@ def get_nipype_gitversion():
169171
"sphinx-argparse",
170172
"sphinx>=2.1.2",
171173
"sphinxcontrib-apidoc",
172-
"sphinxcontrib-napoleon",
173174
],
174175
"duecredit": ["duecredit"],
175176
"nipy": ["nitime", "nilearn", "dipy", "nipy", "matplotlib"],

nipype/interfaces/ants/base.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
# vi: set ft=python sts=4 ts=4 sw=4 et:
44
"""The ants module provides basic functions for interfacing with ANTS tools."""
55
import os
6+
from packaging.version import Version, parse
67

78
# Local imports
8-
from ... import logging, LooseVersion
9+
from ... import logging
910
from ..base import CommandLine, CommandLineInputSpec, traits, isdefined, PackageInfo
1011

1112
iflogger = logging.getLogger("nipype.interface")
@@ -43,13 +44,16 @@ def parse_version(raw_info):
4344
# -githash may or may not be appended
4445
v_string = v_string.split("-")[0]
4546

46-
# 2.2.0-equivalent version string
47-
if "post" in v_string and LooseVersion(v_string) >= LooseVersion(
48-
"2.1.0.post789"
49-
):
50-
return "2.2.0"
51-
else:
52-
return ".".join(v_string.split(".")[:3])
47+
version = parse(v_string)
48+
49+
# Known mislabeled versions
50+
if version.is_postrelease:
51+
if version.base_version == "2.1.0" and version.post >= 789:
52+
return "2.2.0"
53+
54+
# Unless we know of a specific reason to re-version, we will
55+
# treat the base version (before pre/post/dev) as authoritative
56+
return version.base_version
5357

5458

5559
class ANTSCommandInputSpec(CommandLineInputSpec):

nipype/interfaces/ants/registration.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,16 +1293,12 @@ def _format_arg(self, opt, spec, val):
12931293
do_center_of_mass_init,
12941294
)
12951295
elif opt == "interpolation":
1296-
if (
1297-
self.inputs.interpolation
1298-
in [
1299-
"BSpline",
1300-
"MultiLabel",
1301-
"Gaussian",
1302-
"GenericLabel",
1303-
]
1304-
and isdefined(self.inputs.interpolation_parameters)
1305-
):
1296+
if self.inputs.interpolation in [
1297+
"BSpline",
1298+
"MultiLabel",
1299+
"Gaussian",
1300+
"GenericLabel",
1301+
] and isdefined(self.inputs.interpolation_parameters):
13061302
return "--interpolation %s[ %s ]" % (
13071303
self.inputs.interpolation,
13081304
", ".join(
@@ -1595,14 +1591,17 @@ class MeasureImageSimilarity(ANTSCommand):
15951591
output_spec = MeasureImageSimilarityOutputSpec
15961592

15971593
def _metric_constructor(self):
1598-
retval = '--metric {metric}["{fixed_image}","{moving_image}",{metric_weight},' "{radius_or_number_of_bins},{sampling_strategy},{sampling_percentage}]".format(
1599-
metric=self.inputs.metric,
1600-
fixed_image=self.inputs.fixed_image,
1601-
moving_image=self.inputs.moving_image,
1602-
metric_weight=self.inputs.metric_weight,
1603-
radius_or_number_of_bins=self.inputs.radius_or_number_of_bins,
1604-
sampling_strategy=self.inputs.sampling_strategy,
1605-
sampling_percentage=self.inputs.sampling_percentage,
1594+
retval = (
1595+
'--metric {metric}["{fixed_image}","{moving_image}",{metric_weight},'
1596+
"{radius_or_number_of_bins},{sampling_strategy},{sampling_percentage}]".format(
1597+
metric=self.inputs.metric,
1598+
fixed_image=self.inputs.fixed_image,
1599+
moving_image=self.inputs.moving_image,
1600+
metric_weight=self.inputs.metric_weight,
1601+
radius_or_number_of_bins=self.inputs.radius_or_number_of_bins,
1602+
sampling_strategy=self.inputs.sampling_strategy,
1603+
sampling_percentage=self.inputs.sampling_percentage,
1604+
)
16061605
)
16071606
return retval
16081607

nipype/interfaces/ants/resampling.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -504,15 +504,11 @@ def _format_arg(self, opt, spec, val):
504504
elif opt == "transforms":
505505
return self._get_transform_filenames()
506506
elif opt == "interpolation":
507-
if (
508-
self.inputs.interpolation
509-
in [
510-
"BSpline",
511-
"MultiLabel",
512-
"Gaussian",
513-
]
514-
and isdefined(self.inputs.interpolation_parameters)
515-
):
507+
if self.inputs.interpolation in [
508+
"BSpline",
509+
"MultiLabel",
510+
"Gaussian",
511+
] and isdefined(self.inputs.interpolation_parameters):
516512
return "--interpolation %s[ %s ]" % (
517513
self.inputs.interpolation,
518514
", ".join(

nipype/interfaces/ants/tests/test_auto_ConvertScalarImageToRGB.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def test_ConvertScalarImageToRGB_inputs():
3535
),
3636
mask_image=dict(
3737
argstr="%s",
38-
extensions=None,
3938
position=3,
4039
usedefault=True,
4140
),

nipype/interfaces/ants/tests/test_auto_ImageMath.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ def test_ImageMath_inputs():
66
input_map = dict(
77
args=dict(
88
argstr="%s",
9+
position=-1,
910
),
1011
copy_header=dict(
1112
usedefault=True,
@@ -27,11 +28,11 @@ def test_ImageMath_inputs():
2728
argstr="%s",
2829
extensions=None,
2930
mandatory=True,
30-
position=-2,
31+
position=-3,
3132
),
3233
op2=dict(
3334
argstr="%s",
34-
position=-1,
35+
position=-2,
3536
),
3637
operation=dict(
3738
argstr="%s",
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from nipype.interfaces.ants.base import Info
2+
3+
import pytest
4+
5+
# fmt: off
6+
ANTS_VERSIONS = [("""\
7+
ANTs Version: 2.3.3.dev168-g29bdf
8+
Compiled: Jun 9 2020 03:44:55
9+
10+
""", "2.3.3"), ("""\
11+
ANTs Version: v2.3.5.post76-g28dd25c
12+
Compiled: Nov 16 2021 14:57:48
13+
14+
""", "2.3.5"), ("""\
15+
ANTs Version: v2.1.0.post789-g0740f
16+
Compiled: I don't still have this so not going to pretend
17+
18+
""", "2.2.0"),
19+
]
20+
# fmt: on
21+
22+
23+
@pytest.mark.parametrize("raw_info, version", ANTS_VERSIONS)
24+
def test_version_parser(raw_info, version):
25+
assert Info.parse_version(raw_info) == version

0 commit comments

Comments
 (0)