Skip to main content

MicroAligner: image registration for large scale microscopy

Project description

DOI

MicroAligner: image registration for large scale microscopy

  • Automatic, no need to manually select points of interest
  • Fast, most of internal tasks are parallelized
  • Memory efficient, keeps only one image page in the memory at a time
  • Scalable, the more cores you have the faster it works
  • Linear and non-linear alignment, gives best results together in that order

There are two main methods that can do alignment, and also a pipeline that can run both of them based on parameters provided in a config file.

Methods:

Affine feature based registration method first finds image features using FAST feature finder. It detects areas with large intensity changes. After that a DAISY feature descriptor collects histograms of oriented gradients for each found feature. Then the described features are matched using FLANN based knn matcher that finds correspondence between features of reference and moving images. The matches are filtered according to the distance between the neighbours. Finally, the coordinates of matched features are aligned using RANSAC algorithm and the affine transformation is computed. This method is good for aligning large linear drifts across images.

Non-linear optical flow based registration uses Farneback method that looks for pixels with the highest similarity in the given window. Then for each pixel it computes a 2D vector that describes movement of the pixel from one image to the other. This method is good for aligning of small local shifts across images.

If you have uneven illumination across the image, and it affects the registration quality, you can try to tackle that by enabling image preprocessing with difference of Gaussians (DOG). It will extract information about strong gradients near the edges and discard gradual changes caused by uneven illumination.

Pipeline:

If images have z-planes, the script perform maximum intensity projection along the z dimension before doing the registration, so the alignment happens only in X-Y coordinates. The output image has OME-TIFF metadata, and dimension order TCZYX.

The pipeline accepts a YAML config file. Please check config_examples folder inside this repo.

Installation

pip install microaligner

Dependencies

numpy tifffile pandas opencv-contrib-python dask scikit-learn scikit-image pint
Also check up the environment.yaml file.

Example usage

As a pipeline

microaligner config.yaml

For details about the config parameters please refer to the example config.yaml provided in this repository.

As a module

Feature based registration
from microaligner import FeatureRegistrator, transform_img_with_tmat
freg = FeatureRegistrator()
freg.ref_img = img1
freg.mov_img = img2
transformation_matrix = freg.register()

img2_feature_reg_aligned = transform_img_with_tmat(img2, img2.shape, transformation_matrix)
Optical flow based registration
from microaligner import OptFlowRegistrator, Warper 
ofreg = OptFlowRegistrator()
ofreg.ref_img = img1
ofreg.mov_img = img2
flow_map = ofreg.register()

warper = Warper()
warper.image = img2
warper.flow = flow_map
img2_optflow_reg_aligned = warper.warp()

Acknowledgments

This package could have never been developed without thorough battle-testing by Tong Li and Jun Sung Park, and guidance from Omer Bayraktar.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microaligner-1.0.0.tar.gz (43.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microaligner-1.0.0-py3-none-any.whl (63.8 kB view details)

Uploaded Python 3

File details

Details for the file microaligner-1.0.0.tar.gz.

File metadata

  • Download URL: microaligner-1.0.0.tar.gz
  • Upload date:
  • Size: 43.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for microaligner-1.0.0.tar.gz
Algorithm Hash digest
SHA256 50e8e15a6def78756c8b92187d328cf8d19a1b8f3da562bd28d5f0838cff27f2
MD5 b3a30fdfb47c4dca4fbbff011f5eae67
BLAKE2b-256 ae50c9104fd36b5d6d7c5d02d287a82cd95b576067f7d831bb8061ad4d6ccfb1

See more details on using hashes here.

File details

Details for the file microaligner-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: microaligner-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 63.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for microaligner-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d86c34711f6bd9edaae2a29c0526d3ba06f0eb758ed5b58b740aaa0975b1c24a
MD5 741ec3ba8a936091893b1b0119226bfe
BLAKE2b-256 8b5e03b6361c0af04bf586133bcb47b2b2cf0a628b4a5567e0789ca68b14b507

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page