Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 2.07 KB

README.md

File metadata and controls

56 lines (38 loc) · 2.07 KB

PyPI version PyPI - Python Version PyPI - License PyPI - Downloads

Introduction

Cross Modality Image Registration (CMIR) is a PyTorch-based package for tackling multimodal registration problems that involve sets of image pairs or groups of spatial stacks of images from serial sectioning experiments and beyond. CMIR provides a set of tools which are focused on stack registration on the GPU using new algorithms. Other packages such as MONAI or NITorch are more suitable for non serial sectioning, (often natively 3D) registration problems.

CMIR is designed to be:

  • Easy to install: PyTorch sole-dependency. Considering cmaes as 2nd dependency.
  • Easy to use: Pipeline based workflows.
  • Easy to contribute: Include your own torch.nn.module layers.
  • Fast: GPU accelerated. TorchScript for just-in-time (jit) compilation.
  • Flexible: PyTorch has increasing support for AMD GPUs and Apple Silicon in addition to Nvidia

Installation

The package can (soon) be installed using pip:

pip install cmir

Usage

CCA Loss Metrics for Multimodal Data

The package provides a set of evaluation metrics implemented in the cmir.metrics module:

import torch
from cmir.metrics import PatchCCADense

# Create two stacks of images (B, C, H, W)
# Notice that channel dimensions are different
stack_reference = torch.rand(10, 4, 32, 32)
stack_moving = torch.rand(10, 3, 32, 32)

# CCA in patches with radius 2 and 5 will be computed
metric = PatchCCADense([2, 5])

# inter-image CCA between all 32**2 = 1024 patches
metric(stack_reference, stack_moving) # (10, 1024, 3)