Summary
Python/C++ port of the ImageJ extension TurboReg/StackReg written by Philippe Thevenaz/EPFL.
A python extension for the automatic alignment of a source image or a stack (movie) to a target image/reference frame.
Description
pyStackReg is used to align (register) one or more images to a common reference image, as is required usually in time-resolved fluorescence or wide-field microscopy. It is directly ported from the source code of the ImageJ plugin TurboReg and provides additionally the functionality of the ImageJ plugin StackReg, both of which were written by Philippe Thevenaz/EPFL (available at http://bigwww.epfl.ch/thevenaz/turboreg/).
pyStackReg provides the following four types of distortion:
translation
rigid body (translation + rotation)
scaled rotation (translation + rotation + scaling)
affine (translation + rotation + scaling + shearing)
Bilinear transformation is not (yet) made available, althought the source code has been fully ported. For technical details, please refer to http://bigwww.epfl.ch/thevenaz/turboreg/.
Installation
The package is available on PyPi. Install it using:
pip install pystackreg
Usage
The following example opens two different files and registers them using all different possible transformations
from pystackreg import StackReg
from skimage import io
#load reference and "moved" image
ref = io.imread('some_original_image.tif')
mov = io.imread('some_changed_image.tif')
#Translational transformation
sr = StackReg(StackReg.TRANSLATION)
out_tra = sr.register_transform(ref, mov)
#Rigid Body transformation
sr = StackReg(StackReg.RIGID_BODY)
out_rot = sr.register_transform(ref, mov)
#Scaled Rotation transformation
sr = StackReg(StackReg.SCALED_ROTATION)
out_sca = sr.register_transform(ref, mov)
#Affine transformation
sr = StackReg(StackReg.AFFINE)
out_aff = sr.register_transform(ref, mov)
The next example shows how to separate registration from transformation (e.g., to register in one color channel and then use that information to transform another color channel):
from pystackreg import StackReg
from skimage import io
img0 = io.imread('some_multiframe_image.tif')
img1 = io.imread('another_multiframe_image.tif')
# img0.shape: frames x width x height (3D)
sr = StackReg(StackReg.RIGID_BODY)
# register 2nd image to 1st
sr.register(img0[0, :, :], img0[1,:,:])
# use the transformation from the above registration to register another frame
out = sr.transform(img1[1,:,:])
The next examples shows how to register and transform a whole stack:
from pystackreg import StackReg
from skimage import io
img0 = io.imread('some_multiframe_image.tif') # 3 dimensions : frames x width x height
sr = StackReg(StackReg.RIGID_BODY)
# register to first image
out_first = sr.register_transform_stack(img0, reference='first')
# register to mean image
out_mean = sr.register_transform_stack(img0, reference='mean')
# register each frame to the previous (already registered) one
out_previous = sr.register_transform_stack(img0, reference='previous')
# register to mean of first 10 images
out_first10 = sr.register_transform_stack(img0, reference='first', n_frames=10)
# calculate a moving average of 10 images, then register the moving average to the mean of
# the first 10 images and transform the original image (not the moving average)
out_moving10 = sr.register_transform_stack(img0, reference='first', n_frames=10, moving_average = 10)
License
Below is the license of TurboReg/StackReg:
/*==================================================================== | Additional help available at http://bigwww.epfl.ch/thevenaz/turboreg/ | | You'll be free to use this software for research purposes, but you | should not redistribute it without our consent. In addition, we expect | you to include a citation or acknowledgment whenever you present or | publish results that are based on it. \===================================================================*/
Metadata
Release files for pystackreg 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pystackreg-0.1.0.tar.gz | 29.5 kB | Without provenance | Details for pystackreg-0.1.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pystackreg-0.1.0-cp36-cp36m-win_amd64.whl | CPython 3.6 | CPython 3.6 pymalloc | Windows x86-64 | Details for pystackreg-0.1.0-cp36-cp36m-win_amd64.whl |
| pystackreg-0.1.0-cp36-cp36m-win32.whl | CPython 3.6 | CPython 3.6 pymalloc | Windows x86-32 | Details for pystackreg-0.1.0-cp36-cp36m-win32.whl |
| pystackreg-0.1.0-cp27-cp27m-win_amd64.whl | CPython 2.7 | CPython 2.7 pymalloc | Windows x86-64 | Details for pystackreg-0.1.0-cp27-cp27m-win_amd64.whl |
| pystackreg-0.1.0-cp27-cp27m-win32.whl | CPython 2.7 | CPython 2.7 pymalloc | Windows x86-32 | Details for pystackreg-0.1.0-cp27-cp27m-win32.whl |
Total release size: 263.8 kB
Release files / pystackreg-0.1.0.tar.gz
| Download URL | pystackreg-0.1.0.tar.gz |
|---|---|
| Size | 29.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69746e89f62290a7964d1ab4f37c8d7510ca76f9c76fba07795f3b20fd98f6b1
|
|
BLAKE2b-256 checksum How to use checksums |
92c0b9523566730db0be9bde54159bc1654ea2c6c3c0814e475cad504e6ed870
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pystackreg-0.1.0-cp36-cp36m-win_amd64.whl
| Download URL | pystackreg-0.1.0-cp36-cp36m-win_amd64.whl |
|---|---|
| Size | 57.0 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
09a170dc35d9c78c1587887d5758b1d52b7e042468efa3e71bfd04b13b0e206c
|
|
BLAKE2b-256 checksum How to use checksums |
c6accc78b761958ec0987d6f0bacd71ce784c470edafdce2f6308fd781d2a6ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pystackreg-0.1.0-cp36-cp36m-win32.whl
| Download URL | pystackreg-0.1.0-cp36-cp36m-win32.whl |
|---|---|
| Size | 50.4 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
85bfaee18852d14498005e7840caaaa3da4f099ef0b94803eb1e37c3e0f2bbf4
|
|
BLAKE2b-256 checksum How to use checksums |
ee1fb58195c9b53d230fe8637c8aa2d7ae9d3a52879f727396f897d7794021ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pystackreg-0.1.0-cp27-cp27m-win_amd64.whl
| Download URL | pystackreg-0.1.0-cp27-cp27m-win_amd64.whl |
|---|---|
| Size | 69.0 kB |
| Tags | CPython 2.7 CPython 2.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
38b67d162049882daca06dc4484c5c5673efb91720853e373d1ad45dbb7407ae
|
|
BLAKE2b-256 checksum How to use checksums |
f5454bba000f6e6ba7a81acc9f2d089dbf30c208044de4857aee928a4d7e40d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pystackreg-0.1.0-cp27-cp27m-win32.whl
| Download URL | pystackreg-0.1.0-cp27-cp27m-win32.whl |
|---|---|
| Size | 57.9 kB |
| Tags | CPython 2.7 CPython 2.7 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
4c8d1d64573693618a4132fc2d20a9bc8cb2e44e712b1f2fa5e8ad9b4a5bd21a
|
|
BLAKE2b-256 checksum How to use checksums |
90985e0af34e28674387707aeedd351a68d1ca6fc1a6d58105e10bd182eab152
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pystackreg 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.