Skip to content

Commit

Permalink
Merge pull request #408 from nipreps/enh/improve-standalone-cli
Browse files Browse the repository at this point in the history
ENH: Standalone CLI now estimates fieldmaps
  • Loading branch information
oesteban authored Dec 6, 2023
2 parents ee5b805 + a682abe commit f8f35d7
Show file tree
Hide file tree
Showing 22 changed files with 1,636 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ jobs:
python -m venv /tmp/venv
source /tmp/venv/bin/activate
python -m pip install -U build hatch hatchling pip twine docutils
python -m pip install --no-cache-dir -r docs/requirements.txt
python -m pip install .[docs]
- run:
name: Build only this commit
command: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
python-version: 3
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Build niworkflows
- name: Build sdcflows
run: pipx run build
- name: Check distributions
run: pipx run twine check dist/*
Expand All @@ -78,7 +78,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.12"]
python-version: ["3.9", "3.12"]
install: [repo, sdist, wheel, editable]

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/cache@v3
Expand Down
3 changes: 2 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINX_APIDOC_OPTIONS = members,show-inheritance
PAPER =
BUILDDIR = _build
OUTDIR = html
Expand Down Expand Up @@ -57,7 +58,7 @@ docs-coverage:
PYTHONPATH=$(PYTHONPATH) $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage

html:
PYTHONPATH=$(PYTHONPATH) $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/$(OUTDIR)
PYTHONPATH=$(PYTHONPATH) SPHINX_APIDOC_OPTIONS=$(SPHINX_APIDOC_OPTIONS) $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/$(OUTDIR)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/$(OUTDIR)."

Expand Down
53 changes: 53 additions & 0 deletions docs/_static/config-example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[environment]
cpu_count = 36
exec_env = "posix"
free_mem = 13.7
overcommit_policy = "heuristic"
overcommit_limit = "50%"
nipype_version = "1.8.7.dev0"
templateflow_version = "23.0.0"
total_memory = 62.51573181152344
version = "2.6.1.dev5+gaa86b0b08f.d20231128"

[execution]
ants_float = false
bids_dir = "/data/datasets/hcph"
bids_database_dir = "/data/datasets/hcph/.bids-index"
bids_database_wipe = false
cwd = "/home/oesteban/tmp/sdcflows-hcph"
debug = false
dry_run = false
layout = "BIDS Layout: .../data/datasets/hcph | Subjects: 1 | Sessions: 59 | Runs: 4"
log_dir = "/home/oesteban/tmp/sdcflows-hcph/out/logs"
log_level = 15
notrack = false
output_dir = "/home/oesteban/tmp/sdcflows-hcph/out"
participant_label = [ "001",]
pdb = false
run_uuid = "20231129-112254_e9d6d38e-35ff-463e-9f7e-1ff15ecd54ac"
templateflow_home = "/data/templateflow"
work_dir = "/home/oesteban/tmp/sdcflows-hcph/work"
write_graph = false

[workflow]
analysis_level = [ "participant",]
fmapless = false
species = "human"
template_id = "MNI152NLin2009cAsym"

[nipype]
crashfile_format = "txt"
get_linked_libs = false
local_hash_check = true
nprocs = 8
omp_nthreads = 16
plugin = "MultiProc"
remove_node_directories = false
resource_monitor = false
stop_on_first_crash = true

[execution.bids_filters]

[nipype.plugin_args]
maxtasksperchild = 1
raise_insufficient = false
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Information on specific functions, classes, and methods.
:glob:

api/sdcflows.cli
api/sdcflows.config
api/sdcflows.data
api/sdcflows.fieldmaps
api/sdcflows.interfaces
Expand Down
8 changes: 8 additions & 0 deletions docs/cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Standalone command line usage
=============================
*SDCFlows* can execute fieldmap estimation from a BIDS-compliant dataset by using the *standalone command line interface*:

.. argparse::
:module: sdcflows.cli.parser
:func: _parser
:prog: sdcflows
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinxarg.ext",
"sphinxcontrib.apidoc",
"nbsphinx",
"nipype.sphinxext.apidoc",
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Contents
installation
examples
methods
cli
api
changes
5 changes: 3 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ matplotlib >= 2.2.0
nbsphinx
nibabel
nipype >= 1.5.1
niworkflows ~= 1.6.3
niworkflows >= 1.7.0
numpy
packaging
pandoc
pydot >= 1.2.3
pydotplus
scipy
sphinx >= 7.2.2
sphinx-argparse
sphinxcontrib-apidoc
templateflow
traits < 6.4
traits < 6.4
21 changes: 15 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,27 @@ classifiers = [
"Topic :: Scientific/Engineering :: Image Recognition",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
license = "Apache-2.0"
requires-python = ">=3.10"
requires-python = ">=3.9"
dependencies = [
"attrs >= 20.1.0",
"nibabel >=3.1.0",
"nipype >=1.8.5,<2.0",
"traits <6.4",
"migas >= 0.4.0",
"niworkflows >= 1.7.0",
"nitransforms >= 23.0.1",
"numpy >= 1.21.0",
"pybids >= 0.15.1",
"pybids >= 0.16.4",
"scikit-image >= 0.18",
"scipy >= 1.8.1",
"templateflow",
"toml",
]
dynamic = ["version"]

Expand All @@ -44,18 +47,24 @@ doc = [
"attrs >= 20.1.0",
"furo",
"importlib_resources",
"ipykernel",
"ipython",
"matplotlib >= 2.2.0",
"nbsphinx",
"nibabel",
"nipype >= 1.5.1",
"traits < 6.4",
"niworkflows >= 1.7.0",
"niworkflows @ git+https://github.com/nipreps/niworkflows.git@master",
"numpy",
"packaging",
"pandoc",
"pydot >= 1.2.3",
"pydotplus",
"scipy",
"sphinx >= 7.2.2",
"sphinx-argparse",
"sphinxcontrib-apidoc",
"templateflow"
"templateflow",
"traits < 6.4"
]

mem = [
Expand Down Expand Up @@ -83,7 +92,7 @@ tests = ["sdcflows[test]"]
all = ["sdcflows[doc,test,mem,dev,test]"]

[project.scripts]
sdcflows-find-estimators = "sdcflows.cli.find_estimators:main"
sdcflows = "sdcflows.cli.main:main"

#
# Hatch configurations
Expand Down
49 changes: 49 additions & 0 deletions sdcflows/_warnings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2023 The NiPreps Developers <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# We support and encourage derived works from this project, please read
# about our expectations at
#
# https://www.nipreps.org/community/licensing/
#
# STATEMENT OF CHANGES: This file is derived from sources licensed under the Apache-2.0 terms,
# and this file has been changed.
# The original file this work derives from is found at:
# https://github.com/nipreps/mriqc/blob/8ceadba8669cc2a86119a97b9311ab968f11c6eb/mriqc/_warnings.py
"""Manipulate Python warnings."""
import logging
import warnings

_wlog = logging.getLogger("py.warnings")
_wlog.addHandler(logging.NullHandler())


def _warn(message, category=None, stacklevel=1, source=None):
"""Redefine the warning function."""
if category is not None:
category = type(category).__name__
category = category.replace("type", "WARNING")

logging.getLogger("py.warnings").warning(f"{category or 'WARNING'}: {message}")


def _showwarning(message, category, filename, lineno, file=None, line=None):
_warn(message, category=category)


warnings.warn = _warn
warnings.showwarning = _showwarning
109 changes: 0 additions & 109 deletions sdcflows/cli/find_estimators.py

This file was deleted.

Loading

0 comments on commit f8f35d7

Please sign in to comment.