低温电镜显微图像清洗的深度学习

micrograph-cleaner-em的Python项目详细描述


微克清洁剂

micrograph cleaner(micrograph_cleaner_em)是一个python包,用于分割cryo em 显微照片成:

  • 碳/高对比度或污染区域
  • 好的地区

这样就可以很容易地排除错误选择的坐标

要获得完整的使用说明,请执行

cleanmics-h

示例

cleanmics-c path/to/inputcoords/-o path/to/outputcoords/-b 180-s 1 0.0-i/path/to/micrographs/--predictedmaskdir path/to/store/masks--deepthr 0.5

安装:

水蟒(推荐)

  1. 从https://www.anaconda.com/distribution/" rel="nofollow">https://www.anaconda.com/distribution/

    安装anaconda python 3x版本
  2. 为micrographcleaner创造一个环境
    conda create-n env_micrograph_cleaner_em python=3.6

  3. 激活环境(每次您想使用micrograph_清洁剂时,都需要激活它)
    conda activate env_micrograph_cleaner_em

  4. 从存储库安装micrograph\u cleaner\u em
    conda安装-c rsanchez1369显微照片清洁剂em

  5. 下载深度学习模型
    cleanmics--下载

  6. 准备好了!

  7. < > >

    PIP/源选项:

    1. 安装CUDA和CUDNN时,应确保能够执行tensorflow(https://www.tensorflow.org/)。 micrograph_cleaner与cuda-8、cuda-9和cuda-10兼容。 TensorFlow版本将根据您的CUDA版本自动选择并在以后安装。 CUDA可在https://developer.nvidia.com/cuda-toolkit" rel="nofollow">https://developer.nvidia.com/cuda toolkit上获得,CUDNN可在 https://developer.nvidia.com/cudnn
      使用python模块cudnnenv,可以在步骤2自动执行简单的cudnn安装 < > >

      1.1)(可选)创建虚拟环境

      pip install virtualenv
      virtualenv --system-site-packages -p python3 ./env_micrograph_cleaner_em
      source ./env_micrograph_cleaner_em/bin/activate
      
      1. 安装micrograph_cleaner_em
      2. < > >
        git clone https://github.com/rsanchezgarc/micrograph_cleaner_em.git
        cd micrograph_cleaner_em
        python setup.py install
        


        pip安装micrograph\u cleaner\u em

        2.1)如果CUDNN尚未安装,则安装CUDNNENV
        pip安装cudnnenv

        执行
        cudnnenv install[版本],其中建议的版本是"v6-cuda8"用于cuda-8,"v7.0.1-cuda9"用于cuda-9和 CUDA-10的"V7.4.1-CUDA10"。

        1. 下载深度学习模型
          cleanmics--下载

        2. 准备好了!

        3. < > >

          scipion选项:

          1. 从http://scipion.i2pc.es/" rel="nofollow">http://scipion.i2pc.es/

            安装scipion版本2.0+。
          2. 从插件管理器或命令行安装xmipp
            scipion安装-p scipion em xmipp

          3. 从插件管理器或命令行安装deeplearningtoolkit
            scipion installb deeplearningtoolkit

          4. <准备好了!

          5. < > >

            用法

            micrographcleaner采用基于u-net的深度学习模型,将显微图像分割为好区域和坏区域。因此,它主要用作粒子拾取后的后处理步骤,其中排除在高对比度人工制品(如碳)中选择的坐标。此外,它还可用于生成二元掩模,以防止粒子选取器考虑问题区域。 因此,micrograph_cleaner使用一个(一些)micrograph文件名和以像素为单位的颗粒大小(相对于输入mic)。此外,它还可以作为输入接收:

            1. 一个选择的坐标所在的目录和另一个记录/清理坐标的目录将被保存。坐标将以POS格式或纯文本保存(列th header colnames x和y)位于。 每个显微照片必须有一个不同的坐标文件命名为显微照片,输出坐标将保留命名。
              例如,-c path/to/inputcoordsdirectory/-o/path/to/outputcoordsdirectory/
              允许的格式是xmipp pos和raw text tab,在头中用至少两个名为xcoor,ycoor的列分隔。 原始文本文件示例:
            2. < > >
              micFname1.tab:
              ###########################################
              xcoor ycoor otherInfo1 otherInfo2
              12  143  -1  0.1
              431  4341  0  0.2
              323  321  1  0.213
              ###########################################
              
              1. 保存预测掩码的目录(mrc格式)。 例如--predictedmaskdir path/where/predictedmaskswillbesaved/

              2. 如果从中选取坐标,则下采样因子(如果实际执行了上采样,则可以小于1) 不同比例的显微照片。
                例如,-s 2会将坐标降低一个因子2,然后它将应用与输入显微照片一样大的预测掩模。这个 案例对应于一个例子,在这个例子中,我们用于采集原始显微照片,但我们使用的是带有下采样麦克风的显微照片清洁器

              3. 以前选项的任意组合。

              4. < > >

                可在http://campins.cnb.csic.es/micrograph\u cleaner/" rel="nofollow">http://campins.cnb.csic.es/micrograph\u cleaner/上获得经过培训的micrograph cleaner模型,并可自动下载执行
                cleanmics--下载

                注意,如果使用pip/source安装micrograph_cleaner,那么cuda和cudnn库应该是 在执行之前可用,因此如果未找到CUDA,请在执行之前导出其路径

                export LD_LIBRARY_PATH=/path/to/cuda/cuda-9.0/lib64:$LD_LIBRARY_PATH
                

                然后执行cleanmicsprogram

                示例

                #Donwload deep learning model
                cleanMics --download
                    
                #Compute masks from imput micrographs and store them
                cleanMics -b $BOX_SIXE  -i  /path/to/micrographs/ --predictedMaskDir path/to/store/masks
                
                #Rule out input bad coordinates (threshold<0.5) and store them into path/to/outputCoords
                cleanMics  -c path/to/inputCoords/ -o path/to/outputCoords/ -b $BOX_SIXE -s $DOWN_FACTOR  -i  /path/to/micrographs/ --deepThr 0.5
                
                #Compute goodness scores from input coordinates and store them into path/to/outputCoords
                cleanMics  -c path/to/inputCoords/ -o path/to/outputCoords/ -b $BOX_SIXE -s $DOWN_FACTOR  -i  /path/to/micrographs/ --deepThr 0.5     
                

                原料药:

                微光清洁器中使用的基本类别是maskpredictor,一个用于预测污染/碳的类别 给面具一张显微照片。

                类显微照片清洁剂

                用法:假设一个代表显微照片的HXW形状的Numpy数组,预测HXW形状的掩模。 掩码值的范围为0。到1,等于0。与清洁区域和1相关。污染。

                建筑商
                micrograph_cleaner_em.MaskPredictor(deepLearningModelFname, boxSize , gpus=[0], strideFactor=2)
                
                    :param deepLearningModelFname (str): a path where the deep learning model will be loaded
                    :param boxSize (int): estimated particle boxSize in pixels
                    :param gpus (list of gpu ids (ints) or None): If None, CPU only mode will be employed.
                    :param strideFactor (int): Overlapping between windows. Micrographs are divided into patches and each processed individually.
                                         The overlapping factor indicates how many times a given row/column is processed by the network. The 
                                         bigger the better the predictions, but higher computational cost.
                
                方法
                predictMask(self, inputMic):
                    Obtains a contamination mask for a given inputMic
                
                    :param inputMic (np.array shape HxW): the micrograph to clean
                    :return: mask (np.array shape HxW): a mask that ranges from 0. to 1. ->
                                   0. meaning clean area and 1. contaminated area.
                
                getDownFactor(self):
                    MaskPredictor preprocess micrographs before Nnet computation. First step is donwsampling using a donwsampling factor
                    that depends on particle boxSize. This function computes the donwsampling factor
                    
                    :return (float): the donwsampling factor that MaskPredictor uses internally when preprocessing the micrographs
                    
                close(self):
                    Used to release memory
                
                示例

                以下几行显示了如何计算给定显微照片的遮罩

                from micrograph_cleaner_em import MaskPredictor
                
                deepLearningModelFname="/path/to/deepLearningModel.keras"
                boxSize=128
                mic= loadMic("do whatever you need") # mic is a np.array 
                with MaskPredictor(deepLearningModelFname, boxSize , gpus=[0]) as mp:
                    mask= mp.predict(mic)
                

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

                推荐PyPI第三方库


热门话题
java如何将cassandra中的行数据转换为与列相关的嵌套json   java如何使用jcr XPath在jcr:content/@jcr:data中搜索?   java在使用openCV进行安卓开发时如何利用手机的广角镜头   java解析扩展了接口,结束了一个潜在的无限循环   位置服务的@Override方法中存在java Android应用程序错误   java本地线程的用途和需求是什么   具有左右子访问的java节点树遍历   java验证JsonWebToken签名   JUL日志处理程序中的java日志记录   嵌入式Java读取给定时间段的串行数据。   java有没有办法从多个URL获取多个图像?   java线程通过等待intent阻止自己发送intent   java Spring MVC解析多部分内容请求   java JPA/Hibernate静态元模型属性未填充NullPointerException   java格式错误的字符(需要引号,得到I)~正在处理   java为什么PrintWriter对象抛出FileNotFoundException?   java Neo4j未正确保存标签   java IE不加载图像