Skip to main content

DEPRECIATED

This software has been split up in smaller modules:

  • leicacam: Communicate with Leica microscopes over CAM TCP/IP socket.

  • leicaexperiment: Read Leica LAS Matrix Screener experiments (output from scans).

  • leicascanningtemplate: Read Leica matrix screener scanning templates (define wells etc).

  • leicaautomator: Attempt at fully automating a microscope scan.

matrixscreener

This is a python module for interfacing with Leica LAS AF/X Matrix Screener. It can read experiments and communicate with the microscope over network.

The module can be used to:

  • stitch wells from an experiment exported with the LAS AF Data Exporter

  • batch compress images lossless

  • programmatically select slides/wells/fields/images given by attributes like

    • slide (S)

    • well position (U, V)

    • field position (X, Y)

    • z-stack position (Z)

    • channel (C)

  • read experiment data from OME-XML

The module is developed on Mac OS X, but should work on Linux and Windows too. If you find any bugs, please report them as an issue on github. Pull request are also welcome.

Features

  • Access experiment as a python object

  • Compress to PNGs without loosing precision, metadata or colormap

  • ImageJ stitching (Fiji is installed via fijibin)

  • Communicate with microscope over CAM TCP/IP socket

Install

pip install matrixscreener

Examples

stitch experiment

import matrixscreener
# create short hand
Experiment = matrixscreener.experiment.Experiment

# path should contain AditionalData and slide--S*
scan = Experiment('path/to/experiment')

print(matrixscreener.imagej._bin) # Fiji installed via package fijibin
matrixscreener.imagej._bin = '/path/to/imagej'

# if path is omitted, experiment path is used for output files
stitched_images = experiment.stitch('/path/to/output/files/')

stitch specific well

from matrixscreener import experiment

# path should contain AditionalData and slide--S*
stitched_images = experiment.stitch('/path/to/well')

do stuff on all images

from matrixscreener import experiment

scan = experiment.Experiment('path/to/experiment--')

for image in scan.images:
    do stuff...

do stuff on specific wells/fields

from matrixscreener import experiment

# select specific parts
selected_wells = [well for well in scan.wells if 'U00' in well]
for well in selected_wells:
    do stuff...

def condition(path):
    x_above = experiment.attribute(path, 'X') > 1
    x_below = experiment.attribute(path, 'X') < 5
    return x_above and x_below

selected_fields = [field for field in scan.fields if condition(field)]
for field in selected_fields:
    do stuff..

subtract data

from matrixscreener.experiment import attribute

# get all channels
channels = [attribute(image, 'C') for image in scan.images]
min_ch, max_ch = min(channels), max(channels)

communicate with microscope

from matrixscreener.cam import CAM

cam = CAM()   # initiate and connect, default localhost:8895

# some commands are created as short hands
# start matrix scan
response = cam.start_scan()
print(response)

# but you could also create your own command with a list of tuples
command = [('cmd', 'enableall'),
           ('value', 'true')]
response = cam.send(command)
print(response)

# or even send it as a bytes string (note the b)
command = b'/cmd:enableall /value:true'
response = cam.send(command)
print(response)

batch lossless compress of experiment

import matrixscreener as ms

e = ms.experiment.Experiment('/path/to/experiment')
pngs = ms.experiment.compress(e.images)
print(pngs)

See also this notebook.

Develop

git clone https://github.com/arve0/matrixscreener.git
cd matrixscreener
# hack
./setup.py install

Testing

pip install tox
tox

specific test, here compression test

pip install pytest numpy
py.test -k compression tests/test_experiment.py

specific test with extra output, jump into pdb upon error

DEBUG=matrixscreener py.test -k compression tests/test_experiment.py --pdb -s

API Reference

All commands should be documented in docstrings in numpy format.

API reference is available online, can be read with pydoc or any editor/repl that does autocomplete with docstrings.

In example:

pydoc matrixscreener
pydoc matrixscreener.cam
pydoc matrixscreener.experiment
pydoc matrixscreener.imagej

Release procedure

  • Create .pypirc if missing.

    [distutils]
    index-servers=
            pypi
            pypitest
    
    [pypitest]
    repository = https://testpypi.python.org/pypi
    username = username
    password = password
    
    [pypi]
    repository = https://pypi.python.org/pypi
    username = username
    password = password
  • Update changelog.md

  • Update version in __init__.py, setup.py and doc/conf.py

  • Git commit and tag version

  • ./generate-rst.sh (pandoc needed)

  • Stage release: python setup.py sdist bdist_wheel upload -r pypitest

  • Release: python setup.py sdist bdist_wheel upload

Release files for matrixscreener 0.6.1

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

Source distribution (sdist)

Source distribution for matrixscreener 0.6.1
File Size Uploaded
matrixscreener-0.6.1.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for matrixscreener 0.6.1
File Interpreter ABI Platform
matrixscreener-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / matrixscreener-0.6.1.tar.gz

Download URL matrixscreener-0.6.1.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c898fe329a09918bdf10097642609ed6cc5be137acafc2eef9579bb88ab5833d
BLAKE2b-256 checksum
How to use checksums
f8f0fa2d42628fd53e61974c7b1d0b0d648790d8fe3fd9cc88498c5ffc90165a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / matrixscreener-0.6.1-py3-none-any.whl

Download URL matrixscreener-0.6.1-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0417ee88791f14874f69dc52e2d64c252009a167e3bb44473c8741d5873fc2f
BLAKE2b-256 checksum
How to use checksums
e1b1ed74b76ae59e51b3d5c574e0683459502df7d6c42c8a647ef697f9f8a323
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

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