# noel-mni/noeltexturespy architecture

> Architecture diagram of the GitHub repository noel-mni/noeltexturespy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/noel-mni/noeltexturespy
- Repository: https://github.com/noel-mni/noeltexturespy

## Overview

#### 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: [`src/noelTexturesPy/image_processing.py`](https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/image_processing.py) (Texture map pipeline), [`src/noelTexturesPy/app.py`](https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/app.py) (Dash application), [`recipes/antspyx/recipe.yaml`](https://github.com/noel-mni/noeltexturespy/blob/main/recipes/antspyx/recipe.yaml) (Patched ANTsPyX recipe), [`Dockerfile`](https://github.com/noel-mni/noeltexturespy/blob/main/Dockerfile) (Container image)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Execution Interfaces"]
  node_module_entry["Python module entry<br/>entry point<br/>[__main__.py]"]
  node_dash_app["Dash application<br/>web runtime<br/>[app.py]"]
  node_ui_layout["Interactive layout<br/>Dash UI<br/>[layout.py]"]
  node_web_assets["Browser assets<br/>CSS and fonts<br/>[all.css]"]
  node_batch_cli["Batch CLI<br/>headless interface<br/>[cli.py]"]
end

subgraph group_processing["MRI Processing"]
  node_mri_inputs["T1 + optional T2/FLAIR<br/>MRI volumes"]
  node_image_pipeline["Texture map pipeline<br/>ANTsPy processing"]
  node_pipeline_support["Utilities and logging<br/>processing support<br/>[utils.py]"]
  node_mni_template["MNI anatomical template<br/>spatial reference"]
  node_tissue_priors["GM and WM priors<br/>tissue references"]
  node_texture_outputs["Generated texture maps<br/>MRI outputs"]
end

subgraph group_runtime["Build and Deployment"]
  node_model_download["Model acquisition<br/>setup script<br/>[download-models.py]"]
  node_pixi_environment["Pixi/Conda environment<br/>runtime packaging<br/>[pixi.toml]"]
  node_antspy_recipe["Patched ANTsPyX recipe<br/>native dependency build<br/>[recipe.yaml]"]
  node_container_image["Container image<br/>Docker packaging"]
  node_local_orchestration["Local containers<br/>Docker Compose<br/>[docker-compose.yml]"]
  node_hosted_proxy["Hosted TLS proxy<br/>Traefik configuration<br/>[tls-opts.yml]"]
end

node_regression_fixtures["Regression fixtures<br/>validation data<br/>[t1.nii.gz]"]

node_module_entry -->|"launches"| node_dash_app
node_dash_app -->|"renders"| node_ui_layout
node_dash_app -->|"serves"| node_web_assets
node_dash_app -->|"invokes"| node_image_pipeline
node_batch_cli -->|"invokes"| node_image_pipeline
node_mri_inputs -->|"loads"| node_image_pipeline
node_image_pipeline -->|"uses"| node_pipeline_support
node_image_pipeline -->|"references"| node_mni_template
node_image_pipeline -->|"uses"| node_tissue_priors
node_image_pipeline -->|"writes"| node_texture_outputs
node_dash_app -->|"presents results"| node_texture_outputs
node_model_download -.->|"provisions models for"| node_image_pipeline
node_pixi_environment -->|"includes"| node_antspy_recipe
node_antspy_recipe -.->|"provides ANTsPy"| node_image_pipeline
node_container_image -->|"packages"| node_dash_app
node_local_orchestration -->|"runs"| node_container_image
node_hosted_proxy -.->|"routes hosted traffic to"| node_dash_app
node_regression_fixtures -.->|"validates"| node_image_pipeline

click node_module_entry "https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/__main__.py"
click node_dash_app "https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/app.py"
click node_ui_layout "https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/layout.py"
click node_web_assets "https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/assets/css/all.css"
click node_batch_cli "https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/cli.py"
click node_image_pipeline "https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/image_processing.py"
click node_pipeline_support "https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/utils.py"
click node_mni_template "https://github.com/noel-mni/noeltexturespy/blob/main/templates/mni_icbm152_t1_tal_nlin_sym_09a.nii.gz"
click node_tissue_priors "https://github.com/noel-mni/noeltexturespy/blob/main/templates/mni_icbm152_gm_tal_nlin_sym_09a.nii.gz"
click node_model_download "https://github.com/noel-mni/noeltexturespy/blob/main/scripts/download-models.py"
click node_pixi_environment "https://github.com/noel-mni/noeltexturespy/blob/main/pixi.toml"
click node_antspy_recipe "https://github.com/noel-mni/noeltexturespy/blob/main/recipes/antspyx/recipe.yaml"
click node_container_image "https://github.com/noel-mni/noeltexturespy/blob/main/Dockerfile"
click node_local_orchestration "https://github.com/noel-mni/noeltexturespy/blob/main/docker-compose.yml"
click node_hosted_proxy "https://github.com/noel-mni/noeltexturespy/blob/main/web/traefik/rules/tls-opts.yml"
click node_regression_fixtures "https://github.com/noel-mni/noeltexturespy/blob/main/tests/data/inputs/sub-00055/t1.nii.gz"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_module_entry,node_dash_app,node_ui_layout,node_web_assets,node_batch_cli toneBlue
class node_mri_inputs,node_image_pipeline,node_pipeline_support,node_mni_template,node_tissue_priors,node_texture_outputs toneAmber
class node_model_download,node_pixi_environment,node_antspy_recipe,node_container_image,node_local_orchestration,node_hosted_proxy toneMint
class node_regression_fixtures toneNeutral
```

## Components

### Execution Interfaces

- [Python module entry](https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/__main__.py): entry point · Launches the Dash application command boundary. · `src/noelTexturesPy/__main__.py`
- [Dash application](https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/app.py): web runtime · Assembles the server and callback behavior. · `src/noelTexturesPy/app.py`
- [Interactive layout](https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/layout.py): Dash UI · `src/noelTexturesPy/layout.py`
- [Browser assets](https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/assets/css/all.css): CSS and fonts · `src/noelTexturesPy/assets/css/all.css`
- [Batch CLI](https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/cli.py): headless interface · Accepts case, image paths, and output location. · `src/noelTexturesPy/cli.py`

### MRI Processing

- **T1 + optional T2/FLAIR**: MRI volumes · NIfTI-like input volumes classified by filename.
- [Texture map pipeline](https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/image_processing.py): ANTsPy processing · Loads volumes, preprocesses them, and generates texture-derived maps. · `src/noelTexturesPy/image_processing.py`
- [Utilities and logging](https://github.com/noel-mni/noeltexturespy/blob/main/src/noelTexturesPy/utils.py): processing support · `src/noelTexturesPy/utils.py`
- [MNI anatomical template](https://github.com/noel-mni/noeltexturespy/blob/main/templates/mni_icbm152_t1_tal_nlin_sym_09a.nii.gz): spatial reference · `templates/mni_icbm152_t1_tal_nlin_sym_09a.nii.gz`
- [GM and WM priors](https://github.com/noel-mni/noeltexturespy/blob/main/templates/mni_icbm152_gm_tal_nlin_sym_09a.nii.gz): tissue references · `templates/mni_icbm152_gm_tal_nlin_sym_09a.nii.gz`
- **Generated texture maps**: MRI outputs · Written to the requested result directory.

### Build and Deployment

- [Model acquisition](https://github.com/noel-mni/noeltexturespy/blob/main/scripts/download-models.py): setup script · Downloads heavyweight model assets separately from source. · `scripts/download-models.py`
- [Pixi/Conda environment](https://github.com/noel-mni/noeltexturespy/blob/main/pixi.toml): runtime packaging · Controls ANTsPy-family and native imaging dependencies. · `pixi.toml`
- [Patched ANTsPyX recipe](https://github.com/noel-mni/noeltexturespy/blob/main/recipes/antspyx/recipe.yaml): native dependency build · `recipes/antspyx/recipe.yaml`
- [Container image](https://github.com/noel-mni/noeltexturespy/blob/main/Dockerfile): Docker packaging · `Dockerfile`
- [Local containers](https://github.com/noel-mni/noeltexturespy/blob/main/docker-compose.yml): Docker Compose · `docker-compose.yml`
- [Hosted TLS proxy](https://github.com/noel-mni/noeltexturespy/blob/main/web/traefik/rules/tls-opts.yml): Traefik configuration · `web/traefik/rules/tls-opts.yml`

### Other components

- [Regression fixtures](https://github.com/noel-mni/noeltexturespy/blob/main/tests/data/inputs/sub-00055/t1.nii.gz): validation data · Representative T1 input and expected texture-map output. · `tests/data/inputs/sub-00055/t1.nii.gz`

## Connections

- 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
