徕卡LAX-AF矩阵扫描器的Python API

matrixscreener的Python项目详细描述


折旧

此软件已分成几个较小的模块:

矩阵筛选器

这是一个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__.pysetup.pydoc/conf.py中更新版本

  • Git提交和标记版本

  • ./generate-rst.sh(需要pandoc)

  • 阶段发布: python setup.py sdist bdist_wheel upload -r pypitest

  • 发布:python setup.py sdist bdist_wheel upload

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
多线程Java可运行接口解决方案   java指向这些方法的uri是什么样子的   java处理:一个对象忽略if语句   在DispatcherServlet中找不到URI为[***]的HTTP请求的java映射   java Weka未启动。只有黑屏消失了   java如何根据对象的一个属性对对象数组进行排序?   eclipse在Kotlin注释参数中使用java常量   用于截锥剔除的java截锥未正确创建   java如何让多个活动使用相同的跟踪活动?   通过安卓的woocommerce api中的java错误Url   来自另一个文件的JSTL中每个循环的java   java使用安卓应用程序中的数据库保存gps位置   Java中比较linkedHashMap值和字符串的类型转换   在java中,有没有一种方法可以从一开始就使用Kafka流(而不是通过KafkaConsumer)读取消息?   使用jmonkeyengine在安卓上运行basicgame的java疑难解答   java中的millis字符串格式   Java泛型、反射API和JDBC:无法映射Java。朗和爪哇。sql。类型的时间戳   java在DynamoDB中以历元格式自动填充时间