Programs · fMRIPrep

nipypecli run

nipypecli run lists a module’s interfaces, prints an interface’s help, and runs one interface from the shell, in the current folder.

Original
nipype 1.12.0
Command line
larmorx nipype run
Python
lx.nipype.run
Ports
  • replica larmorx Apache-2.0 experimental
Evidence
every comparison with nipype
Source
made from docs/api/nipype-run.md and the code

What it does

larmorx’s gives the same arguments, listing, help, printed inputs and outputs, files, messages and exit statuses as nipype’s own command line (nipype 1.12.0 with niworkflows 1.15.4 and fMRIPrep 25.2.7, the newest releases), checked case by case against it, for the modules of fMRIPrep’s confound estimation:

Module Interfaces larmorx runs Listed, not run
nipype.algorithms.confounds ACompCor, CompCor, TCompCor, ComputeDVARS, FramewiseDisplacement, NonSteadyStateDetector, TSNR BaseInterface, SimpleInterface (nipype’s base classes)
niworkflows.interfaces.confounds ExpandModel, SpikeRegressors, NormalizeMotionParams, FSLMotionParams, FSLRMSDeviation, FramewiseDisplacement SimpleInterface
niworkflows.interfaces.images SignalExtraction, RegridToZooms Conform, TemplateDimensions (not ported), IntraModalMerge, RobustAverage (ported, below), SimpleInterface
niworkflows.interfaces.morphology BinaryDilation, BinarySubtraction SimpleInterface
niworkflows.interfaces.nibabel ApplyMask, Binarize, IntensityClip, MergeSeries, ReorientImage, RegridToZooms, GenerateSamplingReference BinaryDilation (nibabel’s, deprecated by niworkflows), DemeanImage, FilledImageLike, MapLabels, MergeROIs, SplitSeries, SimpleInterface
niworkflows.interfaces.utility AddTSVHeader, DictMerge, TSV2JSON JoinTSVColumns, KeySelect (nipype cannot instantiate it without fields), BaseInterface, SimpleInterface
niworkflows.interfaces.bold NonsteadyStatesDetector SimpleInterface
niworkflows.interfaces.patches RobustACompCor, RobustTCompCor FreeSurferSource
fmriprep.interfaces.confounds aCompCorMasks, FSLMotionParams, FSLRMSDeviation, FramewiseDisplacement, FilterDropped, RenameACompCor, GatherConfounds FMRISummary (a report: with larmorprepx’s reports), SimpleInterface

37 interfaces of the 61 these modules hold. Each runs through the larmorx function that ports it (the confounds’ docs/api/confounds.md, niworkflows’ helpers docs/api/niworkflows-helpers.md), with the newest libraries’ arithmetic (numpy 2.5.4, SciPy 1.18.1, pandas 3.0.6). An interface that is listed but not run prints its help as nipype does; running it is an error (error: larmorx has not ported ..., exit status 1). IntraModalMerge and RobustAverage are ported (lx.niworkflows.intra_modal_merge, robust_average) but not run here yet: they run FSL’s mcflirt and AFNI’s 3dvolreg as programs whose messages nipype relays through its log, line by line, which larmorx’s ports in this process do not print (a follow-up).

Command line

text
larmorx nipype run [--list] <module> [<Interface> [inputs]]

Everything after larmorx nipype run is the original’s command line: the arguments of nipype 1.12.0’s nipypecli run, as nipype takes them. LARMORX’s own options stand between larmorx and the family fmriprep, so they never meet the original’s (below):

text
larmorx
        [--n-threads N]
        [--implementation auto|replica|clean-room]
        [--upstream-defects fix|reproduce]
        nipype run ...

From the next release. In 0.1.0rc1, set the variables instead: OMP_NUM_THREADS, LARMORX_IMPLEMENTATION (original for the clean room) and LARMORX_UPSTREAM_DEFECTS.

Python

python
lx.nipype.run(
    argv: Sequence[str] | None = None,
    *,
    prog: str = "larmorx nipype run",
    upstream_defects: str | None = None,
    n_threads: int | None = None,
    env: Mapping[str, str] | None = None,
) -> int

nipypecli run with argv (its arguments: [--list] <module> [<Interface> [inputs]]; by default sys.argv[1:]) and return its exit status: 0, 2 for a usage error (click’s or argparse’s), 1 for an error (nipype’s traceback as its first and last lines on standard error). The interface runs in the current folder, which receives its files. prog is the command’s name in its messages (nipype’s nipypecli run); upstream_defects defaults to LARMORX_UPSTREAM_DEFECTS (else "fix"), n_threads to OMP_NUM_THREADS (else every logical CPU; the results do not depend on it); env is the environment read (by default os.environ).

Runs nipypecli run with argv (the arguments after run; by default sys.argv[1:]) and returns its exit status: 0, 2 for a usage error (click’s or argparse’s), 1 for an error. It writes to sys.stdout and sys.stderr, and the interface’s files to the current folder.

Options

Each row joins an option of the original’s command line with the Python argument that does the same. The rows are checked against the code at every test run: the options nipypecli run accepts (python/larmorx/nipype/_run.py) and the arguments of lx.nipype.run (python/larmorx/nipype/_run.py), whose defaults and descriptions are taken from it. Under each option, in grey, nipype’s own help for it.

nipype’s option Python Default Notes
--list argv None Available Interfaces: and the names of the interface classes in the module’s namespace, sorted (those it imports included), four blanks before each; the same as the module alone
(the module, the interface and its inputs) argv None the module alone lists its interfaces, an interface alone prints its help; its inputs: the mandatory inputs positional, in name order (lists with one or more values), the others --name value (lists with zero or more), booleans --name (they set true)
-h, --help argv None a flag the command never reads (click’s): run <module> <Interface> -h prints the help because the flag leaves no input; -- passes -h to argparse
(the command’s name) prog "larmorx nipype run" the name in the messages (nipype’s is nipypecli run)
(the environment) env None the environment read (default os.environ)
OMP_NUM_THREADS n_threads None the threads of larmorx’s computations (the results do not depend on them); default every logical CPU
LARMORX_UPSTREAM_DEFECTS upstream_defects None fix (the default) or reproduce: D13’s mode, which also chooses how the command line itself behaves (The defects of nipype’s command line)

LARMORX’s own options

From the next release. In 0.1.0rc1, set the variables instead: OMP_NUM_THREADS, LARMORX_IMPLEMENTATION (original for the clean room) and LARMORX_UPSTREAM_DEFECTS.

They stand between larmorx and fmriprep on the command line (larmorx --n-threads 4 nipype run ...); lx.nipype.run takes n_threads and upstream_defects as arguments, and the other is the command line’s only. Each one given wins over its environment variable, which keeps working.

Command line, then Python What it does
--n-threads N
n_threads=None
Default: every logical CPU on the command line (0), None in Python. The variable OMP_NUM_THREADS in 0.1.0rc1.
--implementation auto|replica|clean-room
(no Python argument)
The command line’s only: lx.nipype.run takes no implementation. The variable LARMORX_IMPLEMENTATION in 0.1.0rc1.
--upstream-defects fix|reproduce
upstream_defects=None
The variable LARMORX_UPSTREAM_DEFECTS in 0.1.0rc1.

Examples

The tests run every example below (validation/tests/test_reference.py), each section in a new folder where these inputs are made first: bold.nii.gz (a synthetic series of 4 such heads). The command lines run as python -m larmorx.

python
import larmorx as lx

# nipype's TSNR on a series: the mean, the standard deviation and their ratio, in this folder.
lx.nipype.run(["nipype.algorithms.confounds", "TSNR", "bold.nii.gz"])  # -> 0
bash
larmorx nipype run --list nipype.algorithms.confounds
larmorx nipype run nipype.algorithms.confounds TSNR bold.nii.gz

Ports

nipypecli run has one port: a replica.

Port Package Licence Status Records
replica larmorx (built in) Apache-2.0 experimental confounds-nipype

The replica: status experimental, checked against nipype’s own nipypecli run (validation/investigations/confounds/check_nipype_cli.py, the newest environment; finding confounds-nipype-cli.md): the exit status, standard output, standard error and every file written, byte for byte, with reproduce, and with the default (identical but where a correction applies: then against nipype’s interface run through its Python API on the same inputs); the click layer, all 61 helps at two widths, argparse’s and traits’ errors, every interface larmorx runs with its options, and fMRIPrep’s real calls of the confounds nodes of three reference runs (single-band, multiband with 280 volumes, multi-echo): 226 of 226 cases, 51 real calls among them (15 of which nipype’s command line refuses: PIPE-81, PIPE-82); the parity suite confounds-nipype runs the check as its cases cli-quick-e1 and cli-full-e1 (the record confounds-nipype, standard tier, 2026-11-13: 25 of 25 cases, cli-quick-e1 among them, 18 of 18 checks). The golden case cli.nipype.run; tests/python/test_nipype_run.py.

nipypecli run has one port, in pip install larmorx (a Python program of the Python package, not of the standalone larmorx program): the replica (python/larmorx/nipype/; Apache-2.0 AND BSD-3-Clause), ported from nipype 1.12.0’s scripts/cli.py and the parts of nipype it runs, with niworkflows 1.15.4 and fMRIPrep 25.2.7’s interfaces (the newest releases).

Evidence

How each of nipypecli run’s ports was measured against nipype, case by case: its evidence.

More in the repository

The API page docs/api/nipype-run.md holds what nipypecli run shares with the page’s other programs: