徕卡LAX-AF矩阵扫描器的Python API
matrixscreener的Python项目详细描述
折旧
此软件已分成几个较小的模块:
- leicacam:与 徕卡显微镜通过cam tcp/ip插座。
- leicaexperiment:读取 徕卡las矩阵筛选实验(扫描输出)。
- leicascanningtemplate: 阅读徕卡矩阵筛选扫描模板(定义井等)
- leicaautomator:尝试 完全自动化显微镜扫描。
矩阵筛选器
这是一个python模块,用于与Leica LAS AF/X Matrix接口 筛分机。它能读实验,能与显微镜通讯 通过网络。
该模块可用于:
- 使用las af数据导出的实验中的缝合井
出口商
- 无损批量压缩图像
- 以编程方式选择幻灯片/井/字段/图像 属性,如
- 幻灯片
- 井位(u,v)
- 字段位置(x,y)
- z堆栈位置(z)
- 频道(C)
- 从OME-XML中读取实验数据
这个模块是在MacOSX上开发的,但是应该在Linux和 窗户也是。如果您发现任何错误,请将其报告为 issue打开 github。也欢迎拉取请求。
功能
- 作为python对象访问实验
- 压缩到PNG而不丢失精度、元数据或颜色映射
- ImageJ缝合(斐济通过 fijibin页)
- 通过CAM TCP/IP插座与显微镜通信
安装
pip install matrixscreener
示例
缝合实验
importmatrixscreener# create short handExperiment=matrixscreener.experiment.Experiment# path should contain AditionalData and slide--S*scan=Experiment('path/to/experiment')print(matrixscreener.imagej._bin)# Fiji installed via package fijibinmatrixscreener.imagej._bin='/path/to/imagej'# if path is omitted, experiment path is used for output filesstitched_images=experiment.stitch('/path/to/output/files/')
缝合特定井
frommatrixscreenerimportexperiment# path should contain AditionalData and slide--S*stitched_images=experiment.stitch('/path/to/well')
对所有图像执行操作
frommatrixscreenerimportexperimentscan=experiment.Experiment('path/to/experiment--')forimageinscan.images:dostuff...
在特定的井/田上做事
frommatrixscreenerimportexperiment# select specific partsselected_wells=[wellforwellinscan.wellsif'U00'inwell]forwellinselected_wells:dostuff...defcondition(path):x_above=experiment.attribute(path,'X')>1x_below=experiment.attribute(path,'X')<5returnx_aboveandx_belowselected_fields=[fieldforfieldinscan.fieldsifcondition(field)]forfieldinselected_fields:dostuff..
减去数据
frommatrixscreener.experimentimportattribute# get all channelschannels=[attribute(image,'C')forimageinscan.images]min_ch,max_ch=min(channels),max(channels)
与显微镜通信
frommatrixscreener.camimportCAMcam=CAM()# initiate and connect, default localhost:8895# some commands are created as short hands# start matrix scanresponse=cam.start_scan()print(response)# but you could also create your own command with a list of tuplescommand=[('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)
另请参见this notebook。
发展
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 format中的docstrings中。
API引用可用 online,可以用 pydoc或任何 用docstring自动完成的编辑器/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