https://github.com/arve0/leicaexperiment
Python object for reading Leica LAS Matrix Screener experiments
https://github.com/arve0/leicaexperiment
Last synced: 21 days ago
JSON representation
Python object for reading Leica LAS Matrix Screener experiments
- Host: GitHub
- URL: https://github.com/arve0/leicaexperiment
- Owner: arve0
- License: mit
- Created: 2014-11-17T18:42:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-04-04T17:16:35.000Z (about 7 years ago)
- Last Synced: 2025-04-07T22:51:11.843Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 1.31 MB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# leicaexperiment
[![build-status-image]][travis]
[![pypi-version]][pypi]
[![wheel]][pypi]## Overview
This is a python module for interfacing with *Leica LAS AF/X Matrix Screener*
experiments.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)## Features
- Access experiment as a python object
- Compress to PNGs without loosing precision, metadata or colormap
- ImageJ stitching (Fiji is installed via [fijibin](https://github.com/arve0/fijibin))## Installation
Install using `pip`...
```bash
pip install leicaexperiment
```## Examples
#### stitch experiment
```python
from leicaexperiment import Experiment# path should contain AditionalData and slide--S*
experiment = Experiment('path/to/experiment')# if path is omitted, experiment path is used for output files
stitched_images = experiment.stitch('/path/to/output/files/')# get information about placement of images in the stitch
xs, ys, attrs = experiment.stitch_coordinates(well_x=0, well_y=0)
```#### stitch specific well
```python
from leicaexperiment import stitchstitched_images = stitch('/path/to/well')
```#### do stuff on all images
```python
from leicaexperiment import Experimentexperiment = Experiment('path/to/experiment--')
for image in experiment.images:
do stuff...
```#### do stuff on specific wells/fields
```python
from leicaexperiment import Experiment
from PIL import Imageexperiment = Experiment('path/to/experiment--')
# on images in well --U00--V00
for well in experiment.well_images(0, 0):
do stuff...# rotate top left image in all rows
rows = experiment.well_rows
for r in rows:
img_path = experiment.image(r, 0, 0, 0)
img = Image.open(img_path)
img = img.rotate(90)
img.save(img_path)
```#### subtract attributes from file names
```python
from leicaexperiment import attribute# get all channels
channels = [attribute(image, 'C') for image in experiment.images]
min_ch, max_ch = min(channels), max(channels)
```#### batch lossless compress of experiment
```python
from leicaexperiment import Experimente = Experiment('/path/to/experiment')
pngs = e.compress()
print(pngs)
```## API reference
API reference is at http://leicaexperiment.rtfd.org.
## Development
Install dependencies and link development version of leicaexperiment to pip:
```bash
git clone https://github.com/arve0/leicaexperiment
cd leicaexperiment
pip install -r requirements.txt
```#### run test
```bash
pip install tox
tox
```#### extra output, jump into pdb upon error
```bash
DEBUG=leicaexperiment tox -- --pdb -s
```#### build api reference
```bash
pip install -r docs/requirements.txt
make docs
```[build-status-image]: https://secure.travis-ci.org/arve0/leicaexperiment.png?branch=master
[travis]: http://travis-ci.org/arve0/leicaexperiment?branch=master
[pypi-version]: https://img.shields.io/pypi/v/leicaexperiment.svg
[pypi]: https://pypi.python.org/pypi/leicaexperiment
[wheel]: https://img.shields.io/pypi/wheel/leicaexperiment.svg