Skip to content

Devguru-codes/NIfTI-FitT1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NIfTI-FitT1

NIfTI-FitT1 is a voxel-wise inversion recovery MRI fitting pipeline written in Python. It loads a 4D NIfTI image plus a YAML configuration file, fits the inversion recovery model to every valid voxel using nonlinear least squares, and saves T1 and S0 maps as 3D NIfTI files.

Requirements

  • Python 3.11 or compatible Python 3 environment
  • The packages listed in requirements.txt

Installation

Create and activate a virtual environment, then install the dependencies:

python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt

Generate Test Data

Run the simulator from the project root:

python simulate_data.py

This creates:

  • fake_data.nii.gz
  • config.yaml

The generated configuration references the synthetic dataset and writes outputs into the output directory.

Run The Fitting Pipeline

Execute the pipeline with the generated configuration:

python -m src.pipeline --config config.yaml

If the run succeeds, the pipeline writes:

  • output/T1_map.nii.gz
  • output/S0_map.nii.gz

Run Tests

Execute the test suite from the project root:

pytest

The test suite covers:

  • The inversion recovery equation in src/models.py
  • Fitter behavior for invalid voxel data in src/fitters.py
  • An integration path that fits synthetic inversion recovery data and checks parameter recovery

Configuration Format

The config.yaml file must contain:

input_nifti: path/to/4d_image.nii.gz
inversion_times:
  - 100.0
  - 400.0
  - 1000.0
  - 2000.0
output_dir: output
mask_threshold: 50.0

Project Layout

.
|-- README.md
|-- requirements.txt
|-- simulate_data.py
`-- src
    |-- __init__.py
    |-- config.py
    |-- fitters.py
    |-- models.py
    `-- pipeline.py
`-- tests
    |-- conftest.py
    |-- test_fitters.py
    |-- test_integration.py
    `-- test_models.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages