Skip to content

theotimefd/BrainMRIAD

Repository files navigation

BrainMRIAD

Brain MRI Anomaly Detection

Description

BrainMRIAD generates unsupervised anomaly detection maps from brain ADC and T2 FLAIR MRI nifti files. This was built with stroke lesions in mind, but since it is unsupervised it can be used to detect any abnormality. At the core two DDPM models are used, trained on both ADC and FLAIR healthy brains.

Table of Contents

Installation

Specify the requirements and the steps to install the project.

git clone https://github.com/theotime/BrainMRIAD.git
cd BrainMRIAD
# Install dependencies
# Use python 3.12
python3.12 -m venv brainmriad_env
source brainmriad_env/bin/activate
pip install -r requirements.txt

Usage

Provide examples and instructions on how to use the project. Settings are specified inside the sample_config.json file.

python brainmriad -c sample_config.json

Config File Description

  • input_folder: the folder with nifti files to process
  • output_folder: the folder where the output files will be saved
  • sequence: input MRI type. either 'ADC' or 'FLAIR'
  • save_segmentation_masks: true if a threshold should be applied to the anomaly map, resulting in an additional segmentation nifti file.
  • segmentation_threshold: the theshold used to turn the anomaly map into a binary segmentation map
  • already_preprocessed: true if the input nifti files have already been skullstriped registered to a 128x128x128 MNI template. If false the preprocessing will be performed
  • save_preprocessed_image: true if the preprocessing step should be saved
  • use_post_processing: true if a median filter should be apply to smooth the anomaly maps (the post-processed anomaly map will be saved). If save_segmentation_masks is true, additional post-processing (erosion-dilation and binary fill holes) steps will be applied to the segmentation mask and be saved.
  • replace_files: true if the program should skip files which already have an anomaly map in the output folder
  • nb_inference: number of averaged inference for the anomaly maps
  • post_processing: post processing parameters used if use_post_processing = true

License

State the license under which the project is distributed.

Uses HD-BET for skullstripping MRI preprocessing https://github.com/MIC-DKFZ/hd-bet

About

DDPM-based Unsupervised Anomaly Detection inference on ADC and T2 FLAIR MRI files

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors