Leica LAS AF MatrixScreener的Python API
项目描述
已弃用
此软件已拆分为更小的模块
leicacam:通过CAM TCP/IP套接字与Leica显微镜通信。
leicaexperiment:读取Leica LAS Matrix Screener实验(扫描输出)。
leicascanningtemplate:读取Leica矩阵筛选扫描模板(定义孔等)。
leicaautomator:尝试完全自动化显微镜扫描。
matrixscreener
这是一个用于与Leica LAS AF/X Matrix Screener接口的Python模块。它可以读取实验并通过网络与显微镜通信。
该模块可用于
从使用LAS AF Data Exporter导出的实验中拼接孔
批量无损压缩图像
根据属性(如
幻灯片(S)
孔位置(U,V)
字段位置(X,Y)
z堆栈位置(Z)
通道(C)
从OME-XML读取实验数据
该模块是在Mac OS X上开发的,但应也能在Linux和Windows上工作。如果您发现任何错误,请在github上提交问题。也欢迎Pull request。
功能
将实验作为Python对象访问
压缩到PNG文件,不丢失精度、元数据或颜色图
ImageJ拼接(Fiji通过fijibin安装)
通过CAM TCP/IP套接字与显微镜通信
安装
pip install matrixscreener
示例
拼接实验
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/')
拼接特定孔
from matrixscreener import experiment
# path should contain AditionalData and slide--S*
stitched_images = experiment.stitch('/path/to/well')
对所有图像执行操作
from matrixscreener import experiment
scan = experiment.Experiment('path/to/experiment--')
for image in scan.images:
do stuff...
对特定孔/区域执行操作
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..
减去数据
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)
与显微镜通信
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)
批量无损压缩实验
import matrixscreener as ms e = ms.experiment.Experiment('/path/to/experiment') pngs = ms.experiment.compress(e.images) print(pngs)
另请参阅 此笔记本。
开发
git clone https://github.com/arve0/matrixscreener.git cd matrixscreener # hack ./setup.py install
测试
pip install tox tox
特定测试,这里指压缩测试
pip install pytest numpy py.test -k compression tests/test_experiment.py
具有额外输出的特定测试,出错时跳入pdb
DEBUG=matrixscreener py.test -k compression tests/test_experiment.py --pdb -s
API参考
所有命令应在numpy格式的docstrings中记录。
API参考可在网上找到,可以用pydoc或任何具有docstrings自动补全功能的编辑器/repl进行阅读。
在示例中
pydoc matrixscreener pydoc matrixscreener.cam pydoc matrixscreener.experiment pydoc matrixscreener.imagej
发布程序
如果缺失,请创建.pypirc。
[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
更新changelog.md
更新__init__.py、setup.py和doc/conf.py中的版本
Git提交并标记版本
./generate-rst.sh(需要pandoc)
暂存发布:python setup.py sdist bdist_wheel upload -r pypitest
发布:python setup.py sdist bdist_wheel upload
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分布
构建分布
matrixscreener-0.6.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | c898fe329a09918bdf10097642609ed6cc5be137acafc2eef9579bb88ab5833d |
|
MD5 | ce1a9b694a4ebae09969834ce42bb6fd |
|
BLAKE2b-256 | f8f0fa2d42628fd53e61974c7b1d0b0d648790d8fe3fd9cc88498c5ffc90165a |
matrixscreener-0.6.1-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d0417ee88791f14874f69dc52e2d64c252009a167e3bb44473c8741d5873fc2f |
|
MD5 | a10321510e1de13be02be9a9a460332d |
|
BLAKE2b-256 | e1b1ed74b76ae59e51b3d5c574e0683459502df7d6c42c8a647ef697f9f8a323 |