Skip to main content

Camera Stage Mapping calibration

This Python module allows you to calibrate a microscope's stage against the camera. By moving the sample a known number of steps, and tracking how far the image translates, it is possible to recover the number of steps per pixel. This code goes a step further, and recovers a 2x2 affine transformation matrix, so it will cope with rotation, flipping, and non-uniform scaling of the X and Y axes. The calibration routines are designed to be relatively robust and minimally parameterised, so they start by determining a sensible step size automatically.

As part of the calibration, you can use either FFT-based or directly calculated cross correlation to track motion of the sample. This code is probably useful on its own, and is found in the fft_image_tracking and correlation_image_tracking submodules. The underlying mechanism of tracking stage and camera coordinates simultaneously is handled by the CameraStageTracker class, in camera_stage_tracker. The main calibration function is camera_stage_calibration_1d.calibrate_backlash_1d. For 2D calibration, I recommend running this once for X and once for Y, then using camera_stage_calibration_1d.image_to_stage_displacement_from_1d to combine the two calibrations. This is more robust than the 2D grid calibration method.

Hardware interface

Rather than tie these functions to a specific class interface, as found in many lab control frameworks, the calibration routines simply require functions to be passed in as arguments. This is done for maximum flexibility, and to impose the fewest necessary constraints on the hardware we are controlling. In the future, we may define a class interface to use, and would welcome input on how to do this without forcing a particular taxonomy of laboratory instruments upon everyone using the library.

Installing

pip install camera-stage-mapping

This package is published on PyPI and can be installed using pip. It's managed using poetry and can be installed by cloning the repository and running poetry install. For details of how to set up a development environment, please see CONTRIBUTING.

Documentation

The functions all have fairly extensive docstrings and the module is documented on readthedocs.

Metadata

Release files for camera-stage-mapping 0.1.10

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

Source distribution (sdist)

Source distribution for camera-stage-mapping 0.1.10
File Size Uploaded
camera_stage_mapping-0.1.10.tar.gz 36.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for camera-stage-mapping 0.1.10
File Interpreter ABI Platform
camera_stage_mapping-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 76.9 kB

Release files / camera_stage_mapping-0.1.10.tar.gz

Download URL camera_stage_mapping-0.1.10.tar.gz
Size 36.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5f58c7a21993ba187dcc7e5ba81709f237a34f020f2428d575729cdea8155ef9
BLAKE2b-256 checksum
How to use checksums
685dba4e7dc34589ecfb49a292abc098a8be71a28a428e78b1355b86f66ddb2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release files / camera_stage_mapping-0.1.10-py3-none-any.whl

Download URL camera_stage_mapping-0.1.10-py3-none-any.whl
Size 40.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5eae6146dcce1117fa40b617f4bf1122a9091cabb7750ae0ee7b6ebb7c79d2f
BLAKE2b-256 checksum
How to use checksums
8e19cb2cb10629ceb2826dbbeee2057a10bfa0e0425263db3acdfc9ef3f7ab1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

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