Skip to main content

Registration of 3D multiplex images with one common chanel

Project description

multireg

License BSD-3 PyPI Python Version codecov napari hub

Registration of 3D multiplex images with one common chanel, based on itk-elastix.

Napari plugin to align 3D stacks that have one common field of view in one chanel used to calculate the alignement. The plugin will apply the registration to all other chanels and output one final stack with all the aligned chanels.

The stacks must have one common chanel (typically cell junctions and nuclei) that is used to calculate the registration transformation. It can be rotated, translated, deformed, and with a wider field of view. Then the calculated transformation is applied to all the other chanels for each stack.

The final result is one multi-chanel 3D stack, with the first chanel being an average (or not) of the common chanel and each other chanel the registered chanels from the multiple stacks. The common chanel can be averaged between the different chanels, which improves its quality.

The plugin save and load files to a folder named aligned and created in the same directory as the source images.

Example of usage of this module is in the case of imaging the same cells with washing out or moving the sample in between. The corresponding cells will not be at the same position in the new stacks, and can even be deformed by the procedure. This plugin realign the images based on one common chanel on which the transformation is calculated.


Installation

  • You can install the plugin directly in Napari by going to Plugins>Install/Uninstall plugins and search for multireg

  • Or you can install multireg via pip:

    pip install multireg

Usage

You can launch multireg in napari by going to Plugins>multireg: do multiplex registration.

Fixed image

It will open a prompt to ask you to select the reference (fixed) image, compared to which all other images will be aligned. Then you have to choose the reference chanel that will be used in all the stacks to calculate the alignement. So this chanel should be common to all stacks.

Reference points

The first part of the registration relies on reference points manually selected, because the common field of view can be quite far from each other in the acquisition. So first a affine registration is applied to bring close the region of interest between the two stacks to match.
Note that if your stacks did not move a lot then you could calculate the transformation without using the reference points. There's an option in the alignement calculation panel for this.

You have to manually placed a few reference points (4-5 should be enough). Try to spread them in the image (in x,y and z) on landmarks to recognize them in other images.

To add a new reference point, click on the "plus" sign in the left panel. To select one, click on the arrow icon (or press 3), then on the point. You can move the point in x and y. To move it in z, press u for up and d for down.

When all points are placed, save them. The points have to be saved to be correctly loaded by the alignement calculation step. Then click on Fixed points done to continue to the next step.

Moving images

Then you can choose one of the images you want to align with the reference image. Its chanel that is common to the fixed image should be the same chanel, selected in the first step (the reference chanel).

Moving points

You now have to locate where the region of interest (the fixed image) is in your new image and find the landmarks referenced in the fixed image are in this new image. This allows the plugin to put together the region of interest in the two images in a first step, before to fine-tune the registration.

For each point placed in the fixed image, place the corresponding point in the moving image. By default, the moving points are placed close to the fixed points.

  • Each point must have the same label (number) as its corresponding fixed points to associate them correctly. You can change a point label by selecting it and putting the new value in param and clicking on update.

  • When a point is selected, you can drag it to its desired location. To move it in the Z direction, you can press u to move it to the next Z (up direction) and d (down) to the previous Z. The viewed slice will also move, following the point new position, when you do so.

  • You can click on side_by_side view to see the two images (fixed and moving) with their placed points at the same time.

When all the moving points have been correctly placed, click on Save points to save this positions and let it be usable by the alignement step. The points have to be saved in the point file to be correctly loaded in the alignement step.

Alignement calculation

This step is the core of the plugin. The transformation necessary to change the moving image to match with the fixed image on the reference chanel is calculated based on itk-elastix python module. It is decomposed in two steps. (1) First a global affine registration is performed, based on the correspondance between the reference and moving points. This allows to locate the fixed image postion within the moving image and apply a first shearing, scaling, rotation and translation to super-impose the region of interest. (2) The second step fine-tunes the registration. It doesn't use the reference point anymore but calculate the matching based on the images local intensities. Non-rigid transformation based on B-spline is performed at this step, thus allowing to compensate for local deformations in the moving image.

Apply alignement

Create resulting image

This step allows to save a single 3D multi-chanels stack with all the aligned chanels.

The common chanel present in all the images can be averaged together after alignement to obtain a much less noisy image. By default, the aligned reference chanel of all the images are averaged together to create the final image first chanel. However, it is possible to unselect some images in the first panel if you do not wish to use all the images or do an average.

Then each aligned chanel of all the images that were not the reference chanel are stacked together in the final resulting image. Here also, if you don't want to keep all the other chanels in the resulting image, you can unselect the one that you don't want stacked. All the aligned chanels have been previously saved in the aligned folder. If delete_files is checked (default) all these interemediate files will be deleted and only the final resulting stack will be saved in that folder.

License

Distributed under the terms of the BSD-3 license, "multireg" is free and open source software

Plugin initialization

This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.

Issues

If you encounter any problems, please [file an issue] along with a detailed description.

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

multireg-0.0.8.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

multireg-0.0.8-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file multireg-0.0.8.tar.gz.

File metadata

  • Download URL: multireg-0.0.8.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for multireg-0.0.8.tar.gz
Algorithm Hash digest
SHA256 1f52a8ad9296dc896d5060d807d59bb940acb1146e1c96bda74294ccbe3cee04
MD5 5131cb2e877494ee91418e3794d32199
BLAKE2b-256 d111cd7ccb6cb83f7f63c18937a27a8f85832130dc502173eb6eef8007621d19

See more details on using hashes here.

File details

Details for the file multireg-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: multireg-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for multireg-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 24887908d7f3f8fda0e6865f4d5a3a97639523ee040504e6351fdec5b3a0b7cc
MD5 12c714cd196200d06234164ff23b73f9
BLAKE2b-256 fb99f265701889f79955cb0fccc44eadf45f95c28897541ab4336e22637512a0

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