view unmicst.xml @ 0:6bec4fef6b2e draft

"planemo upload for repository https://github.com/ohsu-comp-bio/unmicst commit 73e4cae15f2d7cdc86719e77470eb00af4b6ebb7-dirty"
author perssond
date Fri, 12 Mar 2021 00:17:29 +0000
parents
children 74fe58ff55a5
line wrap: on
line source

<tool id="unmicst" name="UnMicst" version="@VERSION@.1" profile="17.09">
    <description>UNet Model for Identifying Cells and Segmenting Tissue</description>
    <macros>
        <import>macros.xml</import>
    </macros>
 
    <expand macro="requirements"/>
    @VERSION_CMD@

    <command detect_errors="exit_code"><![CDATA[
    #set $typeCorrected = str($image.name).replace('.ome.tiff','').replace('.ome.tif','').replace('.tiff','').replace('.tif','')+'.ome.tif'

    ln -s $image '$typeCorrected';

    @CMD_BEGIN@ '$typeCorrected'
    
    #if $stackoutput
    --stackOutput
    #end if

    --outputPath `pwd`
    --channel $channel
    --model $model
    --mean $mean
    --std $stdev
    --scalingFactor $scalingfactor;

    ## Move files to different files for from_work_dir differentiation
    #if $stackoutput
    mv *Probabilities*.tif Probabilities.tif;
    mv *Preview*.tif Preview.tif
    #else
    mv *ContoursPM*.tif ContoursPM.tif;
    mv *NucleiPM*.tif NucleiPM.tif
    #end if
    ]]></command>

    <inputs>
        <param name="image" type="data" format="tiff" label="Registered TIFF"/>
        <param name="model" type="select" label="Model">
            <option value="nucleiDAPI">nucleiDAPI</option>
            <option value="mousenucleiDAPI">mousenucleiDAPI</option>
            <option value="CytoplasmIncell">CytoplasmIncell</option>
            <option value="CytoplasmZeissNikon">CytoplasmZeissNikon</option>
        </param>
        <param name="mean" type="float" value="-1" label="Mean (-1 for model default)"/>
        <param name="stdev" type="float" value="-1" label="Standard Deviation (-1 for model default)"/>
        <param name="channel" type="integer" value="0" label="Channel to perform inference on"/>
        <param name="stackoutput" type="boolean"  label="Stack probability map outputs"/>
        <param name="scalingfactor" type="float" value="1.0" label="Factor to scale by"/>
    </inputs>

    <outputs>
        <data format="tiff" name="previews" from_work_dir="Preview.tif" label="${tool.name} on ${on_string}: Preview">
            <filter>stackoutput</filter>
        </data>
        <data format="tiff" name="probabilities" from_work_dir="Probabilities.tif" label="${tool.name} on ${on_string}: Probabilities">
            <filter>stackoutput</filter>
        </data>
        <data format="tiff" name="contours" from_work_dir="ContoursPM.tif" label="${tool.name} on ${on_string}: ContoursPM">
            <filter>not stackoutput</filter>
        </data>
        <data format="tiff" name="nuclei" from_work_dir="NucleiPM.tif" label="${tool.name} on ${on_string}: NucleiPM">
            <filter>not stackoutput</filter>
        </data>
    </outputs>
    <help><![CDATA[
UnMicst - UNet Model for Identifying Cells and Segmenting Tissue
Image Preprocessing
Images can be preprocessed by inferring nuclei contours via a pretrained UNet model. The model is trained on 3 classes : background, nuclei contours and nuclei centers. The resulting probability maps can then be loaded into any modular segmentation pipeline that may use (but not limited to) a marker controlled watershed algorithm.

The only input file is: an .ome.tif or .tif (preferably flat field corrected, minimal saturated pixels, and in focus. The model is trained on images acquired at 20x with binning 2x2 or a pixel size of 0.65 microns/px. If your settings differ, you can upsample/downsample to some extent.

Running as a Docker container

The docker image is distributed through Dockerhub and includes UnMicst with all of its dependencies. Parallel images with and without gpu support are available.

docker pull labsyspharm/unmicst:latest
docker pull labsyspharm/unmicst:latest-gpu
Instatiate a container and mount the input directory containing your image.

docker run -it --runtime=nvidia -v /path/to/data:/data labsyspharm/unmicst:latest-gpu bash
When using the CPU-only image, --runtime=nvidia can be omitted:

docker run -it -v /path/to/data:/data labsyspharm/unmicst:latest bash
UnMicst resides in the /app directory inside the container:

root@0ea0cdc46c8f:/# python app/UnMicst.py /data/input/my.tif --outputPath /data/results
Running in a Conda environment

If Docker is not available on your system, you can run the tool locally by creating a Conda environment. Ensure conda is installed on your system, then clone the repo and use conda.yml to create the environment.

git clone https://github.com/HMS-IDAC/UnMicst.git
cd UnMicst
conda env create -f conda.yml
conda activate unmicst
python UnMicst.py /path/to/input.tif --outputPath /path/to/results/directory
References:
S Saka, Y Wang, J Kishi, A Zhu, Y Zeng, W Xie, K Kirli, C Yapp, M Cicconet, BJ Beliveau, SW Lapan, S Yin, M Lin, E Boyde, PS Kaeser, G Pihan, GM Church, P Yin, Highly multiplexed in situ protein imaging with signal amplification by Immuno-SABER, Nat Biotechnology (accepted)

OHSU Wrapper Repo: https://github.com/ohsu-comp-bio/UnMicst
    ]]></help>
    <expand macro="citations" />
</tool>