处理IMC数据的工具
imctools的Python项目详细描述
IMCTools
一种IMC文件转换工具,旨在将IMC rawfiles(.mcd,.txt)转换为包含所有相关元数据的中间OME.tiff。此外,它还包含生成更简单的tiff文件的工具,这些文件可以直接用作cellproviller、ilastik、fiji等的输入文件。
进一步的imctools可以直接作为fiji插件使用jython语言。这使得imc数据可以在斐济直接可视化。
有关相关分段管线的说明,请访问:https://github.com/BodenmillerGroup/ImcSegmentationPipeline
文档:https://imctools.readthedocs.io
功能
- 使用内存映射进行MCD惰性数据访问
- 完整的MCD元数据访问
- TXT文件加载
- OME-TIFF加载
- OME-TIFF/TIFF导出(包括可选压缩)
先决条件
- 该软件包是为python3编写的,但也应适用于python2
- 核心函数有一个“基本”的纯python/jython实现,在标准库之外没有依赖关系。
- fast函数确实需要安装python包,如numpy、scipy等。
安装
使用pip安装管理器直接从github安装包:
pip install git+https://github.com/BodenmillerGroup/imctools.git
用法
imctools通常从jupyter用作预处理管道的一部分,主要使用“script”包装函数。检查“笔记本/示例预处理”pipline.ipynb作为模板
进一步的IMCTools可以直接用作模块:
importimctools.io.mcdparserasmcdparserimportimctools.io.txtparserastxtparserimportimctools.io.ometiffparserasomeparserimportimctools.io.mcdxmlparserasmetafn_mcd='/home/vitoz/Data/varia/201708_instrument_comp/mcd/20170815_imccomp_zoidberg_conc5_acm1.mcd'mcd=mcdparser.McdParser(fn_mcd)# parsed Metadata Accessmcd.acquisition_idsmcd.get_acquisition_channels('1')mcd.get_acquisition_description('1')# a metadata object for comprehensive metadata accessacmeta=mcd.meta.get_object(meta.ACQUISITION,'1')acmeta.properties# The common class to represent a single IMC acquisition is# The IMC acuqisition class.# All parser classes have a 'get_imc_acquisition' methodimc_ac=mcd.get_imc_acquisition('1')# imc acquisitions can yield the image dataimage_matrix=imc_ac.get_img_by_metal('Ir191')# or can be used to save the images using the image writer classfn_out='/home/vitoz/temp/test.ome.tiff'img=imc_ac.get_image_writer(filename=fn_out,metals=['Ir191','Yb172'])img.save_image(mode='ome',compression=0,dtype=None,bigtiff=False)# as the mcd object is using lazy loading memory maps, it needs to be closed# or used with a context manager.mcd.close()