All Projects → voxelmorph → Voxelmorph

voxelmorph / Voxelmorph

Licence: apache-2.0
Unsupervised Learning for Image Registration

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Voxelmorph

Arflow
The official PyTorch implementation of the paper "Learning by Analogy: Reliable Supervision from Transformations for Unsupervised Optical Flow Estimation".
Stars: ✭ 134 (-87.32%)
Mutual labels:  unsupervised-learning, optical-flow
Unflow
UnFlow: Unsupervised Learning of Optical Flow with a Bidirectional Census Loss
Stars: ✭ 239 (-77.39%)
Mutual labels:  unsupervised-learning, optical-flow
Back2future.pytorch
Unsupervised Learning of Multi-Frame Optical Flow with Occlusions
Stars: ✭ 104 (-90.16%)
Mutual labels:  unsupervised-learning, optical-flow
Ddflow
DDFlow: Learning Optical Flow with Unlabeled Data Distillation
Stars: ✭ 101 (-90.44%)
Mutual labels:  unsupervised-learning, optical-flow
PCLNet
Unsupervised Learning for Optical Flow Estimation Using Pyramid Convolution LSTM.
Stars: ✭ 29 (-97.26%)
Mutual labels:  optical-flow, unsupervised-learning
Joint-Motion-Estimation-and-Segmentation
[MICCAI'18] Joint Learning of Motion Estimation and Segmentation for Cardiac MR Image Sequences
Stars: ✭ 45 (-95.74%)
Mutual labels:  optical-flow, unsupervised-learning
Hidden Two Stream
Caffe implementation for "Hidden Two-Stream Convolutional Networks for Action Recognition"
Stars: ✭ 179 (-83.07%)
Mutual labels:  unsupervised-learning, optical-flow
Selflow
SelFlow: Self-Supervised Learning of Optical Flow
Stars: ✭ 319 (-69.82%)
Mutual labels:  unsupervised-learning, optical-flow
deepOF
TensorFlow implementation for "Guided Optical Flow Learning"
Stars: ✭ 26 (-97.54%)
Mutual labels:  optical-flow, unsupervised-learning
GuidedNet
Caffe implementation for "Guided Optical Flow Learning"
Stars: ✭ 28 (-97.35%)
Mutual labels:  optical-flow, unsupervised-learning
back2future
Unsupervised Learning of Multi-Frame Optical Flow with Occlusions
Stars: ✭ 39 (-96.31%)
Mutual labels:  optical-flow, unsupervised-learning
Cc
Competitive Collaboration: Joint Unsupervised Learning of Depth, Camera Motion, Optical Flow and Motion Segmentation
Stars: ✭ 348 (-67.08%)
Mutual labels:  unsupervised-learning, optical-flow
Summary loop
Codebase for the Summary Loop paper at ACL2020
Stars: ✭ 26 (-97.54%)
Mutual labels:  unsupervised-learning
Adns3080
Example code for the ADNS-3080 optical flow sensor
Stars: ✭ 36 (-96.59%)
Mutual labels:  optical-flow
Unsup3d
(CVPR'20 Oral) Unsupervised Learning of Probably Symmetric Deformable 3D Objects from Images in the Wild
Stars: ✭ 905 (-14.38%)
Mutual labels:  unsupervised-learning
Bagofconcepts
Python implementation of bag-of-concepts
Stars: ✭ 18 (-98.3%)
Mutual labels:  unsupervised-learning
Student Teacher Anomaly Detection
Student–Teacher Anomaly Detection with Discriminative Latent Embeddings
Stars: ✭ 43 (-95.93%)
Mutual labels:  unsupervised-learning
Iva
IVA: Independent Vector Analysis implementation
Stars: ✭ 35 (-96.69%)
Mutual labels:  unsupervised-learning
Variational Autoencoder
Variational autoencoder implemented in tensorflow and pytorch (including inverse autoregressive flow)
Stars: ✭ 807 (-23.65%)
Mutual labels:  unsupervised-learning
Minisom
🔴 MiniSom is a minimalistic implementation of the Self Organizing Maps
Stars: ✭ 801 (-24.22%)
Mutual labels:  unsupervised-learning

voxelmorph: Learning-Based Image Registration

voxelmorph is a general purpose library for learning-based tools for alignment/registration, and more generally modelling with deformations.

Tutorial

Visit the VoxelMorph tutorial to learn about VoxelMorph and Learning-based Registration

Instructions

To use the VoxelMorph library, either clone this repository and install the requirements listed in setup.py or install directly with pip.

pip install voxelmorph

Training

If you would like to train your own model, you will likely need to customize some of the data loading code in voxelmorph/generators.py for your own datasets and data formats. However, it is possible to run many of the example scripts out-of-the-box, assuming that you have a directory containing training data files in npz (numpy) format. It's assumed that each npz file in your data folder has a vol parameter, which points to the numpy image data to be registered, and an optional seg variable, which points to a corresponding discrete segmentation (for semi-supervised learning). It's also assumed that the shape of all image data in a directory is consistent.

For a given /path/to/training/data, the following script will train the dense network (described in MICCAI 2018 by default) using scan-to-scan registration. Model weights will be saved to a path specified by the --model-dir flag.

./scripts/tf/train.py /path/to/training/data --model-dir /path/to/models/output --gpu 0

Scan-to-atlas registration can be enabled by providing an atlas file with the --atlas atlas.npz command line flag. If you'd like to train using the original dense CVPR network (no diffeomorphism), use the --int-steps 0 flag to specify no flow integration steps. Use the --help flag to inspect all of the command line options that can be used to fine-tune network architecture and training.

Registration

If you simply want to register two images, you can use the register.py script with the desired model file. For example, if we have a model model.h5 trained to register a subject (moving) to an atlas (fixed), we could run:

./scripts/tf/register.py --moving moving.nii.gz --fixed atlas.nii.gz --moved warped.nii.gz --model model.h5 --gpu 0

This will save the moved image to warped.nii.gz. To also save the predicted deformation field, use the --save-warp flag. Both npz or nifty files can be used as input/output in this script.

Testing (measuring Dice scores)

To test the quality of a model by computing dice overlap between an atlas segmentation and warped test scan segmentations, run:

./scripts/tf/test.py --model model.h5 --atlas atlas.npz --scans scan01.npz scan02.npz scan03.npz --labels labels.npz

Just like for the training data, the atlas and test npz files include vol and seg parameters and the labels.npz file contains a list of corresponding anatomical labels to include in the computed dice score.

Parameter choices

CVPR version

For the CC loss function, we found a reg parameter of 1 to work best. For the MSE loss function, we found 0.01 to work best.

MICCAI version

For our data, we found image_sigma=0.01 and prior_lambda=25 to work best.

In the original MICCAI code, the parameters were applied after the scaling of the velocity field. With the newest code, this has been "fixed", with different default parameters reflecting the change. We recommend running the updated code. However, if you'd like to run the very original MICCAI2018 mode, please use xy indexing and use_miccai_int network option, with MICCAI2018 parameters.

Spatial Transforms and Integration

  • The spatial transform code, found at voxelmorph.layers.SpatialTransformer, accepts N-dimensional affine and dense transforms, including linear and nearest neighbor interpolation options. Note that original development of VoxelMorph used xy indexing, whereas we are now emphasizing ij indexing.

  • For the MICCAI2018 version, we integrate the velocity field using voxelmorph.layers.VecInt. By default we integrate using scaling and squaring, which we found efficient.

VoxelMorph Papers

If you use voxelmorph or some part of the code, please cite (see bibtex):

Notes:

  • keywords: machine learning, convolutional neural networks, alignment, mapping, registration
  • The master branch is still in testing as we roll out a major refactoring of the library.
  • If you'd like to run code from VoxelMorph publications, please use the legacy branch.
  • data in papers: In our initial papers, we used publicly available data, but unfortunately we cannot redistribute it (due to the constraints of those datasets). We do a certain amount of pre-processing for the brain images we work with, to eliminate sources of variation and be able to compare algorithms on a level playing field. In particular, we perform FreeSurfer recon-all steps up to skull stripping and affine normalization to Talairach space, and crop the images via ((48, 48), (31, 33), (3, 29)).

We encourage users to download and process their own data. See a list of medical imaging datasets here. Note that you likely do not need to perform all of the preprocessing steps, and indeed VoxelMorph has been used in other work with other data.

Creation of Deformable Templates

We present a template consturction method in this preprint:

To experiment with this method, please use train_template.py for unconditional templates and train_cond_template.py for conditional templates, which use the same conventions as voxelmorph (please note that these files are less polished than the rest of the voxelmorph library).

We've also provided an unconditional atlas in data/generated_uncond_atlas.npz.npy.

Models in h5 format weights are provided for unconditional atlas here, and conditional atlas here.

Explore the atlases interactively here with tipiX!

Contact:

For any problems or questions please open an issue for code problems/questions or start a discussion for general registration/voxelmorph question/discussion.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].