Metadata-Version: 2.1
Name: cellmirage
Version: 0.1.1
Summary: Efficient and scalable image registration (alignment) for multiplexed imaging data
License: MIT
Author: Doron Haviv
Author-email: havivd@mskcc.org
Maintainer: Tobias Krause
Maintainer-email: tobiaspk1@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: numpy (>=1.26.3,<2.0.0)
Requires-Dist: opencv-python (>=4.9.0.80,<5.0.0.0)
Requires-Dist: scikit-image (>=0.22.0,<0.23.0)
Requires-Dist: tensorflow (>=2.8.4,<3.0.0)
Requires-Dist: tqdm (>=4.66.1,<5.0.0)
Requires-Dist: urllib3 (==1.26.6)
Description-Content-Type: text/markdown

# MIRAGE

Efficient and scalable image registration (alignment) for multiplexed imaging data. Currently only available for GPU.

## Installation

```
git clone https://github.com/dpeerlab/MIRAGE.git
cd mirage
pip install -e .
```

## Example

Also, check out the example in `tests/quickstart.ipynb`:

Before alignment:

![before](media/vis/before_registration.png)

After alignment:

![after](media/vis/after_registration.png)


```
# load package
import mirage

# Load images
image = mirage.tl.get_data("sample2_image.tiff")
reference = mirage.tl.get_data("sample2_reference.tiff")
# Images must be 2D numpy arrays (grayscale only) and scaled to 0-1.

# Initialise model
mirage_model = mirage.MIRAGE(
    images=image,
    references=reference,
    bin_mask=bin_mask,
    pad=12,
    offset=12,
    num_neurons=196,  # more for larger images
    num_layers=2,  # more for larger images
    pool=1, 
    loss="SSIM"
)

# Train model
mirage_model.train(batch_size=256, num_steps=256, lr__sched=True, LR=0.005)

# Apply transformation
mirage_model.compute_transform()
image_aligned = mirage_model.apply_transform(image)

# Inspect results pre/post alignment of a smale mesh
mesh = mirage.tl.Mesh(x=80, y=160, pad=35)
mirage.pl.plot_before_after(reference, image, image_aligned, mesh=mesh)
```

