diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000000..fcf6e648ca --- /dev/null +++ b/.codespellrc @@ -0,0 +1,12 @@ +[codespell] +skip = .git,*.pdf,*.svg,external +# nd,nam - import module short +# fith - oddness coming from AFNI +# whos - smth used in matlab things +# SMAL - Stanford CNI MRS Library +# Suh - name +# noo,crasher - field/var name used +# Reson - short journal name +# ALS, FWE - neuroimaging specific abbrevs +# Comision - foreign word used +ignore-words-list = te,inport,objekt,jist,nd,hel,inout,fith,whos,fot,ue,shs,smal,nam,filetest,suh,noo,reson,als,fwe,crasher,comision diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 4c410e9b0d..8c1e119249 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,19 +1,80 @@ -# Commits with messages like "STY: black" or "run black" +# Wed Apr 5 14:01:05 2023 -0400 - effigies@gmail.com - STY: black [ignore-rev] +a9ce9b78a402ebacf7726ad6454bb75b1447f52f +# Wed Sep 14 14:12:07 2022 -0400 - mathiasg@stanford.edu - STY: Black +f4a779223c6b0dffa47138d24ec9ef378c7164a9 +# Tue Apr 19 14:09:31 2022 -0400 - markiewicz@stanford.edu - STY: black [ignore-rev] +b9716ebd46541f7fb1b96a94cc35b5e2ea6c3bba +# Fri Apr 15 06:59:48 2022 -0700 - markiewicz@stanford.edu - STY: black [ignore-rev] +d223fbccda6dee0ef39e00084296a3292f2ccf87 +# Fri Apr 8 21:34:43 2022 -0400 - markiewicz@stanford.edu - STY: black [ignore-rev] +e3f56da124fd58041018c2e70d16a130ef189a66 +# Sun Apr 3 10:27:07 2022 -0400 - markiewicz@stanford.edu - STY: black [ignore-rev] +988c382ebfc7df964874b6287b9d9e27e274a4a4 +# Sat Apr 2 21:32:56 2022 -0400 - markiewicz@stanford.edu - STY: black [ignore-rev] +230fac6149d4dfbd5da669a983332a1fe318ef57 +# Sat Apr 2 12:49:15 2022 -0400 - markiewicz@stanford.edu - STY/TEST: Make specs and run black [ignore-rev] +2ba8dacb8cc1f6f9c5b15b1cfb7b0395d45dcfb3 +# Sun Mar 20 21:19:39 2022 -0400 - markiewicz@stanford.edu - STY: black [ignore-rev] +87cc1b54981113024ec3fd594881f72cf67513fb +# Wed Dec 8 17:02:09 2021 -0500 - markiewicz@stanford.edu - STY: black [ignore-rev] +5ac2f18ac116832d81a13f0c83e0a6aeda1457cf +# Thu Dec 2 09:30:42 2021 -0500 - markiewicz@stanford.edu - STY: black +ee50279ebf061a70ff502e7d2e51385b285cfda4 +# Tue Oct 26 11:18:02 2021 +0200 - code@oscaresteban.es - sty: run black +5d9adbbb77b7047b9b47cd2fa079dee0094cfc91 +# Wed Oct 20 12:07:15 2021 +0200 - fabio.bernardoni@uniklinikum-dresden.de - run black on the preprocess.py file to improve formatting +674e9b0eeca082efb5322b61fea57ee89a3e4a24 +# Wed Oct 13 16:08:23 2021 -0400 - markiewicz@stanford.edu - ENH: Add expected steps for FreeSurfer 7 recon-all (#3389) +8f7c0bf2ec9c819844a2736a9ae2f6eef19a8e7f +# Wed Oct 13 14:26:48 2021 -0400 - markiewicz@stanford.edu - STY: black +d8dbc6f7b6a5385535e2fa53b7c6af7aa1370f46 +# Wed Sep 29 16:53:54 2021 +0200 - code@oscaresteban.es - sty: run black on affected files +5f280da629bb7b5dce908633d2deea85b55dd67b +# Thu Jun 24 17:43:22 2021 +0200 - code@oscaresteban.es - sty: run black +135ce497a18adbe0811441c2b720910ec549aa6f +# Thu Sep 23 08:56:28 2021 -0400 - markiewicz@stanford.edu - STY: black +f69b3fb09560616822737764bb07272cd587e4a0 +# Fri Apr 30 17:19:55 2021 -0400 - markiewicz@stanford.edu - STY: black +04718ac71436b6f283af7575dda0f6998b64f893 +# Fri Apr 30 16:50:00 2021 -0400 - markiewicz@stanford.edu - STY: black 12deb959cccc431fb8222cc5854f1c92a0080021 +# Thu Apr 1 12:26:08 2021 -0400 - markiewicz@stanford.edu - STY: black f64bf338f630a9ee5cbe7a3ec98c68292897e720 +# Thu Dec 3 09:24:05 2020 +1100 - tom.g.close@gmail.com - run black over touched files +c81259bc3b28baa1f18f95f6b056c228c6bfd115 +# Fri Aug 14 17:15:15 2020 -0400 - markiewicz@stanford.edu - STY: Black 83358d7f17aac07cb90d0330f11ea2322e2974d8 +# Sat Mar 14 12:44:20 2020 -0400 - markiewicz@stanford.edu - STY: black faef7d0f93013a700c882f709e98fb3cd36ebb03 +# Sun Mar 8 15:05:28 2020 +0100 - 3453485+daniel-ge@users.noreply.github.com - FIX: get length of generator + STY: Black +02991da67458b879d7c6360aa6457eb3c1bd5a07 +# Wed Mar 4 16:30:39 2020 -0500 - markiewicz@stanford.edu - STY: black d50c1858564c0b3073fb23c54886a0454cb66afa +# Thu Feb 27 15:08:42 2020 -0800 - code@oscaresteban.es - sty: black 417b8897a116fcded5000e21e2b6ccbe29452a52 +# Thu Jan 2 11:29:05 2020 -0800 - code@oscaresteban.es - sty: black aaf677a87f64c485f3e305799e4a5dc73b69e5fb +# Sun Dec 29 17:47:51 2019 -0800 - code@oscaresteban.es - sty: black f763008442d88d8ce00ec266698268389415f8d6 +# Thu Jan 2 11:29:05 2020 -0800 - code@oscaresteban.es - sty: black b1eccafd4edc8503b02d715f5b5f6f783520fdf9 +# Sun Dec 29 17:47:51 2019 -0800 - code@oscaresteban.es - sty: black 70db90349598cc7f26a4a513779529fba7d0a797 +# Thu Dec 19 09:22:22 2019 -0500 - markiewicz@stanford.edu - STY: Black 6c1d91d71f6f0db0e985bd2adc34206442b0653d +# Thu Dec 19 15:51:11 2019 -0500 - markiewicz@stanford.edu - STY: Black 97bdbd5f48ab242de5288ba4715192a27619a803 +# Fri Nov 15 14:38:10 2019 -0500 - steve@steventilley.com - run black 78fa360f5b785224349b8b85b07e510d2233bb63 +# Fri Nov 15 14:34:03 2019 -0500 - steve@steventilley.com - run black 7f85f43a34de8bff8e634232c939b17cee8e8fc5 +# Thu Nov 14 11:14:51 2019 -0500 - markiewicz@stanford.edu - Merge pull request #3096 from effigies/sty/black +1a869991adc024577536689d557fc748c764f15d +# Thu Nov 14 09:15:20 2019 -0500 - markiewicz@stanford.edu - STY: Black setup.py 9c50b5daa797def5672dd057155b0e2c658853e2 +# Thu Nov 14 09:14:38 2019 -0500 - markiewicz@stanford.edu - STY: Black for tools/ 47194993ae14aceeec436cfb3769def667196668 +# Wed Nov 13 23:41:15 2019 -0500 - markiewicz@stanford.edu - STY: Black 75653feadc6667d5313d83e9c62a5d5819771a9c +# Tue Nov 12 09:43:34 2019 -0500 - markiewicz@stanford.edu - STY: Black files pre-merge 497b44d680eee0892fa59c6aaaae22a17d70a536 diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000000..5768d7c636 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,19 @@ +--- +name: Codespell + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Codespell + uses: codespell-project/actions-codespell@v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d5a94ab940..fee8740987 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -105,13 +105,13 @@ jobs: depends: REQUIREMENTS deb-depends: true nipype-extras: doc,tests,profiler,duecredit,ssh - - os: ubuntu-20.04 - python-version: 3.8 - check: test - pip-flags: '' - depends: NUMPY123 - deb-depends: true - nipype-extras: doc,tests,nipy,profiler,duecredit,ssh + # - os: ubuntu-20.04 + # python-version: 3.8 + # check: test + # pip-flags: '' + # depends: NUMPY123 + # deb-depends: true + # nipype-extras: doc,tests,nipy,profiler,duecredit,ssh env: DEPENDS: ${{ matrix.depends }} CHECK_TYPE: ${{ matrix.check }} diff --git a/.gitignore b/.gitignore index f75fe9ef6e..b2556cb084 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,4 @@ __pycache__/ .ruby-version .pytest_cache .vscode/ -venv/ \ No newline at end of file +venv/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d5c5a4a51a..1336a23a2d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,13 +2,13 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.4.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 23.3.0 hooks: - id: black diff --git a/.zenodo.json b/.zenodo.json index c0a07b8327..283a171a82 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -116,15 +116,15 @@ { "name": "Yvernault, Benjamin" }, - { - "name": "Hamalainen, Carlo", - "orcid": "0000-0001-7655-3830" - }, { "affiliation": "Institute for Biomedical Engineering, ETH and University of Zurich", "name": "Christian, Horea", "orcid": "0000-0001-7037-2449" }, + { + "name": "Hamalainen, Carlo", + "orcid": "0000-0001-7655-3830" + }, { "affiliation": "Stanford University", "name": "Ćirić , Rastko", @@ -193,6 +193,9 @@ "name": "Dias, Maria de Fatima", "orcid": "0000-0001-8878-1750" }, + { + "name": "Moloney, Brendan" + }, { "affiliation": "Otto-von-Guericke-University Magdeburg, Germany", "name": "Hanke, Michael", @@ -202,9 +205,6 @@ "affiliation": "Child Mind Institute", "name": "Giavasis, Steven" }, - { - "name": "Moloney, Brendan" - }, { "affiliation": "SRI International", "name": "Nichols, B. Nolan", @@ -363,6 +363,11 @@ "name": "Schaefer, Alexander", "orcid": "0000-0001-6488-4739" }, + { + "affiliation": "CEA", + "name": "Papadopoulos Orfanos, Dimitri", + "orcid": "0000-0002-1242-8990" + }, { "affiliation": "UniversityHospital Heidelberg, Germany", "name": "Kleesiek, Jens" @@ -414,11 +419,6 @@ { "name": "Haselgrove, Christian" }, - { - "affiliation": "CEA", - "name": "Papadopoulos Orfanos, Dimitri", - "orcid": "0000-0002-1242-8990" - }, { "affiliation": "Department of Psychology, Stanford University; Parietal, INRIA", "name": "Durnez, Joke", @@ -895,6 +895,11 @@ "affiliation": "MIT, HMS", "name": "Ghosh, Satrajit", "orcid": "0000-0002-5312-6729" + }, + { + "affiliation": "University of Tübingen and MPI for Biological Cybernertics", + "name": "Bannert, Michael M.", + "orcid": "0000-0003-1010-7517" } ], "keywords": [ diff --git a/Makefile b/Makefile index 03c1152053..568d53379c 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,10 @@ PYTHON ?= python zipdoc: html zip documentation.zip doc/_build/html +.git-blame-ignore-revs: .git/HEAD + git log --grep "\[ignore-rev\]\|STY: black\|run black" -i --pretty=format:"# %ad - %ae - %s%n%H" > .git-blame-ignore-revs + echo >> .git-blame-ignore-revs + sdist: zipdoc @echo "Building source distribution..." $(PYTHON) setup.py sdist diff --git a/doc/changelog/0.X.X-changelog.rst b/doc/changelog/0.X.X-changelog.rst index 0c007cade7..8b779970d4 100644 --- a/doc/changelog/0.X.X-changelog.rst +++ b/doc/changelog/0.X.X-changelog.rst @@ -15,7 +15,7 @@ * ENH: Generate Dockerfiles with neurodocker (https://github.com/nipy/nipype/pull/2202) * ENH: FLAIR options for recon-all (https://github.com/nipy/nipype/pull/2279) * ENH: Config option for setting maxtasksperchild when multiprocessing (https://github.com/nipy/nipype/pull/2284) -* FIX: Testing maintainance and improvements (https://github.com/nipy/nipype/pull/2252) +* FIX: Testing maintenance and improvements (https://github.com/nipy/nipype/pull/2252) * ENH: Add elapsed_time and final metric_value to ants.Registration (https://github.com/nipy/nipype/pull/1985) * ENH: Improve terminal_output feature (https://github.com/nipy/nipype/pull/2209) * ENH: Simple interface to FSL std2imgcoords (https://github.com/nipy/nipype/pull/2209, prev #1398) @@ -39,7 +39,7 @@ * ENH: Add cosine-basis high-pass-filter to CompCor, allow skip of initial volumes (https://github.com/nipy/nipype/pull/2107, https://github.com/nipy/nipype/pull/#2122) * FIX: Catch more dcm2niix DTI conversions (https://github.com/nipy/nipype/pull/2110) * FIX: Retrieve aseg + wmparc stats properly (https://github.com/nipy/nipype/pull/2117) -* ENH: ANTs MeasureImageSimilarity Inteface (https://github.com/nipy/nipype/pull/2128) +* ENH: ANTs MeasureImageSimilarity Interface (https://github.com/nipy/nipype/pull/2128) * FIX: CompCor filter_basis of correct size, pre-filter column headers (https://github.com/nipy/nipype/pull/2136, https://github.com/nipy/nipype/pull/2138) * ENH: FreeSurfer lta_convert and mri_coreg interfaces (https://github.com/nipy/nipype/pull/2140, https://github.com/nipy/nipype/pull/2172) * ENH: Speed up S3DataGrabber (https://github.com/nipy/nipype/pull/2143) @@ -311,16 +311,16 @@ Release 0.11.0 (September 15, 2015) Release 0.10.0 (October 10, 2014) ================================= -* ENH: New miscelaneous interfaces: SplitROIs (mapper), MergeROIs (reducer) +* ENH: New miscellaneous interfaces: SplitROIs (mapper), MergeROIs (reducer) to enable parallel processing of very large images. * ENH: Updated FSL interfaces: BEDPOSTX and XFibres, former interfaces are still available with the version suffix: BEDPOSTX4 and XFibres4. Added gpu versions of BEDPOSTX: BEDPOSTXGPU, BEDPOSTX5GPU, and BEDPOSTX4GPU -* ENH: Added experimental support for MIPAV algorithms thorugh JIST plugins +* ENH: Added experimental support for MIPAV algorithms through JIST plugins * ENH: New dipy interfaces: Denoise, Resample * ENH: New Freesurfer interfaces: Tkregister2 (for conversion of fsl style matrices to freesurfer format), MRIPretess * ENH: New FSL interfaces: WarpPoints, WarpPointsToStd, EpiReg, ProbTrackX2, WarpUtils, ConvertWarp -* ENH: New miscelaneous interfaces: AddCSVRow, NormalizeProbabilityMapSet, AddNoise +* ENH: New miscellaneous interfaces: AddCSVRow, NormalizeProbabilityMapSet, AddNoise * ENH: New AFNI interfaces: Eval, Means, SVMTest, SVMTrain * ENH: FUGUE interface has been refactored to use the name_template system, 3 examples added to doctests, some bugs solved. @@ -510,7 +510,7 @@ Release 0.5 (Mar 10, 2012) * API: By default inputs are removed from Node working directory * API: InterfaceResult class is now versioned and stores class type not instance * API: Added FIRST interface -* API: Added max_jobs paramter to plugin_args. limits the number of jobs +* API: Added max_jobs parameter to plugin_args. limits the number of jobs executing at any given point in time * API: crashdump_dir is now a config execution option * API: new config execution options for controlling hash checking, execution and diff --git a/doc/changelog/1.X.X-changelog.rst b/doc/changelog/1.X.X-changelog.rst index f6a9233f5e..f1d6bc92d3 100644 --- a/doc/changelog/1.X.X-changelog.rst +++ b/doc/changelog/1.X.X-changelog.rst @@ -1,3 +1,20 @@ +1.8.6 (April 05, 2023) +====================== + +Bug-fix release in the 1.8.x series. + + * FIX: Update dcmstack interface for Py3 / newer pydicom (https://github.com/nipy/nipype/pull/3541) + * FIX: NiBabel 5, and NetworkX 3 and DIPY 1.6 compatibility (https://github.com/nipy/nipype/pull/3538) + * FIX: Check for non-mandatory output in DWIBiasCorrect (https://github.com/nipy/nipype/pull/3523) + * FIX: Removed leftover debug print statement in FEAT class (https://github.com/nipy/nipype/pull/3521) + * DOC: Fix a few more typos (https://github.com/nipy/nipype/pull/3516) + * DOC: Fix typos found by codespell (https://github.com/nipy/nipype/pull/3512) + * CI: Drop nipy tests until a fixed nipy is released (https://github.com/nipy/nipype/pull/3559) + * CI: Disable nipy tests generally, re-add with max numpy (https://github.com/nipy/nipype/pull/3532) + * CI: GitHub Workflows security hardening (https://github.com/nipy/nipype/pull/3519) + * CI: Allow tutorial test cancellation (https://github.com/nipy/nipype/pull/3514) + + 1.8.5 (September 21, 2022) ========================== @@ -426,7 +443,7 @@ Python 1.2.3 will be the last version to support Python 3.4. * FIX: ANTS LaplacianThickness cmdline opts fixed up (https://github.com/nipy/nipype/pull/2846) * FIX: Resolve LinAlgError during SVD (https://github.com/nipy/nipype/pull/2838) - * ENH: Add interfaces wrapping DIPY worflows (https://github.com/nipy/nipype/pull/2830) + * ENH: Add interfaces wrapping DIPY workflows (https://github.com/nipy/nipype/pull/2830) * ENH: Update BIDSDataGrabber for pybids 0.7 (https://github.com/nipy/nipype/pull/2737) * ENH: Add FSL `eddy_quad` interface (https://github.com/nipy/nipype/pull/2825) * ENH: Support tckgen -select in MRtrix3 v3+ (https://github.com/nipy/nipype/pull/2823) diff --git a/doc/interfaces.rst b/doc/interfaces.rst index e9fe73f562..e7b9dca2f4 100644 --- a/doc/interfaces.rst +++ b/doc/interfaces.rst @@ -8,7 +8,7 @@ Interfaces and Workflows :Release: |version| :Date: |today| -Previous versions: `1.8.5 `_ `1.8.4 `_ +Previous versions: `1.8.6 `_ `1.8.5 `_ Workflows --------- diff --git a/nipype/__init__.py b/nipype/__init__.py index 06084e823a..09728b62d1 100644 --- a/nipype/__init__.py +++ b/nipype/__init__.py @@ -13,7 +13,7 @@ """ import os -# XXX Deprecate this import +# No longer used internally but could be used externally. from looseversion import LooseVersion from .info import URL as __url__, STATUS as __status__, __version__ diff --git a/nipype/algorithms/icc.py b/nipype/algorithms/icc.py index 38f56d6541..8e5c6b150c 100644 --- a/nipype/algorithms/icc.py +++ b/nipype/algorithms/icc.py @@ -150,8 +150,8 @@ def ICC_rep_anova(Y, projection_matrix=None): SSR = SST - SSC - SSE MSR = SSR / dfr - # ICC(3,1) = (mean square subjeT - mean square error) / - # (mean square subjeT + (k-1)*-mean square error) + # ICC(3,1) = (mean square subject - mean square error) / + # (mean square subject + (k-1)*-mean square error) ICC = (MSR - MSE) / (MSR + dfc * MSE) e_var = MSE # variance of error diff --git a/nipype/info.py b/nipype/info.py index a7ea648c3d..b6e6245511 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -5,7 +5,7 @@ # nipype version information # Remove .dev0 for release -__version__ = "1.8.6.dev0" +__version__ = "1.8.7.dev0" def get_nipype_gitversion(): diff --git a/nipype/interfaces/afni/base.py b/nipype/interfaces/afni/base.py index 28dc1dc410..e3b910f8c5 100644 --- a/nipype/interfaces/afni/base.py +++ b/nipype/interfaces/afni/base.py @@ -6,7 +6,9 @@ from sys import platform import shutil -from ... import logging, LooseVersion +from looseversion import LooseVersion + +from ... import logging from ...utils.filemanip import split_filename, fname_presuffix from ..base import ( CommandLine, diff --git a/nipype/interfaces/ants/registration.py b/nipype/interfaces/ants/registration.py index cd2145b8d5..4b870b53ab 100644 --- a/nipype/interfaces/ants/registration.py +++ b/nipype/interfaces/ants/registration.py @@ -865,7 +865,7 @@ class Registration(ANTSCommand): --write-composite-transform 0' One can use multiple similarity metrics in a single registration stage.The Node below first - performs a linear registation using only the Mutual Information ('Mattes')-metric. + performs a linear registration using only the Mutual Information ('Mattes')-metric. In a second stage, it performs a non-linear registration ('Syn') using both a Mutual Information and a local cross-correlation ('CC')-metric. Both metrics are weighted equally ('metric_weight' is .5 for both). The Mutual Information- metric uses 32 bins. diff --git a/nipype/interfaces/ants/segmentation.py b/nipype/interfaces/ants/segmentation.py index 9467c4086f..8af76d95b9 100644 --- a/nipype/interfaces/ants/segmentation.py +++ b/nipype/interfaces/ants/segmentation.py @@ -1009,10 +1009,10 @@ def _run_interface(self, runtime, correct_return_codes=(0,)): runtime = super(BrainExtraction, self)._run_interface(runtime) # Still, double-check if it didn't found N4 - if "we cant find" in runtime.stdout: + if "we can't find" in runtime.stdout: for line in runtime.stdout.split("\n"): - if line.strip().startswith("we cant find"): - tool = line.strip().replace("we cant find the", "").split(" ")[0] + if line.strip().startswith("we can't find"): + tool = line.strip().replace("we can't find the", "").split(" ")[0] break errmsg = ( diff --git a/nipype/interfaces/base/core.py b/nipype/interfaces/base/core.py index 81da68be00..fd2e2c54ca 100644 --- a/nipype/interfaces/base/core.py +++ b/nipype/interfaces/base/core.py @@ -16,7 +16,9 @@ import simplejson as json from traits.trait_errors import TraitError -from ... import config, logging, LooseVersion +from looseversion import LooseVersion + +from ... import config, logging from ...utils.provenance import write_provenance from ...utils.misc import str2bool from ...utils.filemanip import ( diff --git a/nipype/interfaces/base/specs.py b/nipype/interfaces/base/specs.py index 5c92c7ec69..01ef126abb 100644 --- a/nipype/interfaces/base/specs.py +++ b/nipype/interfaces/base/specs.py @@ -177,7 +177,7 @@ def get_traitsfree(self, **kwargs): return out def _clean_container(self, objekt, undefinedval=None, skipundefined=False): - """Convert a traited obejct into a pure python representation.""" + """Convert a traited object into a pure python representation.""" if isinstance(objekt, TraitDictObject) or isinstance(objekt, dict): out = {} for key, val in list(objekt.items()): diff --git a/nipype/interfaces/base/tests/test_core.py b/nipype/interfaces/base/tests/test_core.py index cdfef51193..0c3f5a8dc1 100644 --- a/nipype/interfaces/base/tests/test_core.py +++ b/nipype/interfaces/base/tests/test_core.py @@ -288,28 +288,28 @@ class WithoutInput(WithInput): _version = "0.6" has = WithInput() - hasnt = WithoutInput() + hasnot = WithoutInput() trying_anyway = WithoutInput(foo=3) assert has.inputs.foo == 3 - assert not nib.isdefined(hasnt.inputs.foo) + assert not nib.isdefined(hasnot.inputs.foo) assert trying_anyway.inputs.foo == 3 has.run() - hasnt.run() + hasnot.run() with pytest.raises(Exception): trying_anyway.run() # Still settable has.inputs.foo = 4 - hasnt.inputs.foo = 4 + hasnot.inputs.foo = 4 trying_anyway.inputs.foo = 4 assert has.inputs.foo == 4 - assert hasnt.inputs.foo == 4 + assert hasnot.inputs.foo == 4 assert trying_anyway.inputs.foo == 4 has.run() with pytest.raises(Exception): - hasnt.run() + hasnot.run() with pytest.raises(Exception): trying_anyway.run() diff --git a/nipype/interfaces/cmtk/nx.py b/nipype/interfaces/cmtk/nx.py index 991ca89dcf..15449515f4 100644 --- a/nipype/interfaces/cmtk/nx.py +++ b/nipype/interfaces/cmtk/nx.py @@ -542,8 +542,8 @@ def _run_interface(self, runtime): "Saving extra measure file to %s in Pickle format", op.abspath(out_pickled_extra_measures), ) - with open(out_pickled_extra_measures, "w") as fo: - pickle.dump(dict_measures, fo) + with open(out_pickled_extra_measures, "w") as f: + pickle.dump(dict_measures, f) iflogger.info("Saving MATLAB measures as %s", matlab) diff --git a/nipype/interfaces/freesurfer/base.py b/nipype/interfaces/freesurfer/base.py index 9527e97192..6e9bb5942d 100644 --- a/nipype/interfaces/freesurfer/base.py +++ b/nipype/interfaces/freesurfer/base.py @@ -16,7 +16,8 @@ """ import os -from ... import LooseVersion +from looseversion import LooseVersion + from ...utils.filemanip import fname_presuffix from ..base import ( CommandLine, diff --git a/nipype/interfaces/freesurfer/longitudinal.py b/nipype/interfaces/freesurfer/longitudinal.py index 5c3f621e87..086d0a96c8 100644 --- a/nipype/interfaces/freesurfer/longitudinal.py +++ b/nipype/interfaces/freesurfer/longitudinal.py @@ -73,7 +73,7 @@ class RobustTemplateInputSpec(FSTraitedSpecOpenMP): ) initial_timepoint = traits.Int( argstr="--inittp %d", - desc="use TP# for spacial init (default random), 0: no init", + desc="use TP# for special init (default random), 0: no init", ) fixed_timepoint = traits.Bool( default_value=False, diff --git a/nipype/interfaces/freesurfer/petsurfer.py b/nipype/interfaces/freesurfer/petsurfer.py index 33602d2711..272cba6e21 100644 --- a/nipype/interfaces/freesurfer/petsurfer.py +++ b/nipype/interfaces/freesurfer/petsurfer.py @@ -557,7 +557,7 @@ def _list_outputs(self): outputs["rbv"] = os.path.join(pvcdir, "rbv.nii.gz") outputs["reg_rbvpet2anat"] = os.path.join(pvcdir, "aux", "rbv2anat.lta") outputs["reg_anat2rbvpet"] = os.path.join(pvcdir, "aux", "anat2rbv.lta") - if self.inputs.opt: + if self.inputs.optimization_schema: outputs["opt_params"] = os.path.join(pvcdir, "aux", "opt.params.dat") return outputs diff --git a/nipype/interfaces/freesurfer/preprocess.py b/nipype/interfaces/freesurfer/preprocess.py index ccf783a1e3..6970a70ce5 100644 --- a/nipype/interfaces/freesurfer/preprocess.py +++ b/nipype/interfaces/freesurfer/preprocess.py @@ -9,10 +9,11 @@ import shutil import sys +from looseversion import LooseVersion import numpy as np from nibabel import load -from ... import logging, LooseVersion +from ... import logging from ...utils.filemanip import fname_presuffix, check_depends from ..io import FreeSurferSource from ..base import ( diff --git a/nipype/interfaces/freesurfer/tests/test_preprocess.py b/nipype/interfaces/freesurfer/tests/test_preprocess.py index 9743f7bf95..00df9393b6 100644 --- a/nipype/interfaces/freesurfer/tests/test_preprocess.py +++ b/nipype/interfaces/freesurfer/tests/test_preprocess.py @@ -4,11 +4,11 @@ import os import pytest -from nipype.testing.fixtures import create_files_in_directory +from looseversion import LooseVersion +from nipype.testing.fixtures import create_files_in_directory from nipype.interfaces import freesurfer from nipype.interfaces.freesurfer import Info -from nipype import LooseVersion @pytest.mark.skipif(freesurfer.no_freesurfer(), reason="freesurfer is not installed") diff --git a/nipype/interfaces/fsl/dti.py b/nipype/interfaces/fsl/dti.py index 60f0d8128d..7253b7023b 100644 --- a/nipype/interfaces/fsl/dti.py +++ b/nipype/interfaces/fsl/dti.py @@ -673,8 +673,8 @@ class ProbTrackXBaseInputSpec(FSLCommandInputSpec): c_thresh = traits.Float( argstr="--cthr=%.3f", desc="curvature threshold - default=0.2" ) - sample_random_points = traits.Bool( - argstr="--sampvox", desc=("sample random points within " "seed voxels") + sample_random_points = traits.Float( + argstr="--sampvox=%.3f", desc=("sample random points within " "seed voxels") ) step_length = traits.Float( argstr="--steplength=%.3f", desc="step_length in mm - default=0.5" @@ -713,7 +713,7 @@ class ProbTrackXBaseInputSpec(FSLCommandInputSpec): ), ) mod_euler = traits.Bool(argstr="--modeuler", desc="use modified euler streamlining") - random_seed = traits.Bool(argstr="--rseed", desc="random seed") + random_seed = traits.Int(argstr="--rseed=%d", desc="random seed") s2tastext = traits.Bool( argstr="--s2tastext", desc=( diff --git a/nipype/interfaces/fsl/epi.py b/nipype/interfaces/fsl/epi.py index 99ba0fce0b..26ce76ca4a 100644 --- a/nipype/interfaces/fsl/epi.py +++ b/nipype/interfaces/fsl/epi.py @@ -851,12 +851,6 @@ class EddyOutputSpec(TraitedSpec): "between the different shells as estimated by a " "post-hoc mutual information based registration", ) - out_shell_pe_translation_parameters = File( - exists=True, - desc="Text file containing translation along the PE-direction " - "between the different shells as estimated by a " - "post-hoc mutual information based registration", - ) out_outlier_map = File( exists=True, desc="Matrix where rows represent volumes and columns represent " diff --git a/nipype/interfaces/fsl/model.py b/nipype/interfaces/fsl/model.py index 50485bac2e..24adb907cf 100644 --- a/nipype/interfaces/fsl/model.py +++ b/nipype/interfaces/fsl/model.py @@ -11,9 +11,9 @@ from string import Template import numpy as np +from looseversion import LooseVersion from nibabel import load -from ... import LooseVersion from ...utils.filemanip import simplify_list, ensure_list from ...utils.misc import human_order_sorted from ...external.due import BibTeX @@ -2026,7 +2026,7 @@ class ClusterInputSpec(FSLCommandInputSpec): argstr="--stdvol=%s", desc="filename for standard-space volume" ) num_maxima = traits.Int(argstr="--num=%d", desc="no of local maxima to report") - warpfield_file = File(argstr="--warpvol=%s", desc="file contining warpfield") + warpfield_file = File(argstr="--warpvol=%s", desc="file containing warpfield") class ClusterOutputSpec(TraitedSpec): diff --git a/nipype/interfaces/fsl/preprocess.py b/nipype/interfaces/fsl/preprocess.py index 80ef25534a..8899c6f975 100644 --- a/nipype/interfaces/fsl/preprocess.py +++ b/nipype/interfaces/fsl/preprocess.py @@ -11,8 +11,8 @@ import numpy as np from nibabel import load +from looseversion import LooseVersion -from ... import LooseVersion from ...utils.filemanip import split_filename from ..base import ( TraitedSpec, @@ -376,12 +376,12 @@ class FAST(FSLCommand): Examples -------- >>> from nipype.interfaces import fsl - >>> fastr = fsl.FAST() - >>> fastr.inputs.in_files = 'structural.nii' - >>> fastr.inputs.out_basename = 'fast_' - >>> fastr.cmdline + >>> fast = fsl.FAST() + >>> fast.inputs.in_files = 'structural.nii' + >>> fast.inputs.out_basename = 'fast_' + >>> fast.cmdline 'fast -o fast_ -S 1 structural.nii' - >>> out = fastr.run() # doctest: +SKIP + >>> out = fast.run() # doctest: +SKIP """ diff --git a/nipype/interfaces/image.py b/nipype/interfaces/image.py index 8ea33647c5..1535b1baf8 100644 --- a/nipype/interfaces/image.py +++ b/nipype/interfaces/image.py @@ -4,7 +4,8 @@ from ..utils.filemanip import fname_presuffix from .base import SimpleInterface, TraitedSpec, BaseInterfaceInputSpec, traits, File -from .. import LooseVersion + +from looseversion import LooseVersion class RescaleInputSpec(BaseInterfaceInputSpec): diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index 09919e8607..4f6e455959 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -1678,7 +1678,7 @@ class FSSourceOutputSpec(TraitedSpec): File(exists=True), desc="Inflated surface meshes", loc="surf" ) pial = OutputMultiPath( - File(exists=True), desc="Gray matter/pia mater surface meshes", loc="surf" + File(exists=True), desc="Gray matter/pia matter surface meshes", loc="surf" ) area_pial = OutputMultiPath( File(exists=True), diff --git a/nipype/interfaces/mrtrix/tracking.py b/nipype/interfaces/mrtrix/tracking.py index 4619740fc2..4624d2c780 100644 --- a/nipype/interfaces/mrtrix/tracking.py +++ b/nipype/interfaces/mrtrix/tracking.py @@ -388,14 +388,14 @@ class StreamlineTrack(CommandLine): ------- >>> import nipype.interfaces.mrtrix as mrt - >>> strack = mrt.StreamlineTrack() - >>> strack.inputs.inputmodel = 'SD_PROB' - >>> strack.inputs.in_file = 'data.Bfloat' - >>> strack.inputs.seed_file = 'seed_mask.nii' - >>> strack.inputs.mask_file = 'mask.nii' - >>> strack.cmdline + >>> streamtrack = mrt.StreamlineTrack() + >>> streamtrack.inputs.inputmodel = 'SD_PROB' + >>> streamtrack.inputs.in_file = 'data.Bfloat' + >>> streamtrack.inputs.seed_file = 'seed_mask.nii' + >>> streamtrack.inputs.mask_file = 'mask.nii' + >>> streamtrack.cmdline 'streamtrack -mask mask.nii -seed seed_mask.nii SD_PROB data.Bfloat data_tracked.tck' - >>> strack.run() # doctest: +SKIP + >>> streamtrack.run() # doctest: +SKIP """ _cmd = "streamtrack" @@ -423,10 +423,10 @@ class DiffusionTensorStreamlineTrack(StreamlineTrack): ------- >>> import nipype.interfaces.mrtrix as mrt - >>> dtstrack = mrt.DiffusionTensorStreamlineTrack() - >>> dtstrack.inputs.in_file = 'data.Bfloat' - >>> dtstrack.inputs.seed_file = 'seed_mask.nii' - >>> dtstrack.run() # doctest: +SKIP + >>> dtstreamtrack = mrt.DiffusionTensorStreamlineTrack() + >>> dtstreamtrack.inputs.in_file = 'data.Bfloat' + >>> dtstreamtrack.inputs.seed_file = 'seed_mask.nii' + >>> dtstreamtrack.run() # doctest: +SKIP """ input_spec = DiffusionTensorStreamlineTrackInputSpec diff --git a/nipype/interfaces/mrtrix3/base.py b/nipype/interfaces/mrtrix3/base.py index af96b5a9f3..1a0ad94c4d 100644 --- a/nipype/interfaces/mrtrix3/base.py +++ b/nipype/interfaces/mrtrix3/base.py @@ -2,7 +2,9 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -from ... import logging, LooseVersion +from looseversion import LooseVersion + +from ... import logging from ...utils.filemanip import which from ..base import ( CommandLineInputSpec, diff --git a/nipype/interfaces/nipy/base.py b/nipype/interfaces/nipy/base.py index 0991730e81..2d742d3e90 100644 --- a/nipype/interfaces/nipy/base.py +++ b/nipype/interfaces/nipy/base.py @@ -12,7 +12,7 @@ have_nipy = True try: package_check("nipy") -except ImportError: +except: have_nipy = False diff --git a/nipype/interfaces/spm/model.py b/nipype/interfaces/spm/model.py index 0c2eece0d5..68a2484c86 100644 --- a/nipype/interfaces/spm/model.py +++ b/nipype/interfaces/spm/model.py @@ -586,6 +586,16 @@ class ThresholdInputSpec(SPMCommandInputSpec): "set to p-value)" ), ) + use_vox_fdr_correction = traits.Bool( + False, + usedefault=True, + desc=( + "whether to use voxel-based FDR " + "correction for initial threshold " + "(height_threshold_type has to be " + "set to q-value)" + ), + ) use_topo_fdr = traits.Bool( True, usedefault=True, @@ -661,8 +671,16 @@ def _gen_pre_topo_map_filename(self): def _make_matlab_command(self, _): script = "con_index = %d;\n" % self.inputs.contrast_index script += "cluster_forming_thr = %f;\n" % self.inputs.height_threshold - if self.inputs.use_fwe_correction: + + if self.inputs.use_fwe_correction and self.inputs.use_vox_fdr_correction: + raise ValueError( + "'use_fwe_correction' and 'use_vox_fdr_correction' can't both be True" + ) + + if self.inputs.use_fwe_correction and not self.inputs.use_vox_fdr_correction: script += "thresDesc = 'FWE';\n" + elif self.inputs.use_vox_fdr_correction and not self.inputs.use_fwe_correction: + script += "thresDesc = 'FDR';\n" else: script += "thresDesc = 'none';\n" @@ -687,6 +705,8 @@ def _make_matlab_command(self, _): FWHM = SPM.xVol.FWHM; df = [SPM.xCon(con_index).eidf SPM.xX.erdf]; STAT = SPM.xCon(con_index).STAT; +VspmSv = cat(1,SPM.xCon(con_index).Vspm); + R = SPM.xVol.R; S = SPM.xVol.S; n = 1; @@ -695,6 +715,9 @@ def _make_matlab_command(self, _): case 'FWE' cluster_forming_thr = spm_uc(cluster_forming_thr,df,STAT,R,n,S); + case 'FDR' + cluster_forming_thr = spm_uc_FDR(cluster_forming_thr,df,STAT,n,VspmSv,0); + case 'none' if strcmp(height_threshold_type, 'p-value') cluster_forming_thr = spm_u(cluster_forming_thr^(1/n),df,STAT); diff --git a/nipype/interfaces/spm/tests/test_auto_Threshold.py b/nipype/interfaces/spm/tests/test_auto_Threshold.py index 470ae7f2d1..128ab0586c 100644 --- a/nipype/interfaces/spm/tests/test_auto_Threshold.py +++ b/nipype/interfaces/spm/tests/test_auto_Threshold.py @@ -48,6 +48,9 @@ def test_Threshold_inputs(): min_ver="8", usedefault=True, ), + use_vox_fdr_correction=dict( + usedefault=True, + ), ) inputs = Threshold.input_spec() diff --git a/nipype/interfaces/spm/tests/test_utils.py b/nipype/interfaces/spm/tests/test_utils.py index 1afc887b06..c41a0da966 100644 --- a/nipype/interfaces/spm/tests/test_utils.py +++ b/nipype/interfaces/spm/tests/test_utils.py @@ -23,7 +23,7 @@ def test_coreg(): _, tgt, _ = split_filename(target) mat = os.path.join(pth, "%s_to_%s.mat" % (mov, tgt)) invmat = fname_presuffix(mat, prefix="inverse_") - scrpt = coreg._make_matlab_command(None) + script = coreg._make_matlab_command(None) assert coreg.inputs.mat == mat assert coreg.inputs.invmat == invmat @@ -35,11 +35,11 @@ def test_apply_transform(): assert applymat.inputs.matlab_cmd == "mymatlab" applymat.inputs.in_file = moving applymat.inputs.mat = mat - scrpt = applymat._make_matlab_command(None) + script = applymat._make_matlab_command(None) expected = "[p n e v] = spm_fileparts(V.fname);" - assert expected in scrpt + assert expected in script expected = "V.mat = transform.M * V.mat;" - assert expected in scrpt + assert expected in script def test_reslice(): diff --git a/nipype/interfaces/tests/test_image.py b/nipype/interfaces/tests/test_image.py index d1ed2578a6..43e0cd0648 100644 --- a/nipype/interfaces/tests/test_image.py +++ b/nipype/interfaces/tests/test_image.py @@ -4,10 +4,10 @@ import nibabel as nb import pytest +from looseversion import LooseVersion from nibabel.orientations import axcodes2ornt, ornt_transform from ..image import _as_reoriented_backport, _orientations -from ... import LooseVersion nibabel24 = LooseVersion(nb.__version__) >= LooseVersion("2.4.0") diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index 2df5c9dad8..f460a203b7 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -707,10 +707,10 @@ def _mock_get_ssh_client(self): def test_ExportFile(tmp_path): - testin = tmp_path / "in.txt" - testin.write_text("test string", encoding='utf-8') + test_in = tmp_path / "in.txt" + test_in.write_text("test string", encoding='utf-8') i = nio.ExportFile() - i.inputs.in_file = str(testin) + i.inputs.in_file = str(test_in) i.inputs.out_file = str(tmp_path / "out.tsv") i.inputs.check_extension = True with pytest.raises(RuntimeError): diff --git a/nipype/sphinxext/plot_workflow.py b/nipype/sphinxext/plot_workflow.py index 6765046d05..a61a29c5ad 100644 --- a/nipype/sphinxext/plot_workflow.py +++ b/nipype/sphinxext/plot_workflow.py @@ -273,7 +273,7 @@ def run(self): else: function_name = None - with io.open(source_file_name, "r", encoding="utf-8") as fd: + with open(source_file_name, "r", encoding="utf-8") as fd: code = fd.read() output_base = os.path.basename(source_file_name) else: @@ -438,7 +438,7 @@ def run(self): # copy script (if necessary) target_name = os.path.join(dest_dir, output_base + source_ext) - with io.open(target_name, "w", encoding="utf-8") as f: + with open(target_name, "w", encoding="utf-8") as f: if source_file_name == rst_file: code_escaped = unescape_doctest(code) else: diff --git a/nipype/utils/profiler.py b/nipype/utils/profiler.py index 2179b29db6..d83b745df5 100644 --- a/nipype/utils/profiler.py +++ b/nipype/utils/profiler.py @@ -44,7 +44,7 @@ def stop(self): class ResourceMonitor(threading.Thread): """ - A ``Thread`` to monitor a specific PID with a certain frequence + A ``Thread`` to monitor a specific PID with a certain frequency to a file """ diff --git a/tools/ex2rst b/tools/ex2rst index 82653f80e5..1b19ce8726 100755 --- a/tools/ex2rst +++ b/tools/ex2rst @@ -98,7 +98,7 @@ def exfile2rst(filename): proc_line = None # handle doc start if not indocs: - # guarenteed to start with """ + # guaranteed to start with """ if len(cleanline) > 3 \ and (cleanline.endswith('"""') \ or cleanline.endswith("'''")):