Documentation · early development

LARMORX

Library of Algorithmic Reimplementations for MRI through Open Rust eXecution

Bringing Neuroimaging Tools into Resonance.

Reimplemented in Rust. Accessible through Python. Built for FAIR research.

Apache-2.0 · Linux, macOS and Windows · pip install larmorx

The animation behind this text shows spins in five groups, one for each of five software projects (ANTs, AFNI, FSL, FreeSurfer and Connectome Workbench), each group precessing about a vertical magnetic field, B0, at its own frequency and out of phase. Scrolling brings their frequencies to one Larmor frequency and locks their phases: the spins come into resonance and gather into a brain, a cloud of points from the MNI ICBM 152 template, in which each group keeps its colour. A readout shows the coherence of the spins rising from about 0 to 1.

LARMORX puts programs from ANTs, AFNI, FSL, tedana, sdcflows and fMRIPrep in one Python package. pip install larmorx is all it takes on Linux, macOS and Windows: no other installation, and the same results on every computer.

Most programs are ports of an original program, reimplemented in Rust (or kept in Python, where the original is Python) and compared with it case by case. The tests check on six platforms that every program gives the same results. LARMORX is in early development: its first release, 0.1.0rc1, is a pre-release. This site describes the code in development (the repository's main branch) and marks what 0.1.0rc1 does not have yet "from the next release": tedana's t2smap in larmorx itself, for one, which 0.1.0rc1 has only in larmorx-gpl. The programs under Where it stands are ported and compared with their originals; everything else is planned. How to install it and run its first programs: Getting started; the words, packages and settings in depth: Concepts.

Original, replica, clean room

Every program is compared with its original

Most of LARMORX's programs are ports of original programs. Each port is a replica or a clean room, and some programs have both. The original's licence decides which package each port goes in.

One examplebet, which finds the brain in a head image, runs through the three cards. On fMRIPrep's own call, its replica and its clean room both give FSL's brain and mask, every voxel: its evidence.

i.

Original

The program as its own developers release it. Every port runs beside it, on the same files with the same arguments, and is compared with it: its files, its messages and its exit status.

bet from FSL 6.0.7.23.

ANTs 2.6.5 · AFNI 26.3.05 · FSL 6.0.7.23
tedana 26.0.3 · sdcflows 2.17.1 · fMRIPrep's steps

ii.

Replica

The original's source translated step by step into Rust, or, for some Python originals, rewritten step by step in Python, to give its results bit for bit. A replica comes under its original's licence terms: the replicas of ANTs, ITK, AFNI, sdcflows and fMRIPrep are in larmorx, FSL's in larmorx-nc, and tedana's t2smap in larmorx-gpl, under GPL-3.0. larmorx-nc and larmorx-gpl are installed apart and run as separate programs.

bet's replica, in larmorx-nc.

larmorx · Apache-2.0 (AFNI's with its CC BY 4.0 credit)
larmorx-nc · FSL Licence, non-commercial use only
larmorx-gpl · GPL-3.0

iii.

Clean room

Written again from a description of what the original does, its documentation and runs of it, never from its source, and built for speed. It carries LARMORX's licence, Apache-2.0, so it is in larmorx: AFNI's and FSL's programs have one, and tedana's t2smap from the next release.

bet's clean room, in larmorx, written without FSL's source.

larmorx · Apache-2.0

A program with both ports takes implementation="replica" or "clean-room" ("original" in 0.1.0rc1). "auto", the default, runs the replica when it is installed (AFNI's are built in) and the clean room otherwise. Every program and its ports: Programs. The four words, the packages and their licences in full: Concepts and the repository's licensing notes.

Programs by their software

Programs from six projects, and two planned

Each project has a colour, always shown with its name. The Programs page lists every program, what it does and which ports it has.

  • ANTs and ITK

    Transforms and their files, N4, denoising, ImageMath and its filters, registration (linear and deformable stages), antsAI, Atropos.

    replica larmorx

    13 programs and 1 module
  • AFNI

    3dTshift, 3dAutomask, 3dUnifize and 3dvolreg. AFNI 26.3.05 released the Medical College of Wisconsin’s code under CC BY 4.0, so the replicas are in larmorx beside the clean rooms.

    replica larmorxclean room larmorx

    4 programs
  • FSL

    mcflirt, BET, FLIRT and its programs, FAST, topup, fslmaths, fslstats, fslroi, standard_space_roi and prelude.

    replica larmorx-ncclean room larmorx

    26 programs
  • tedana

    t2smap: the T2* and S0 maps of multi-echo fMRI and the echoes’ optimal combination.

    replica larmorx-gplclean room larmorx from the next release

    1 program
  • sdcflows

    Field-map estimation: the B-spline fit, PEPOLAR, direct and fieldmap-less (SyN), sdcflows’ BIDS app, with niworkflows’ helpers and pybids’ BIDS index.

    replica larmorx

    1 program and 3 modules
  • fMRIPrep

    fMRIPrep’s one-shot BOLD resampler, its field-map steps and its confound estimation, and SciPy’s and scikit-image’s routines under them.

    replica larmorx

    1 program and 5 modules
  • LARMORX's own

    Its NIfTI reader and writer. The larmorprepx pipeline is planned.

    1 module
  • FreeSurfer

    Every program complete, a replica in its own package, larmorx-freesurfer, and a clean room built for speed.

    Planned
  • Workbench

    Surface tools compatible with Connectome Workbench and MSM.

    Planned

How to use it

The original's arguments, the same bits on every platform

Every program can be used three ways: from a command line that takes the original program's arguments, from Python and from Rust. Each port has a record that compares it with the original, case by case.

Command line

The original's arguments

larmorx <family> <program> <the original's arguments>, or lx for short, takes the original's options. How far the messages and exit statuses match is stated in each port's record.

Python

Python calls

import larmorx as lx: the same programs, with typed options, on images in memory.

LARMORX's options

Threads, port, defects

--n-threads N, --implementation auto|replica|clean-room and --upstream-defects fix|reproduce stand between larmorx and the family, from the next release; 0.1.0rc1 reads the environment variables they replace, OMP_NUM_THREADS, LARMORX_IMPLEMENTATION and LARMORX_UPSTREAM_DEFECTS. In Python they are the arguments n_threads, implementation and upstream_defects.

Rust

No C, C++ or Fortran

Pure Rust, with no C, C++ or Fortran libraries. Each Rust function's origin is recorded in its crate's PROVENANCE.md. Results do not depend on the thread count, and the maths functions come from correctly rounded ports of CORE-MATH (the pure-Rust libm where not ported yet), so a program gives the same bits on every platform (why Rust and Python).

Platforms

Six platforms, one output

Continuous integration builds the wheels and runs the test suites on Linux (x86-64, aarch64), macOS (Intel, Apple silicon) and Windows (x64, arm64). The cross-platform checks test that every program gives its Linux x86-64 output bit for bit on each platform.

Validation

Documented differences

Every port has a record of its comparison with the original. Defects found in an original are registered and corrected by default (fix), with a warning; upstream_defects="reproduce" gives the original's behaviour, and the comparisons with the original run with it.

bash
larmorx ants N4BiasFieldCorrection -d 3 -i t1w.nii.gz -o t1w_n4.nii.gz
larmorx ants antsApplyTransforms -d 3 -i boldref.nii.gz -r t1w.nii.gz -t xfm.h5 -o boldref_t1w.nii.gz
larmorx afni 3dTshift -tpattern alt+z -TR 2 -prefix bold_stc.nii.gz bold.nii.gz
python
import larmorx as lx

t1w = lx.load("t1w.nii.gz")
t1w_n4 = lx.ants.n4_bias_field_correction(t1w, n_threads=8)
boldref_t1w = lx.ants.apply_transforms(lx.load("boldref.nii.gz"), t1w, ["xfm.h5"])
bold_stc = lx.afni.tshift(lx.load("bold.nii.gz"), slice_times="alt+z", tr=2.0)
lx.save(t1w_n4, "t1w_n4.nii.gz")

The command line takes the original programs' arguments; Python takes the same programs with typed options, on images in memory. A first session from start to end, on public data: First steps.

Where it stands

What is ported, and what is planned

The programs ported so far, each compared with its original (ANTs 2.6.5, AFNI 26.3.05, FSL 6.0.7.23, sdcflows 2.17.1, tedana 26.0.3) or, for LARMORX's own NIfTI reader and writer, with nibabel. Each name leads to its evidence page, with figures that compare its ports with the original; each line links to its records in the main repository. Everything else is planned.

In the repositoryAPI pages are in docs/api, benchmark reports in docs/benchmarks, and the defects found in the originals in the register.

Ported

27 lines · the standard comparison

ProgramPortsValidation
ANTs and ITK
antsApplyTransformslarmorx ants antsApplyTransformslx.ants.apply_transformsreplica (ANTs/ITK)258 cases: 185 of 200 compared bit-identical to ANTs, the rest differ only through glibc’s maths; B-spline transforms included; data panel: 329 of 425 as built, all with correctly rounded maths (fMRIPrep’s 421 calls in fMRIPrep’s fourteen runs)
ITK transform files (.mat, .txt, .h5)lx.transformsreplica (ITK, HDF5)149 cases, 0 failures; HDF5 read and written in pure Rust
N4BiasFieldCorrectionlarmorx ants N4BiasFieldCorrectionlx.ants.n4_bias_field_correctionreplica29 of 46 bit-identical to ANTs, 46 of 46 with correctly rounded maths; ANTS-40 corrected by default; data panel: 20 of 69 as built, 69 of 69 with correctly rounded maths
DenoiseImagelarmorx ants DenoiseImagelx.ants.denoise_imagereplica7 of 40 bit-identical to ANTs, 40 of 40 with correctly rounded maths; ANTS-43 and ANTS-44 corrected by default; data panel: 0 of 21 as built, 21 of 21 with correctly rounded maths
ImageMath (every operation fMRIPrep, sMRIPrep and sdcflows call)larmorx ants ImageMathlx.ants.image_mathreplica334 cases: values bit-identical in 303 of 308, headers in 308 of 308; ANTS-17, -22 and -23 corrected, checked against known results; data panel: 374 of 374 bit-identical
ThresholdImage, MultiplyImages, SmoothImage, ResampleImage, ResampleImageBySpacinglarmorx ants ...replicabit-identical in every compared case (threshold, multiply, smooth, resample, by spacing); data panel: threshold, multiply, smooth, resample, by spacing, every compared case bit-identical
antsRegistration (every stage: linear, SyN, B-spline SyN, B-spline, displacement-field, exponential and time-varying velocity-field; image and point-set metrics)larmorx ants antsRegistrationlx.ants.registrationreplica513 cases: 355 of 399 compared identical to ANTs (outputs and messages), 44 more with correctly rounded maths; the corrections’ effects; data panel: 71 compared, 16 identical as built, 55 more with correctly rounded maths, and the 14 whole template registrations at full size, 14 of 14 identical with correctly rounded maths
antsAI, antsAffineInitializerlarmorx ants antsAIlarmorx ants antsAffineInitializerreplicaantsAI: 76 of 76 compared identical (75 as built, 1 with correctly rounded maths), the blob alignment (-b) included (its corrections, ANTS-116 among them, by default); antsAffineInitializer: 26 of 26; data panel: antsAI 40 of 40, antsAffineInitializer 14 of 14
Atropos (every initialization, likelihood model, MRF, outlier and partial-volume option)larmorx ants Atroposlx.ants.atroposreplica97 cases: 27 of 58 compared bit-identical to ANTs, 58 of 58 with correctly rounded maths, sMRIPrep’s call in five of fMRIPrep’s runs included; partial-volume classes with the MRF corrected (ANTS-106); data panel: 3 of 17 as built, 17 of 17 with correctly rounded maths, the classes identical in all
AFNI
3dTshift (slice timing)larmorx afni 3dTshiftlx.afni.tshiftreplica and clean room, both in larmorx (the replica with CC BY 4.0’s attribution)replica: 282 of 282 bit-identical; clean room: 282 of 282 compared agree, 180 bit-identical, 2–6× faster
3dAutomask (brain mask)larmorx afni 3dAutomasklx.afni.automaskreplica and clean room, both in larmorx (the replica with CC BY 4.0’s attribution)replica: 101 of 101 compared cases that write outputs bit-identical; clean room: 130 cases, 92 of 106 compared cases that write outputs bit-identical to AFNI (the other 14: inputs carrying AFNI’s own header extension, AFNI-10: the data bit-identical, the header and messages AFNI’s for the input without it), fMRIPrep’s call on the BOLD reference of every fMRIPrep run included, the data panel’s too
3dUnifize (intensity uniformization)larmorx afni 3dUnifizelx.afni.unifizereplica and clean room, both in larmorx (the replica with CC BY 4.0’s attribution)replica: 97 of 97 compared cases that write outputs bit-identical at 1, 2 and 6 threads; clean room: 129 cases, none failing: 44 of 99 compared cases that write outputs bit-identical to AFNI, the other 55 within 1e-5 (at most 8.7e-8 of the largest value) and bit-identical to AFNI run with correctly rounded maths (glibc’s tanhf in AFNI’s squash), fMRIPrep’s call in every fMRIPrep run included; 4 to 25 times faster than AFNI (informal timings)
3dvolreg (rigid-body registration of a series)larmorx afni 3dvolreglx.afni.volregreplica in larmorx (with CC BY 4.0’s attribution; 2026-11-07: every option, message and failure case; AFNI-86 to AFNI-99 corrected or refused by default, AFNI’s behaviour with reproduce where it is defined); clean room, experimental (2026-11-08: every option, message and failure case of specs/3dvolreg.md, AFNI-86 to AFNI-99 handled as the replica handles them, each with reproduce; built for speed: fMRIPrep’s calls 2.8 to 5.2 times AFNI’s speed and 1.5 to 1.9 times the replica’s on one thread, the same bits at any thread count)replica: 137 of 137 compared cases that write outputs bit-identical to AFNI 26.3.05 (every file written, the messages, the exit status), fMRIPrep’s RobustAverage calls on the BOLD references of six of fMRIPrep’s runs and sdcflows’ PEPOLAR reference averages on two included (their medians fMRIPrep’s own outputs byte for byte); 30 more rejected by both alike; 2.2 to 3.1 times faster than AFNI (informal timings); clean room: 185 of 185 compared cases within specs/3dvolreg.md §14.3’s limits against AFNI 26.3.05, its default within them of the replica’s default (exit statuses, messages, files written and headers exact; the numbers that the shear decomposition’s ties decide within limits measured from AFNI’s own spread under those ties): fMRIPrep’s 10 RobustAverage and PEPOLAR calls (their medians at most 0.115 of their limits from fMRIPrep’s own outputs), every option, data type, message and failure case; 63 more rejected by both alike; 2.8 to 5.2 times faster than AFNI on one thread, 9 to 15 times on 14
FSL
Head-motion correction (mcflirt)larmorx mri hmclarmorx fsl mcflirtlx.mri.hmcreplica in larmorx-nc (FSL Licence, non-commercial); clean room, experimental (2026-11-07: the normcorr count’s running total taking each point’s weight as the point is visited, and leastsquares as FLIRT’s leastsq, the spec answers of 2026-11-06)replica: 205 of 205 compared cases bit-identical to mcflirt as built, FSL 6.0.7.23 (the recorded runs, fMRIPrep’s calls in every fMRIPrep run with BOLD runs, the data panel’s included, and the edge cases; 32 more rejected by both, alike; 173 of 173 in the full comparison against FSL 6.0.7.17), fMRIPrep’s own matrices identical; clean room: compared with FSL’s mcflirt: 145 of 145 compared cases within thresholds; 5–16× faster with threads
BET (brain extraction; the skull and scalp surfaces)larmorx fsl betlarmorx fsl bet2larmorx fsl betsurflarmorx fsl standard_space_roilarmorx fsl fslroilx.fsl.betlx.fsl.betsurflx.fsl.standard_space_roilx.fsl.fslroireplica in larmorx-nc (FSL Licence, non-commercial), with standard_space_roi and fslroi (since 2026-11-04); clean room (bet2, the bet script with every variation (-S, -B, -A, -A2 since 2026-11-05) and betsurf; standard_space_roi and fslroi since 2026-11-05, FSL’s standard images found where the user has them or fetched once), experimentalreplica: 201 of 201 compared cases bit-identical to FSL 6.0.7.23, every file, exit status and message (129 of 129 in the full comparison against FSL 6.0.7.17, the data panel’s T1w images included), fMRIPrep’s 29 BET calls in every fMRIPrep run with BOLD runs included; 47 more rejected by both, alike; 13 where FSL crashes and reproduce fills what it leaves undefined; 1 where FSL’s fill reads memory beyond the volume (FSL-43, undefined); bet -S, -B, -A, -A2, standard_space_roi and fslroi in the replica since 2026-11-04 (FSL’s standard images shipped in larmorx-nc); the clean room’s standard_space_roi and fslroi since 2026-11-05 (every case of the two FSL’s bit for bit, the six real heads included), and its -S, -B, -A, -A2 (-S and -B FSL’s bit for bit on every case but a 3.5-year-old’s -B, bet2’s -c on a neurologically stored image; -A and -A2 with betsurf’s masks within its thresholds); clean room: 198 of 200 compared cases within thresholds against FSL 6.0.7.23, fMRIPrep’s 29 BET calls in every fMRIPrep run with BOLD runs bit-identical; bet2’s and bet’s brains, masks, outlines, meshes and skulls FSL’s bit for bit, the surfaces that rerun after a self-intersecting first pass included; betsurf’s profiles decided as FSL’s, its masks within its thresholds on 4 of 5 real heads (Dice 0.9907 to 0.9997); 2.5 to 3.6 times faster than FSL on one thread, 6.5 to 13.5 times on 24, betsurf included
FLIRT (affine registration, boundary-based registration; convert_xfm and FLIRT’s other programs)larmorx fsl flirtlarmorx fsl convert_xfmlarmorx fsl avscalelarmorx fsl img2imgcoordlarmorx fsl std2imgcoordlarmorx fsl img2stdcoordlarmorx fsl rmsdifflarmorx fsl makerotlarmorx fsl midtranslarmorx fsl pointflirtlarmorx fsl applyxfm4Dlarmorx fsl pairreglarmorx fsl extracttxtlarmorx fsl aff2rigidlx.fsl.flirtlx.fsl.convert_xfmlx.fsl.avscalelx.fsl.img2imgcoordlx.fsl.std2imgcoordlx.fsl.img2stdcoordlx.fsl.rmsdifflx.fsl.makerotlx.fsl.midtranslx.fsl.pointflirtlx.fsl.applyxfm4dlx.fsl.pairreglx.fsl.extracttxtlx.fsl.aff2rigidreplica of every program in larmorx-nc (FSL Licence, non-commercial), experimental (parts 1 to 3); clean room of every program, experimental (parts 1 and 2: flirt with -debug and every verbose level, convert_xfm, avscale, the coordinate programs, rmsdiff, makerot, midtrans, pointflirt, applyxfm4D and the scripts pairreg, extracttxt, aff2rigid; 2026-11-05: the spec answers of 2026-11-03, FSL-204 and FSL-241 refused in both modes, NaN centres run as FSL runs them with reproduce; 2026-11-07: the weighted normcorr’s count per point, the spec answer of 2026-11-06; fMRIPrep’s BBR call 12 to 14 times FSL’s speed on 14 threads); both: every program and script of fsl-flirt but -warp, flirt_average and epi_reg (standard_space_roi: the replica’s since 2026-11-04, the clean room’s since 2026-11-05, its cases in BET’s records)replica: 211 of 211 compared cases bit-identical to FSL 6.0.7.23 (matrices, images, printed results, exit status and messages): fMRIPrep’s boundary-based calls in three of fMRIPrep’s runs (their matrices also identical as text to fMRIPrep’s own), every cost function, the search options, every shipped schedule and every schedule command (alignpaxes, any parameter-subset mask), -anglerep quaternion, -debug, -applyxfm 3D and 4D with every interpolation and data type, BBR with its types, coordinates and a field map, avscale, the coordinate programs, rmsdiff, makerot, midtrans, pointflirt, applyxfm4D in every data type and interpolation, pairreg, extracttxt and aff2rigid; 87 more rejected by both, alike; 7 where FLIRT crashes or never finishes (FSL-71, FSL-72, FSL-75, FSL-93); clean room: 239 of 240 compared cases within thresholds against FSL 6.0.7.23 (fMRIPrep’s three boundary-based calls within 0.012 mm at the 95th percentile of the brain with reproduce (glibc’s maths functions, as FSL is built), -applyxfm FSL’s images bit for bit with trilinear and nearest neighbour, applyxfm4D’s spline FSL’s values, the other programs’ printed results and files FSL’s, every verbose level and -debug, the schedules’ and the command line’s messages FSL’s), 89 more rejected by both alike, 10 where FLIRT crashes or never finishes, or writes results the spec cannot define (FSL-241, refused); the 1 it misses is in its record (the weighted woods registration, whose path parts at its cost’s last bits; since 2026-11-05 the search orders its starting points of equal cost as FSL does, with libstdc++'s std::sort; since 2026-11-07 the weighted normcorr’s count takes each point’s weight as the point is visited, its matrix FSL’s as text)
FAST (tissue segmentation: classes, partial volumes, bias field)larmorx fsl fastlx.fsl.fastreplica in larmorx-nc (FSL Licence, non-commercial), experimental; clean room, experimental (2026-11-03: every option, message and failure case, one channel or any number of them, FSL’s tissue priors registered by FLIRT’s clean room in the same process; 2026-11-05: the spec answers of 2026-11-03, FSL-202 and FSL-203 in both modes, standard output as FAST buffers it at an abort; fMRIPrep’s call 9 to 11 times FSL’s speed on one thread, 47 to 67 times on 14, the same bits at any thread count)replica: 59 of 59 compared cases bit-identical to FSL 6.0.7.23 (every image written, the printed messages, the exit status): fMRIPrep’s call in 3 of its runs (an adult, a 3.5-year-old, a glioma), every option, one to eight channels, FSL’s tissue priors registered by FLIRT’s replica, the image types, 2D images; 27 more rejected by both alike; 1 where FSL reads and writes past the smaller of channels of different sizes (FSL-104, refused); clean room: 64 of 65 compared cases within thresholds against FSL 6.0.7.23 (fMRIPrep’s call in 3 of its runs and every single-channel case FSL’s values bit for bit with reproduce (glibc’s maths functions, as FSL is built), two to eight channels FSL’s segmentations with their partial volumes FSL’s or within 1.3e-7 on average; its default held to the replica’s default, bit for bit with glibc’s functions on every single-channel case), 35 more rejected by both alike, 2 expected divergences (FSL-104, refused; two channels’ defaults that both correct FSL-98’s cycle, the correctly rounded functions’ band); the 1 it misses is in its record (five channels with nearly singular covariances, decided by the matrix arithmetic’s last bits)
topup and applytopup (the susceptibility field from reversed phase encodings, and its correction)larmorx fsl topuplarmorx fsl applytopuplx.fsl.topuplx.fsl.applytopupreplica in larmorx-nc (FSL Licence, non-commercial), experimental (2026-11-03: the same programs, options and methods; 2026-11-06: FSL-273, applytopup’s Jacobian with a field of other voxel sizes, corrected by default); clean room, experimental (2026-11-03: every option, message and failure case of both programs, applytopup’s undocumented vb2D, vb3D and vb4D included; 2026-11-04: the spec answers of 2026-11-03, FSL-133, FSL-134, FSL-145 and FSL-201 reproduced with reproduce; 2026-11-05: the scaled conjugate gradients’ --miter count, FSL-242 corrected by default; 2026-11-07: FSL-273 with a coefficient field corrected by default (the Jacobian of the displacement applied), FSL’s scales with reproduce; fMRIPrep’s call 10 to 12 times FSL’s speed on one thread, 39 to 41 times on 14, the same bits at any thread count)replica: 107 of 107 compared cases bit-identical to FSL 6.0.7.23 (every file written, the printed messages, the exit status): fMRIPrep’s call in 2 of its runs, every option, FSL’s configurations, applytopup’s five methods; 67 more rejected by both alike; 3 refused where FSL needs more memory than any machine holds (a negative --warpres, FSL-124) or reads a field on another grid past its lines (FSL-134); clean room: 106 of 106 compared cases within thresholds against FSL 6.0.7.23 (fMRIPrep’s call in 2 of its runs: ds001600 within FSL’s own thread band in every metric, ds005040 in every one but the field’s correlation, 0.999958 against FSL’s own 0.999966), 67 more rejected by both alike, 14 expected divergences, each with its reason (estimated movements that do not converge, where FSL-201’s forward differences make FSL’s own path depend on its inputs’ last bits, FSL’s measured spread beside the clean room’s; FSL-143’s diverging iterations, reproduced; vb2D’s transients; FSL-126; inputs refused for FSL-124 and FSL-134)
fslmaths (image arithmetic, thresholds, filters, reductions, statistics, TFCE)larmorx fsl fslmathslx.fsl.fslmathslx.fsl.smoothlx.fsl.thresholdreplica in larmorx-nc (FSL Licence, non-commercial), experimental (2026-11-03: every operation, option, data type, message and failure case); clean room, experimental (2026-11-04: every operation, option, data type, message and failure case, FSL-191 to FSL-193 found by its black-box runs; 1.8 to 28 times FSL’s speed on one thread, up to 268 times on 14, the same bits at any thread count)replica: 360 of 360 compared cases bit-identical to FSL 6.0.7.23 (every file written, the printed messages, the exit status): fMRIPrep’s 18 calls (combine_masks in three of fMRIPrep’s runs, the goodvoxels mask’s fourteen), every operation in every data type; 61 more rejected by both alike; 1 one unit in the last place where FSL’s glibc 2.35 is not correctly rounded and the replica is (GLIBC-07: -dt double -tan; glibc’s sin, cos and the FFT’s sincos are the replica’s reproduce bits since 2026-11-04); clean room: 386 of 386 compared cases within thresholds against FSL 6.0.7.23, 370 of them FSL’s values in every file (fMRIPrep’s 18 calls included; the others: FSL’s FFT path, -subsamp2 under the floating types, the last bits of Φ, the eigenvectors’ signs, GLIBC-07), 63 more rejected by both alike, 5 expected divergences (FSL’s FFT convolution against the clean room’s direct sum, -subsamp2offc’s means)
fslstats (image statistics: means, extremes, percentiles, histograms, per volume and label, JSON)larmorx fsl fslstatslx.fsl.fslstatslx.fsl.image_meanlx.fsl.image_stdreplica in larmorx-nc (FSL Licence, non-commercial), experimental (2026-11-03: every option, -t, -K and -json, every message and failure case; BET’s replica runs it); clean room, experimental (2026-11-04: every option, -t, -K and -json, every message and failure case)replica: 172 of 172 compared cases printing FSL 6.0.7.23’s text byte for byte (with its messages and exit status): fMRIPrep’s 4 goodvoxels calls, BET’s call, FSL’s own tests, every option; 36 more rejected by both alike; clean room: 126 of 126 compared cases within thresholds against FSL 6.0.7.23, 125 of them FSL’s numbers (fMRIPrep’s 4 goodvoxels calls included; BET’s call within 6e-8 relative), 36 more rejected by both alike
prelude (phase unwrapping of field maps’ phase differences and complex images)larmorx fsl preludelarmorx-nc fsl preludelx.fsl.preludereplica in larmorx-nc (FSL Licence, non-commercial), experimental (2026-11-06: every option, message and failure case, FSL-261 to FSL-272 corrected by default or refused, each with reproduce); clean room, experimental (2026-11-06: every option, message and failure case of specs/prelude.md, FSL-261 to FSL-272 corrected by default or refused, each with reproduce; the regions merged through an indexed heap and a weighted union-find: fMRIPrep’s two large calls 97 and 211 times FSL’s speed and 2.5 to 2.8 times the replica’s on one thread, the same bits at any thread count)replica: 68 of 68 compared cases bit-identical to FSL 6.0.7.23 (every file written, the printed messages, the exit status): fMRIPrep’s 7 calls in four of fMRIPrep’s runs, the data panel’s two other phase-difference maps, every option, complex and phase-and-magnitude inputs, series, NaN values (in a complex128 image’s case, FSL-265, the values FSL takes from memory it never wrote are reported, not compared); 20 more rejected by both alike; clean room: 138 of 138 compared cases within thresholds against FSL 6.0.7.23 (with reproduce every file bit-identical to FSL’s; by default bit-identical to the replica’s but the phases of complex images, GLIBC-07, which keep FSL’s whole turns): the replica suite’s cases with the clean room standing in, fMRIPrep’s 7 calls (also against fMRIPrep’s own outputs), every option, image type, NaN input, failure and output type; 28 more rejected by both alike
tedana
tedana’s t2smap (the T2* and S0 maps of multi-echo fMRI and the echoes’ optimal combination)larmorx tedana t2smaplarmorx-gpl tedana t2smaplx.tedana.t2smapreplica in larmorx-gpl (GNU GPL version 3, converted from tedana’s LGPL-2.1 under its section 3), experimental (2026-11-08: every option, message, output and failure case of tedana 26.0.3, with numpy’s, SciPy’s, nibabel’s and nilearn’s arithmetic; TED-01 to TED-18, TED-31 and TED-46 corrected by default or refused, each with reproduce, but TED-06, kept; ANALYZE and MGH inputs since 2026-11-12); clean room, experimental (2026-11-12: every option, message, exit status and failure case of specs/t2smap.md, TED-01 to TED-18, TED-31 and TED-46 corrected by default or refused, each with reproduce (the fitted numbers its own solvers’, within §17.3’s thresholds), but TED-06, kept; the log-linear fit in closed form, the curve fit a trust-region solver on the echoes’ means, deterministic threads: fMRIPrep’s curve-fit calls 10 to 15 times tedana’s speed at one thread and 19 to 30 at eight, with a quarter of its memory)replica: 62 of 62 compared cases bit-identical to tedana 26.0.3 in both kept library environments (every file, message and exit status): fMRIPrep’s 5 multi-echo calls in three of fMRIPrep’s runs (also against fMRIPrep’s own files), every option, data type and failure; 40 more rejected by both alike; 44 % of tedana’s peak memory on fMRIPrep’s calls, 3.0 to 4.2 times its speed at 14 threads on fMRIPrep’s curve-fit calls; clean room: 124 of 124 compared cases within specs/t2smap.md §17.3’s thresholds against tedana 26.0.3 (reproduce: exit status, messages and files tedana’s) and the replica’s default (by default): fMRIPrep’s 6 multi-echo calls in three of fMRIPrep’s runs, every option, data type, image format and failure, threads; 1 expected divergence (a chaotic curve fit of noise voxels); 25 % of tedana’s peak memory
sdcflows
sdcflows’ field-map estimation (the B-spline field fit, the field evaluated and applied, the phase-difference preparation)lx.sdcflows.bspline_approxlx.sdcflows.B0FieldTransformlx.sdcflows.apply_coeffs_fieldlx.sdcflows.phdiff_workflowlx.io.save_nibabelreplica (sdcflows 2.17.1, with scikit-learn’s, SciPy’s, numpy’s and nibabel’s arithmetic)37 cases: 37 of 37 bit-identical to sdcflows 2.17.1 (every array, file, header, warning and message), fMRIPrep’s seven phase-difference estimators and their B-spline fits included (also fMRIPrep’s own files); SDC-01, -02 and -04 to -11 corrected by default or refused, each with reproduce; the fit 6.5 to 7.8 times faster than scikit-learn’s at 14 threads, with 22 to 32 % of sdcflows’ peak memory at one
sdcflows’ PEPOLAR, direct and fieldmap-less estimation (the masks, the estimators of a BIDS dataset, the derivatives, the BIDS app; niworkflows’ helpers; fMRIPrep’s own field-map steps)larmorx sdcflows sdcflowslx.sdcflows.topup_workflowlx.sdcflows.fmap_workflowlx.sdcflows.syn_sdc_workflowlx.sdcflows.brain_maskerlx.sdcflows.run_applx.niworkflowslx.bidslx.ndimagelx.skimagereplica (sdcflows 2.17.1 with 2.15.2’s estimator search, niworkflows 1.15.4, nipype 1.12.0’s command lines, pybids 0.22.0’s index, fMRIPrep 25.2.7’s field-map steps; SciPy’s, scikit-image’s and numpy’s arithmetic in Rust)19, 14 and 8 cases of the estimation, 5 of niworkflows’ helpers and 10 and 1 of SciPy’s, scikit-image’s and numpy’s arithmetic, every one bit-identical to the originals (every array, file, header, warning, message and command line): sdcflows’ BIDS app whole on the eight datasets of sdcflows’ own runs in both library environments, fMRIPrep’s own field-map derivatives from LARMORX’s stage run as fMRIPrep ran it, the fieldmap-less (SyN) registration ANTs’ one-thread warp byte for byte; SDC-12 to SDC-46, PIPE-18 to PIPE-40, SCI-06 to SCI-32 and SKI-01 to SKI-04: 42 corrected by default and 15 refused, 61 with reproduce; the BIDS app 1.2 to 5.3 times faster than sdcflows at one thread, with 16 to 72 % of the originals’ peak memory
fMRIPrep
fMRIPrep’s one-shot BOLD resamplerlx.transforms.resample_seriesreplica (fMRIPrep, nitransforms, SciPy)139 cases: 136 of 136 compared bit-identical
fMRIPrep’s confound estimation (CompCor, DVARS, framewise displacement, the motion parameters and RMS deviation, the masks and tissue signals, the confounds table and its JSON; nipype’s confounds module and nipypecli run; numpy’s and SciPy’s linear algebra and FFTs under them)larmorx nipype runlx.confoundslx.niworkflowslx.nipype.runlarmorx.pipelines.larmorprepx.confounds.bold_confoundsport (fMRIPrep 25.2.7’s confounds workflow and interfaces, with 25.2.6’s for the step; nipype 1.12.0’s algorithms/confounds.py and command line; niworkflows 1.15.4’s confound interfaces; nitime 0.12.1, nipy 0.6.1, pandas 3.0.6 and 2.2.3; numpy 2.5.4, 2.3.5 and 2.2.6’s and SciPy 1.18.1 and 1.15’s linear algebra (OpenBLAS’s level 1 to 3 kernels, LAPACK 3.12.1’s and 3.12.0’s SVD and least-squares paths) and single-precision FFTs, in Rust)32 and 12 cases of numpy’s and SciPy’s linear algebra, 25 and 3 of nipype’s confounds module and command line, 16 of fMRIPrep’s and niworkflows’ steps and the workflow, every one bit-identical to the originals (every array, file, table cell, header, warning, message and exit status) in numpy 2.5.4, 2.3.5 and fMRIPrep 25.2.6’s 2.2.6: fMRIPrep’s 36 confounds files of 21 oracle runs column by column and their JSON byte for byte, from LARMORX’s workflow run as fMRIPrep ran it; PIPE-41 to PIPE-83, PD-01 to PD-03, NP-09, NP-10 and SCI-41: 29 corrected by default (two undefined conversions clamped) and 12 refused, 41 with reproduce; the 26 Python nodes 1.1 to 1.4 times as fast as fMRIPrep’s at one thread and 1.5 to 1.6 at eight on three oracle runs (numpy’s SVD and least squares, ported, still slower: a speed item), at most 0.96 of the originals’ peak memory
LARMORX's own
NIfTI-1/2 I/Olx.loadlx.savelx.ImageLARMORX’s own257 files, data bit-identical to nibabel; 4–8× faster on compressed writes with threads

Planned

the next steps first, from the roadmap

  1. The documentation revision

    LARMORX

    In progress (roadmap): the website and the repository’s documents in one set of words (Concepts), and a reference page for every program. The evidence pages and the site’s other pages are done (2026-11-13); the reference pages and the repository’s documents come next.

  2. FreeSurfer 8.2.0

    FreeSurfer

    Every program complete, a replica in its own package, larmorx-freesurfer, and a clean room built for speed. In progress (roadmap): its preparation done on 2026-11-12 (the inventory of its code, the queue of its ports, the replay tool); its foundations, the shared library, under way. Every step and its status: FreeSurfer’s roadmap.

  3. Surfaces

    Workbench

    Surface programs compatible with Connectome Workbench and MSM.

  4. larmorprepx

    LARMORX

    An independent, fMRIPrep-compatible preprocessing pipeline (BIDS in, fMRIPrep-compatible derivatives and reports out), written in plain Python on the library, then compared with fMRIPrep end to end.

  5. Clean rooms for the programs that have only a replica

    ANTssdcflowsfMRIPrep

    A clean room, built for speed, of every program that has only a replica (ANTs and ITK, sdcflows’ field maps, fMRIPrep’s resampler and Python steps, nitransforms, the confounds), after FreeSurfer, before the final validation phase.

  6. The completeness parts

    FSLANTsFreeSurfer

    FSL’s FNIRT, applywarp, convertwarp and fugue, each with a replica and a clean room, then FLIRT’s -warp, epi_reg and flirt_average, which wait for them; ANTs’ missing operations; FreeSurfer’s optional streams. After FreeSurfer. FSL’s mcflirt, BET with every option, FLIRT, FAST, topup, fslmaths, fslstats, standard_space_roi, fslroi and prelude are done, each with a replica and a clean room (mcflirt’s is larmorx mri hmc).

  7. The final validation phase

    LARMORXfMRIPrep

    The extensive tests of every program at once (the data panel, long random-testing runs, the full comparisons, an independent review of every large port), then the comparisons with fMRIPrep, stage by stage and end to end.

  8. Release 0.1.0

    LARMORX

    The next release, once the full pipeline, larmorprepx, exists; 0.1.0rc1 is a pre-release. Until then the code in development (the repository’s main branch) collects what comes with it (its changelog’s “Unreleased”).

  9. Later, AFNI

    AFNI

    Two optional AFNI paths of fMRIPrep’s libraries, 3dQwarp (sdcflows’ other PEPOLAR estimator) and 3dSkullStrip with 3dcalc (niworkflows’ older skull strip), and an analysis track outside fMRIPrep (3dTproject, 3dDespike, 3dReHo, 3dRSFC, 3dDeconvolve/3dREMLfit, 3dFWHMx/3dClustSim, …), planned for later. 3dTshift, 3dAutomask, 3dUnifize and 3dvolreg are done, each with a replica and a clean room.

Install it with pip install larmorx: the library and the larmorx and lx commands. larmorx[prep] adds what the larmorprepx pipeline will need, and larmorx[all] also the replicas of FSL's programs (larmorx-nc, non-commercial use only) and of tedana's t2smap (larmorx-gpl, GPL-3.0). Standalone programs, container images and what your computer needs: Getting started.

The name

Named after the Larmor frequency

The name comes from the Larmor frequency: in a magnetic field, spins of one kind precess at one frequency. LARMORX brings programs from different projects into one package and compares each with its original the same way.

ω = γ B0
the Larmor frequency: γ the gyromagnetic ratio, B0 the field

The name is inspired by the Larmor frequency, a fundamental concept in magnetic resonance imaging: in a uniform magnetic field B0, nuclear spins of the same species precess at the same frequency, ω = γB0.

LARMORX brings programs from different projects into one package for one purpose: FAIR research, research that is Findable, Accessible, Interoperable and Reusable.

  • Findable

    A public repository with versioned history, releases on PyPI and GitHub, and citation metadata (CITATION.cff).

  • Accessible

    Open source under Apache-2.0; native wheels for six platforms that need no external neuroimaging installations, containers or administrator rights, and container images for those who prefer them.

  • Interoperable

    Standard formats (NIfTI-1/2, ITK transform files including HDF5), the original programs' command-line arguments, and a Python API for pipelines.

  • Reusable

    A permissive licence, documentation for every program, provenance records, records of every comparison, case by case, and a register of the differences from the originals.

The project follows the FAIR Principles for Research Software, FAIR4RS.

How every port is compared with its original, and where the records are; how to install LARMORX and run its first programs.