# biomedical-mr/resomapper architecture

> Architecture diagram of the GitHub repository biomedical-mr/resomapper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/biomedical-mr/resomapper
- Repository: https://github.com/biomedical-mr/resomapper

## Overview

##### Project type and purpose
- This is a Python-based command-line image-processing pipeline (a domain-specific “full-stack” CLI tool) called **resomapper**.
- Purpose: ingest raw Bruker MRI study folders, run preprocessing, compute parametric maps (T1, T2, T2*, DTI metrics), and write results back to the file system.

##### File structure
- Top-level:
- `resomapper/` – core library
- `tests/` – unit tests
- `docs/` – Sphinx user documentation
- `pyproject.toml` – packaging & dependencies
- CLI entry‐point: `resomapper/cli.py`
- Inside `resomapper/`:
- `file_system_functions.py` – raw data ingestion & I/O
- `preprocessing.py` – data pre‐treatment routines
- `processing.py` – orchestration of all processing steps
- `dwi/` – diffusion‐related algorithms (`adcm.py`)
- `myrelax/` – relaxation mapping routines (`getT1TR.py`, `getT2T2star.py`)
- `utils.py` – shared utilities and math helpers

##### README
- Confirms CLI usage (`resomapper_cli`), Python 3.8+ support, outputs parametric maps.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Data Source
    Raw["Raw Bruker Folders"]:::fs

    %% CLI Frontend
    CLI["resomapper_cli (CLI Frontend)"]:::cli

    %% File System I/O
    FileIO["File System I/O"]:::fs

    %% Core Pipeline Modules
    Preprocess["Preprocessing Module"]:::core
    Orchestrator["Processing Orchestrator"]:::core

    %% Processing Engines Group
    subgraph "Processing Engines"
        Relax_T1["T1 Mapping Engine"]:::core
        Relax_T2["T2/T2* Mapping Engine"]:::core
        Diffusion["Diffusion Engine"]:::core
    end

    %% Utilities
    Utils["Utilities"]:::core

    %% Output Storage
    Output["Parametric Maps on Disk"]:::fs

    %% Documentation and Tests
    Docs["Sphinx Documentation"]:::external
    Tests["Unit Tests"]:::external

    %% Data Flow
    Raw --> FileIO
    CLI -->|invokes| FileIO
    FileIO -->|provides preprocessed data| Preprocess
    Preprocess -->|sends preprocessed arrays| Orchestrator
    Orchestrator -->|dispatches to engines| Relax_T1
    Orchestrator -->|dispatches to engines| Relax_T2
    Orchestrator -->|dispatches to engines| Diffusion
    Relax_T1 -->|uses| Utils
    Relax_T2 -->|uses| Utils
    Diffusion -->|uses| Utils
    Relax_T1 -->|writes maps| Output
    Relax_T2 -->|writes maps| Output
    Diffusion -->|writes maps| Output
    CLI <-->|retrieves results| Output

    %% Auxiliary
    CLI --> Docs
    CLI --> Tests

    %% Click Events
    click CLI "https://github.com/biomedical-mr/resomapper/blob/main/resomapper/cli.py"
    click FileIO "https://github.com/biomedical-mr/resomapper/blob/main/resomapper/file_system_functions.py"
    click Preprocess "https://github.com/biomedical-mr/resomapper/blob/main/resomapper/preprocessing.py"
    click Orchestrator "https://github.com/biomedical-mr/resomapper/blob/main/resomapper/processing.py"
    click Relax_T1 "https://github.com/biomedical-mr/resomapper/blob/main/resomapper/myrelax/getT1TR.py"
    click Relax_T2 "https://github.com/biomedical-mr/resomapper/blob/main/resomapper/myrelax/getT2T2star.py"
    click Diffusion "https://github.com/biomedical-mr/resomapper/blob/main/resomapper/dwi/adcm.py"
    click Utils "https://github.com/biomedical-mr/resomapper/blob/main/resomapper/utils.py"
    click Docs "https://github.com/biomedical-mr/resomapper/tree/main/docs/"
    click Tests "https://github.com/biomedical-mr/resomapper/blob/main/tests/test_resomapper.py"

    %% Styles
    classDef cli fill:#FFA500,stroke:#333,stroke-width:1px
    classDef fs fill:#90EE90,stroke:#333,stroke-width:1px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef external fill:#CCCCCC,stroke:#333,stroke-width:1px
```
