Skip to main content

Quickly find the affine matrix mapping one image to another using manual correspondence points annotation

Project description

Description

This GUI plugin allows you to quickly find the affine matrix mapping one image to another using manual correspondence points annotation.

More simply, this plugin allows you to select corresponding points on an image, and a second image you wish to transform. It computes the requisite transformation matrix using Affine Transform, Euclidean Transform, or Similarity Transform, and performs this transformation on the moving image, aligning it to the reference image.

https://user-images.githubusercontent.com/17995243/120086403-f1d0b300-c121-11eb-8000-a44a2ac54339.mp4

Who is This For?

This is a simple plugin which can be used on any 2D images, provided they can be loaded as layers into napari. The images need not be the same file format and this plugin also works with labels layers.

No prior understanding of the transformation methods is required, as they perform in the background based on the reference points selected.

How to Guide

You will need a combination of two or more 2D image and/or labels layers loaded into napari. Once you have installed affinder, you can find it in the dock widgets menu.

Affinder widget in the Plugins->Add Dock Widget menu

The first two dropdown boxes will be populated with the layers currently loaded into napari. Select a layer to use as reference, and another to transform.

Dropdowns allow you to select the reference and moving layers

Next, you can select the transformation model to use (affine is selected by default and is the least rigid transformation of those available). See below for a description of the different models.

Finally, you can optionally select a path to a text file for saving out the resulting transformation matrix.

When you click Start, affinder will add two points layers to napari. The plugin will also bring your reference image in focus, and its associated points layer. You can then start adding reference points by clicking on your image.

Adding reference points to layer

Once three points are added, affinder will switch focus to the moving image, and you should then proceed to select the corresponding three points.

Adding corresponding points to newly focused layer

affinder will immediately transform the moving image to align the points you've selected when you add your third corresponding point to your moving image.

The moving image is transformed once three points are added

From there, you can continue iteratively adding points until you are happy with the alignment. Affinder will switch focus between reference and moving image with each point.

Click Finish to exit affinder.

Transformation Models

There are three transformation models available for use with affinder. They are listed here in order of increasing rigidity in the types of transforms they will allow. The eponymous Affine Transform is the least rigid and is the default choice.

  • Affine Transform: the least rigid transformation, it preserves lines and parallelism, but not necessarily distance and angles. Translation, scaling, similarity, reflection, rotation and shearing are all valid affine transformations.

  • Similarity Transform: this is a "shape preserving" transformation, producing objects which are geometrically similar. Translation, rotation, reflection and uniform scaling are valid similarity transforms. Shearing is not.

  • Euclidean Transform: Also known as a rigid transformation, this transform preserves the Euclidean distance between each pair of points on the image. This includes rotation, translation and reflection but not scaling or shearing.

Getting Help

If you find a bug with affinder, or would like support with using it, please raise an issue on the GitHub repository.

How to Cite

Many plugins may be used in the course of published (or publishable) research, as well as during conference talks and other public facing events. If you'd like to be cited in a particular format, or have a DOI you'd like used, you should provide that information here.

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

affinder-0.4.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

affinder-0.4.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file affinder-0.4.0.tar.gz.

File metadata

  • Download URL: affinder-0.4.0.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for affinder-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1f9281e4f4a41340e5e1b479e5e375c8abb984ae2f1e629147352cfec24ca085
MD5 6ab1be6f819f219fb02062f01b53e4c9
BLAKE2b-256 7278bb44569586f089b2a8451a32dc2d50c1620ce3e3b9c36cd539bc8f56cc09

See more details on using hashes here.

File details

Details for the file affinder-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: affinder-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for affinder-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b814ee06f58a57b091d0f772835edd88f517a233b08ffcd6e678e3f2ee1d1b48
MD5 9351a8d3d56b0d66c444c05f8be07831
BLAKE2b-256 c80d439a689b83702dfbe5ea65dc8f3966ac9c987ad33ef499f848931ad9e445

See more details on using hashes here.

Supported by

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