How noel-mni/noeltexturespy works
Purpose and entry points
noelTexturesPy generates MRI texture maps from T1-weighted MRI, optionally paired with T2/FLAIR, using ANTsPy image-processing operations. It exposes the same processing capability through:
• Dash web application: src/noelTexturesPy/__main__.py, src/noelTexturesPy/app.py
• Headless batch CLI: src/noelTexturesPy/cli.py
• Core processing API: src/noelTexturesPy/image_processing.py
Application composition
The web runtime is a Python Dash application. app.py assembles the server and callback behavior, while layout.py defines the interactive UI and assets/ supplies browser-served styling/font resources.
• src/noelTexturesPy/app.py
• src/noelTexturesPy/layout.py
• src/noelTexturesPy/assets/css/all.css
The CLI is the non-browser boundary for HPC, scripting, and batch jobs. It accepts image paths, case identity, and output location, then invokes the shared pipeline rather than a separate implementation.
• src/noelTexturesPy/cli.py
• src/noelTexturesPy/image_processing.py
MRI processing pipeline
image_processing.py is the architecture’s central computation layer: it loads neuroimaging volumes, applies ANTsPy-based preprocessing/registration-oriented operations, and produces texture-derived image outputs. Utility and logging modules support this processing boundary.
• src/noelTexturesPy/image_processing.py
• src/noelTexturesPy/utils.py
• src/noelTexturesPy/custom_logging.py
Inputs are filename-classified as T1 and optionally T2/FLAIR. The pipeline operates on NIfTI-like MRI volumes and uses bundled MNI ICBM152 anatomical/template and tissue-prior images as spatial references.
• templates/mni_icbm152_t1_tal_nlin_sym_09a.nii.gz
• templates/mni_icbm152_gm_tal_nlin_sym_09a.nii.gz
• templates/mni_icbm152_wm_tal_nlin_sym_09a.nii.gz
Shared execution and output flow
Both interfaces converge on the processing layer: browser uploads/UI selections or CLI arguments establish a case and input paths; processing writes generated maps to the requested/result directory; the web layer presents progress and results. This shared-core design makes CLI outputs suitable for reproducible automated workflows while retaining interactive use.
Package initialization and module execution provide the installable Python command boundary.
• src/noelTexturesPy/__init__.py
• src/noelTexturesPy/__main__.py
• src/noelTexturesPy/app.py
Runtime dependencies and packaging
The primary runtime is Python with ANTsPy/ANTsPyNet-family dependencies, built through Pixi/Conda recipes. Custom recipes and an ANTsPyX patch indicate native imaging dependencies are intentionally controlled rather than fetched solely from generic Python packaging.
• pixi.toml
• recipes/antspyx/recipe.yaml
• recipes/antspyx/itk_patch.diff
Dockerfile packages the application for a published container image; docker-compose.yml supports local container orchestration. A separate web/ deployment configuration supplies Traefik reverse-proxy/TLS middleware configuration for hosted web deployments.
• Dockerfile
• docker-compose.yml
• web/traefik/rules/tls-opts.yml
Models, validation, and operational artifacts
Model acquisition is an explicit build/setup stage via scripts/download-models.py, separating heavyweight model assets from application source. Representative input volumes and expected texture-map outputs anchor regression validation of the pipeline and its interfaces.
• scripts/download-models.py
• tests/data/inputs/sub-00055/t1.nii.gz
• tests/data/ground-truth/t1_final.nii.gz
Main entry points: image_processing.py Texture map pipeline · app.py Dash application · recipe.yaml Patched ANTsPyX recipe · Dockerfile Container image
Components 18
Execution Interfaces
- Python module entry · Launches the Dash application command boundary.
src/noelTexturesPy/__main__.py - Dash application · Assembles the server and callback behavior.
src/noelTexturesPy/app.py - Interactive layout
src/noelTexturesPy/layout.py - Browser assets
src/noelTexturesPy/assets/css/all.css - Batch CLI · Accepts case, image paths, and output location.
src/noelTexturesPy/cli.py
MRI Processing
- T1 + optional T2/FLAIR · NIfTI-like input volumes classified by filename.
- Texture map pipeline · Loads volumes, preprocesses them, and generates texture-derived maps.
src/noelTexturesPy/image_processing.py - Utilities and logging
src/noelTexturesPy/utils.py - MNI anatomical template
templates/mni_icbm152_t1_tal_nlin_sym_09a.nii.gz - GM and WM priors
templates/mni_icbm152_gm_tal_nlin_sym_09a.nii.gz - Generated texture maps · Written to the requested result directory.
Build and Deployment
- Model acquisition · Downloads heavyweight model assets separately from source.
scripts/download-models.py - Pixi/Conda environment · Controls ANTsPy-family and native imaging dependencies.
pixi.toml - Patched ANTsPyX recipe
recipes/antspyx/recipe.yaml - Container image
Dockerfile - Local containers
docker-compose.yml - Hosted TLS proxy
web/traefik/rules/tls-opts.yml
Other components
- Regression fixtures · Representative T1 input and expected texture-map output.
tests/data/inputs/sub-00055/t1.nii.gz
Connections 18
- Python module entry → Dash application: launches
- Dash application → Interactive layout: renders
- Dash application → Browser assets: serves
- Dash application → Texture map pipeline: invokes
- Batch CLI → Texture map pipeline: invokes
- T1 + optional T2/FLAIR → Texture map pipeline: loads
- Texture map pipeline → Utilities and logging: uses
- Texture map pipeline → MNI anatomical template: references
- Texture map pipeline → GM and WM priors: uses
- Texture map pipeline → Generated texture maps: writes
- Dash application → Generated texture maps: presents results
- Model acquisition → Texture map pipeline: provisions models for
- Pixi/Conda environment → Patched ANTsPyX recipe: includes
- Patched ANTsPyX recipe → Texture map pipeline: provides ANTsPy
- Container image → Dash application: packages
- Local containers → Container image: runs
- Hosted TLS proxy → Dash application: routes hosted traffic to
- Regression fixtures → Texture map pipeline: validates