Giter VIP home page Giter VIP logo

lapirn's Introduction

Large Deformation Diffeomorphic Image Registration with Laplacian Pyramid Networks

This is the official Pytorch implementation of "Large Deformation Diffeomorphic Image Registration with Laplacian Pyramid Networks" (MICCAI 2020), written by Tony C. W. Mok and Albert C. S. Chung.

** Please also check out our new conditional deformable image registration framework (c-LapIRN - MICCAI2021) at https://github.com/cwmok/Conditional_LapIRN, which enables precise control on the smoothness of the deformation field and rapid hyperparameter tuning. **

Prerequisites

  • Python 3.5.2+
  • Pytorch 1.3.0 - 1.7.0
  • NumPy
  • NiBabel

This code has been tested with Pytorch 1.3.0 and GTX1080TI GPU.

Inference

If you prefer diffeomorphic solutions, please try:

python Test_LapIRN_diff.py

If you prefer solutions with maximized registration accuracy, please try:

python Test_LapIRN_disp.py

Train your own model

Step 1: Replace /PATH/TO/YOUR/DATA with the path of your training data. You may also need to implement your own data generator (Dataset_epoch in Functions.py).

Step 2: Change the imgshape variable (in Train_LapIRN_diff.py or Train_LapIRN_disp.py) to match the resolution of your data.

(Optional) Step 3: You may adjust the size of the model by manipulating the argument --start_channel.

Step 3: python Train_LapIRN_diff.py to train the LapIRN formulated with the stationary velocity field, or python Train_LapIRN_disp.py to train the LapIRN formulated with the displacement field.

(Example) Training on the preprocessed OASIS dataset with downsampled images

If you want to train on the preprocessed OASIS dataset in https://github.com/adalca/medical-datasets/blob/master/neurite-oasis.md. We have an example showing how to train on this dataset.

  1. Download the preprocessed OASIS dataset, unzip it and put it in "Data/OASIS".
  2. To train a new LapIRN model, python Train_LapIRN_diff_resize.py will create a LapIRN model trained on all cases (with images resized to (144, 160, 192) resolution) in the dataset.
  3. To test the model, python Test_LapIRN_diff_resize.py --modelpath {{pretrained_model_path}} --fixed ../Data/image_A_fullsize.nii.gz --moving ../Data/image_B_fullsize.nii.gz will load the assigned model and register the image "image_A_fullsize.nii.gz" and "image_B_fullsize.nii.gz".

Note that the LapIRN model in Train_LapIRN_diff_resize.py is trained with downsampled images with size indicated in the variable imgshape. Feel free to adjust the image size by adjusting the variable imgshape in Train_LapIRN_diff_resize.py.

Publication

If you find this repository useful, please cite:

Notes on this repository

We changed the regularization term in the loss function. The original regularization term is computed on the normalized velocity/displacement field, which may cause bias to the short axis.

Acknowledgment

Some codes in this repository are modified from IC-Net and VoxelMorph.

Keywords

Keywords: Diffeomorphic Image Registration, Large Deformation, Laplacian Pyramid Networks, Convolutional neural networks

lapirn's People

Contributors

cwmok avatar wingwing518 avatar

Watchers

 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.