How czotti/niftimath-rs works
NiftiMath is a command-line tool for evaluating reverse-Polish formulas over scalar values and NIfTI images, then saving the resulting image. The user supplies operands, operations, and an output path; main configures threading, applies each formula token through a stack, and writes the final image using the selected datatype. The operator layer parses and evaluates arithmetic and voxel-wise unary operations, with cached image objects and parallel array processing. Edges reflect the shown call sites; NIfTI file nodes represent external inputs and outputs.
Main entry points: main.rs Run formula · operator.rs Formula engine · utils.rs Image reader
Components 8
Command line
- Run formula
src/main.rs - Thread setup
src/utils.rs
Formula computation
- Formula engine
src/operator.rs
NIfTI I/O
- NIfTI input
- Image reader
src/utils.rs - Header reader
src/utils.rs - NIfTI output
Other components
- CLI user
Connections 8
- CLI user → Run formula: provides formula
README.md - Run formula → Thread setup: sets threads
src/main.rs - Run formula → Formula engine: parses and applies
src/main.rs - Formula engine → Image reader: loads image
src/operator.rs - Formula engine → NIfTI input: reads image
- Image reader → NIfTI input: reads file
- Run formula → Header reader: reads header
src/main.rs - Run formula → NIfTI output: writes result
src/main.rs