Skip to main content
Release files added late

6 files were added to this release more than 14 days after its initial publication. Inspect the release files before installing.

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 (non-linear transformation; does not preserve straight lines)

pyStackReg supports the full functionality of StackReg plus some additional options, e.g., using different reference images and having access to the actual transformation matrices (please see the examples below).

Please note: The bilinear transformation cannot be propagated, as a combination of bilinear transformations does not generally result in a bilinear transformation. Therefore, stack registration/transform functions won’t work with bilinear transformation when using “previous” image as reference image. You can either use another reference (“first” or “mean” for first or mean image, respectively), or try to register/transform each image of the stack separately to its respective previous image (and use the already transformed previous image as reference for the next image).

Installation

The package is available on PyPi. Install it using:

pip install pystackreg

Documentation

The documentation can be found on readthedocs:

https://pystackreg.readthedocs.io/

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)

#Bilinear transformation
sr = StackReg(StackReg.BILINEAR)
out_bil = 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 each frame to the previous (already registered) one
# this is what the original StackReg ImageJ plugin uses
out_previous = sr.register_transform_stack(img0, reference='previous')

# 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 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)

The next example shows how to separate registration from transformation for a stack (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') # 3 dimensions : frames x width x height
img1 = io.imread('another_multiframe_image.tif') # same shape as img0

# both stacks must have the same shape
assert img0.shape == img1.shape

sr = StackReg(StackReg.RIGID_BODY)

# register each frame to the previous (already registered) one
# this is what the original StackReg ImageJ plugin uses
tmats = sr.register_stack(img0, reference='previous')
out = sr.transform_stack(img1)

# tmats contains the transformation matrices -> they can be saved
# and loaded at another time
import numpy as np
np.save('transformation_matrices.npy', tmats)

tmats_loaded = np.load('transformation_matrices.npy')

# make sure you use the correct transformation here!
sr = StackReg(StackReg.RIGID_BODY)

# transform stack using the tmats loaded from file
sr.transform_stack(img1, tmats=tmats_loaded)

# with the transformation matrices at hand you can also
# use the transformation algorithms from other packages:
from skimage import transform as tf

out = np.zeros(img0.shape).astype(np.float)

for i in range(tmats.shape[0]):
    tform = tf.AffineTransform(matrix=tmats[i, :, :])
    out[i, :, :] = tf.warp(img1[i, :, :], tform)

Author information

This is a port of the original Java code by Philippe Thevenaz to C++ with a Python wrapper around it. All credit goes to the original author:

/*====================================================================
| Philippe Thevenaz
| EPFL/STI/IMT/LIB/BM.4.137
| Station 17
| CH-1015 Lausanne VD
| Switzerland
|
| phone (CET): +41(21)693.51.61
| fax: +41(21)693.37.01
| RFC-822: philippe.thevenaz@epfl.ch
| X-400: /C=ch/A=400net/P=switch/O=epfl/S=thevenaz/G=philippe/
| URL: http://bigwww.epfl.ch/
\===================================================================*/

/*====================================================================
| This work is based on the following paper:
|
| P. Thevenaz, U.E. Ruttimann, M. Unser
| A Pyramid Approach to Subpixel Registration Based on Intensity
| IEEE Transactions on Image Processing
| vol. 7, no. 1, pp. 27-41, January 1998.
|
| This paper is available on-line at
| http://bigwww.epfl.ch/publications/thevenaz9801.html
|
| Other relevant on-line publications are available at
| http://bigwww.epfl.ch/publications/
\===================================================================*/

License

You are free to use this software for commercial and non-commercial
purposes. However, we expect you to include a citation or acknowledgement
whenever you present or publish research results that are based
on this software. You are free to modify this software or derive
works from it, but you are only allowed to distribute it under the
same terms as this license specifies. Additionally, you must include
a reference to the research paper above in all software and works
derived from this software.

Metadata

Release files for pystackreg 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Files added late

6 files were uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for pystackreg 0.2.2
File Size Uploaded Provenance Actions
pystackreg-0.2.2.tar.gz 33.5 kB Without provenance Details for pystackreg-0.2.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pystackreg 0.2.2
File Actions
pystackreg-0.2.2-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for pystackreg-0.2.2-cp39-cp39-win_amd64.whl
pystackreg-0.2.2-cp39-cp39-win32.whl CPython 3.9 CPython 3.9 Windows x86-32 Details for pystackreg-0.2.2-cp39-cp39-win32.whl
pystackreg-0.2.2-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details for pystackreg-0.2.2-cp38-cp38-win_amd64.whl
pystackreg-0.2.2-cp38-cp38-win32.whl CPython 3.8 CPython 3.8 Windows x86-32 Details for pystackreg-0.2.2-cp38-cp38-win32.whl
pystackreg-0.2.2-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details for pystackreg-0.2.2-cp37-cp37m-win_amd64.whl
pystackreg-0.2.2-cp37-cp37m-win32.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-32 Details for pystackreg-0.2.2-cp37-cp37m-win32.whl
pystackreg-0.2.2-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details for pystackreg-0.2.2-cp36-cp36m-win_amd64.whl
pystackreg-0.2.2-cp36-cp36m-win32.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-32 Details for pystackreg-0.2.2-cp36-cp36m-win32.whl
pystackreg-0.2.2-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details for pystackreg-0.2.2-cp35-cp35m-win_amd64.whl
pystackreg-0.2.2-cp35-cp35m-win32.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-32 Details for pystackreg-0.2.2-cp35-cp35m-win32.whl
pystackreg-0.2.2-cp27-cp27m-win_amd64.whl CPython 2.7 CPython 2.7 pymalloc Windows x86-64 Details for pystackreg-0.2.2-cp27-cp27m-win_amd64.whl
pystackreg-0.2.2-cp27-cp27m-win32.whl CPython 2.7 CPython 2.7 pymalloc Windows x86-32 Details for pystackreg-0.2.2-cp27-cp27m-win32.whl

Total release size: 782.0 kB

Release files / pystackreg-0.2.2.tar.gz

Download URL pystackreg-0.2.2.tar.gz
Size 33.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2bc8bdac892bb827cd2725b8ee45bbcdb8835f2fb1d41863f6d50c77f7e36ccc
BLAKE2b-256 checksum
How to use checksums
9ac3d2a84134739dbff00aab3079d6d1371a76713d9f9f29a4315a29b45364d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / pystackreg-0.2.2-cp39-cp39-win_amd64.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL pystackreg-0.2.2-cp39-cp39-win_amd64.whl
Size 62.1 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
3731429a913a13473cdcd2da11fd862f4026e4cea05b4f0d5833cb0c937cae90
BLAKE2b-256 checksum
How to use checksums
f1bb0d461afb77c028a25cf225f1da0cde3a64ea771fe3203c2815e06e10ed6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

Release files / pystackreg-0.2.2-cp39-cp39-win32.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL pystackreg-0.2.2-cp39-cp39-win32.whl
Size 53.6 kB
Tags CPython 3.9 Windows x86-32
SHA-256 checksum
How to use checksums
42163fd7a3ca007cd0d599658f85c2a5e1caa4a8c6120dfbf7b27c2d299e4baa
BLAKE2b-256 checksum
How to use checksums
adfac676b244722b1c9df76f391a92881c4ceea45754b2bbc83f604f6dbd0231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

Release files / pystackreg-0.2.2-cp38-cp38-win_amd64.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL pystackreg-0.2.2-cp38-cp38-win_amd64.whl
Size 62.1 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
4a3120f847a07c11eaf6f1c1a976f086603f69efd6cf12517381e34bd424a4c1
BLAKE2b-256 checksum
How to use checksums
f8c38db608d6c65b788946ab91458a148ec2287d44f3ded138b7fe6703a11835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / pystackreg-0.2.2-cp38-cp38-win32.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL pystackreg-0.2.2-cp38-cp38-win32.whl
Size 53.6 kB
Tags CPython 3.8 Windows x86-32
SHA-256 checksum
How to use checksums
f3b5af8ada39a81cd722f04b3f26df1918a66d88ae0c8ebc2e912f23835e2a0f
BLAKE2b-256 checksum
How to use checksums
b0a95a6af9dfda0cf9f939e7411bbac914b4e32909ea398341aef97e96506e38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / pystackreg-0.2.2-cp37-cp37m-win_amd64.whl

Download URL pystackreg-0.2.2-cp37-cp37m-win_amd64.whl
Size 72.1 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
5ab2b29543b20ef095c5ec5d4d33f7f7593f1bee95fd29cf652543d08accd391
BLAKE2b-256 checksum
How to use checksums
9e2758f0cfedcbb7bb78100bfbf1d3c035373bfeab6c29063d7ea8fd71a498bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / pystackreg-0.2.2-cp37-cp37m-win32.whl

Download URL pystackreg-0.2.2-cp37-cp37m-win32.whl
Size 61.1 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
717dc5d905623fb765783af3c403fede119b09c8568219c2052afacf3aaaedb2
BLAKE2b-256 checksum
How to use checksums
356349cc32731b5ed1e78fd008c44b919be3c7ed9b039fa26ec58c3d3208bd40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / pystackreg-0.2.2-cp36-cp36m-win_amd64.whl

Download URL pystackreg-0.2.2-cp36-cp36m-win_amd64.whl
Size 72.1 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
611795a842f96bb3f94cc1dbadefe2aa23d61d5bc9fb18efa7a80afe47af4ffd
BLAKE2b-256 checksum
How to use checksums
f2dfec6a9a91e9c64932cdd3a8ed52d6907aa736dab86ec5eed834687ca9d7f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / pystackreg-0.2.2-cp36-cp36m-win32.whl

Download URL pystackreg-0.2.2-cp36-cp36m-win32.whl
Size 61.1 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
d2a46e4e076c03680bf44276f6cd7e61cfa3586debb7e4f19da50490156548db
BLAKE2b-256 checksum
How to use checksums
ff59e4a3fe84a8221b83fb35f4ba30387996389584b61f66d7f4fbc2e77126a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / pystackreg-0.2.2-cp35-cp35m-win_amd64.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL pystackreg-0.2.2-cp35-cp35m-win_amd64.whl
Size 61.9 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
ee0c5fa49b98e09ebda4fd1c4449b3fec9eb7f7fe546662bff26e28f2bcba93a
BLAKE2b-256 checksum
How to use checksums
69d1473a49dd20bf2e2a5be6652a2b820a834245445bb587d02237c767332bc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.5.4

Release files / pystackreg-0.2.2-cp35-cp35m-win32.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL pystackreg-0.2.2-cp35-cp35m-win32.whl
Size 53.4 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
baa3076659d3745109c21747766249b8527b98459aab5427e19794937edab92b
BLAKE2b-256 checksum
How to use checksums
f6704f190d836ed654b3faffae6e247de49d478727b7d6af794d94c467dd5557
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.5.4

Release files / pystackreg-0.2.2-cp27-cp27m-win_amd64.whl

Download URL pystackreg-0.2.2-cp27-cp27m-win_amd64.whl
Size 73.4 kB
Tags CPython 2.7 CPython 2.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
672523a7dde3f61ae8cd671f0c4c2c278375788312eb7c53fbb2d4407b181200
BLAKE2b-256 checksum
How to use checksums
3d7d907ec5422a51d8ac8ddc9dbefdb49ac225c01fd8c879f37fdd12653f9645
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / pystackreg-0.2.2-cp27-cp27m-win32.whl

Download URL pystackreg-0.2.2-cp27-cp27m-win32.whl
Size 61.8 kB
Tags CPython 2.7 CPython 2.7 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
7cadb9712e2632486f58e293ca754561837654a8fb317fa55d85e1385bcd5dc6
BLAKE2b-256 checksum
How to use checksums
9e30b6048773f2e4108e7c5cd90fedebbca0e1ebbbbd502441b03bd9ea2789ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Security for pystackreg 0.2.2

Upload timing

Release files added late

6 files were uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.


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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page