Code Monkey home page Code Monkey logo

mri-vertebrae-registration's Introduction

MRI-Vertebrae-Registration

License: MIT

Table of Contents

Project Description

This repository is dedicated to the exploration and implementation of deep learning models for image registration of vertebrae, as part of the practical class "Advanced Deep Learning in Medicine". The project focuses initially on the application of Voxelmorph to spine MRI and CT scans.

The primary emphasis lies in training models for intra-modality registration within the same modality (MR). As the project evolves, the scope will extend to cover inter-patient intra-modality registration, specifically targeting MRI sequences such as T1w and T2w.

Project Structure

The development of this project was divided into several key phases:

Literature Review

The initial phase involved an extensive literature review to understand the current landscape of image registration techniques, specifically within the context of MRI scans.

Baseline Model with VoxelMorph

We began by implementing a baseline model using VoxelMorph for intra T1w MRI scans registration. This served as the foundation for further enhancements.

Preprocessing Pipeline

Prior to model development, a robust preprocessing pipeline was crucial. This included techniques to prepare and preprocess MRI scans, ensuring optimal input for subsequent registration models.

Model Progression

The baseline model was progressively refined and expanded to increase complexity. Different strategies were employed to enhance registration accuracy and overall performance. The baseline model was further scaled up to construct a more capable and robust model with expanding network architectures.

Semisupervised Learning

We explored semisupervised learning by incorporating segmentation masks of the vertebrae. This approach leverages additional information to improve the model's understanding of the registration task.

Affine Transformations

To further improve results, we implemented affine transformations. This involved aligning moving and fixed images using transformation matrices, enhancing the overall registration process.

Region of Interest (ROI) Experimentation

In an experimental phase, we focused on using only the Region of Interest (ROI) by identifying the maximum minimum bounding box. This exploration aimed to understand the impact of limiting the registration process to specific regions.

Still a Work in Progress

Currently expermenting with spatially-variant and adaptive regularization. A horizontal comparison with TransMorph is also a work in the future. Based on the previous research, the baseline model had a comparable performance with TransMorph on the same dataset without any other preprocessing.

Requirements

To run the project, follow these steps:

  1. Create a Conda Environment:

    conda create --name your_environment_name python=3.8
    conda activate your_environment_name
  2. Install Dependencies:

    conda install -c simpleitk -c anaconda -c conda-forge nibabel jupyter simpleitk pillow pyparsing matplotlib
  3. Install Python Requirements:

    pip install -r requirements.txt

Folder Structure

.
โ”œโ”€โ”€ BIDS
โ”œโ”€โ”€ MRIProcessor.py
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ SegmentationProcessor.py
โ”œโ”€โ”€ config.ini
โ”œโ”€โ”€ data
โ”‚   โ”œโ”€โ”€ numpy
โ”‚   โ”‚   โ””โ”€โ”€ labels.npy
โ”‚   โ”œโ”€โ”€ preprocessed
โ”‚   โ”‚   โ”œโ”€โ”€ scans
โ”‚   โ”‚   โ””โ”€โ”€ segmentations
โ”‚   โ””โ”€โ”€ region_of_interest
โ”‚       โ”œโ”€โ”€ scans
โ”‚       โ””โ”€โ”€ segmentations
โ”œโ”€โ”€ main.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ utils
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ helpers.py
โ”‚   โ””โ”€โ”€ scripts
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ bounding_box_generator.py
โ”‚       โ”œโ”€โ”€ hyper_search.sh
โ”‚       โ””โ”€โ”€ hyperparameter_search_visualization.py
โ””โ”€โ”€ vxlmorph
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ affine_transformation.py
    โ”œโ”€โ”€ generators.py
    โ”œโ”€โ”€ model_weights
    โ”œโ”€โ”€ scripts
    โ”‚   โ”œโ”€โ”€ train_baseline.py
    โ”‚   โ”œโ”€โ”€ train_semisupervised_3d.py
    โ”‚   โ””โ”€โ”€ train_semisupervised_affine_2d.py
    โ””โ”€โ”€ tensorboard

BIDS ๐Ÿ“

The BIDS directory is a versatile package designed to handle BIDS-conform datasets, including CT, MRI, etc. It provides functions for finding, filtering, and searching BIDS families and subjects. For more details, refer to the BIDS README.

vxlmorph ๐Ÿ“

The vxlmorph folder encapsulates tools and subfolders related to working with the Voxelmorph model.

  • generators.py: This module provides a list of data generators that can generate data in the correct format for Voxelmorph models.

  • scripts: Contains script files for training and testing various Voxelmorph models.

  • tensorboard: A directory to store TensorBoard logs of losses and evaluation metrics, which can be visualized later using TensorBoard commands.

  • model_weights: A directory to store model weights.

Utils ๐Ÿ“

The utils folder contains functionalities that are useful when working on this project.

  • helpers.py: Defines a set of methods for tasks such as visualizing scans, file handling, etc.

Data ๐Ÿ“

The data directory is intended to store dataset-related files.

MRIProcessor.py

Defines a class MRIProcessor for preprocessing .nii.gz scan files.

SegmentationProcessor.py

Defines a class SegmentationProcessor for preprocessing .nii.gz segmentation files.

Project Team

Supervised by: Robert Graf & Wenqi Huang

Team Members

Name LinkedIn Email
Guangyao Quan LinkedIn Email
Utku Ipek LinkedIn Email
Anass Ibrahimi LinkedIn Email

Project License

This project is licensed under the MIT License - see the LICENSE file for details.

Project Acknowledgement

Special thanks to our supervisor Robert and Wenqi for their continuous support. We would also like to thank all ADLM tutors from the AI in Medicine Lab for their insights and guidance.

Project Contact

Feel free to connect with us on LinkedIn or to drop us an email for any inquiries. We look forward to hearing from you! ๐Ÿ™‚

mri-vertebrae-registration's People

Contributors

a-ibrahimi avatar guangyao-quan avatar ipekutku avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.