Skip to main content

Microscope control plugin for Napari via Python Microscope.

Current development stage is whatever comes before alpha and “proof of concept”.

To test

I haven’t had access to real hardware yet, so this has all been developed with simulated devices.

  1. Start the device server with simulated devices.

    1. Create a device server configuration file like so:

      import microscope
      from microscope.device_server import device
      from microscope.simulators import (
          SimulatedCamera,
          SimulatedFilterWheel,
          SimulatedLightSource,
          SimulatedStage,
      )
      
      DEVICES = [
          device(SimulatedCamera, "localhost", 8000,),
          device(SimulatedLightSource, "localhost", 8001),
          device(SimulatedFilterWheel, "localhost", 8002,
                 {"positions": 6}),
          device(SimulatedStage, "localhost", 8003,
                 {"limits": {"X": microscope.AxisLimits(0, 25000),
                             "Y": microscope.AxisLimits(0, 12000)}}),
      ]
    2. Start the device server (ensure port 8000-8003 are unused):

      $ device-server path-to-microscope-config.py
  2. Start napari

  3. Plugins > Add Dock Widget > microscope: MicroscopeWidget

  4. Connect to the camera:

    1. On the new widget, click on the “Add device” button.

    2. Enter the camera URI PYRO:SimulatedCamera@localhost:8000

5. Tick the Enabled box to enable the camera and then press the “Snap” button.

6. A random values image will appear displayed on the napari viewer. Keep pressing the “Snap” button to get new images. The top left corner of the image is the simulated image number.

  1. Connect to the other simulated devices. Their URIs are:

    1. PYRO:SimulatedLightSource@localhost:8001

    2. PYRO:SimulatedFilterWheel@localhost:8002

    3. PYRO:SimulatedStage@localhost:8003

8. Changing the other simulated devices, doesn’t really do much (but does change state of the devices, as can be seen in the logs)

Test with stage aware camera

This is pretty much the same as before but one can use a large RGB TIFF (histology samples are perfect) to simulate a camera that returns subsections of the image file based on the simulated stage position.

For quick example, try:

wget https://zenodo.org/record/1445489/files/B0002.tif

And use the following device server configuration file:

from microscope.device_server import device
from microscope.simulators.stage_aware_camera import simulated_setup_from_image

DEVICES = [
    device(simulated_setup_from_image, "localhost", 8000,
           conf={"filepath": "B0002.tif"}),
]

The URI for the devices will be:

PYRO:camera@localhost:8000
PYRO:filterwheel@localhost:8000
PYRO:stage@localhost:8000

Changing the filterwheel changes which channel from the image is returned. Changing the stage coordinates changes the image that is returned (but beware of the corners, pixels outside the image size are not handled yet and will give an error).

Metadata

Release files for napari-microscope 0.0.3

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

Source distribution (sdist)

Source distribution for napari-microscope 0.0.3
File Size Uploaded Provenance Actions
napari-microscope-0.0.3.tar.gz 17.6 kB Without provenance Details for napari-microscope-0.0.3.tar.gz

Release files / napari-microscope-0.0.3.tar.gz

Download URL napari-microscope-0.0.3.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
65efe52ed6ac1ee312256d87ec8e3945738cd93449f0a55c6bf75f48cc232fe1
BLAKE2b-256 checksum
How to use checksums
a6d2a8afde0b94c0b7bbd779beceaaf234493782cadabf788c4a36244b69395b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

Security for napari-microscope 0.0.3

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.

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file No provenance

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