view s3segmenter.xml @ 1:41e8efe8df43 draft

"planemo upload for repository https://github.com/ohsu-comp-bio/S3segmenter commit c8f72e04db2cc6cc26f0359d5aa3b1a972bc6d53"
author watsocam
date Fri, 11 Mar 2022 23:37:49 +0000
parents 37acf42a824b
children 96d0d969ebc9
line wrap: on
line source

<tool id="s3segmenter" name="s3segmenter" version="@VERSION@.0" profile="17.09">
    <description>S3segmenter is a Python-based set of functions that generates single cell (nuclei and cytoplasm) label masks.</description>
    <macros>
        <import>macros.xml</import>
    </macros>
 
    <expand macro="requirements"/>
    @VERSION_CMD@

    <command detect_errors="exit_code"><![CDATA[

        ln -s '${imagePath}' ./image.tif;

        #if $contoursClassProbPath
        ln -s ${contoursClassProbPath} ./ContoursPM.tif;
        #end if

        #if $nucleiClassProbPath
        ln -s ${nucleiClassProbPath} ./NucleiPM.tif;
        #end if

        #if $stackProbPath
        ln -s ${stackProbPath} ./Probabilities.tif;
        #end if


        @CMD_BEGIN@ 
        --imagePath ./image.tif

        #if $contoursClassProbPath
        --contoursClassProbPath ./ContoursPM.tif
        #end if

        #if $nucleiClassProbPath
        --nucleiClassProbPath ./NucleiPM.tif
        #end if

        #if $stackProbPath
        --stackProbPath ./Probabilities.tif
        #end if

        --probMapChan $probMapChan
        --crop $crop_select.crop
        
        #if $crop_select.crop == "dearray"
          --maskPath $crop_select.maskPath
        #end if

        --cytoMethod $cytoMethod
        --nucleiFilter $nucleiFilter
        --nucleiRegion $nucleiRegion_select.nucleiRegion

        #if $nucleiRegion_select.nucleiRegion == "pixellevel"
          --pixelThreshold $nucleiRegion_select.pixelThreshold
          --pixelMaskChan $nucleiRegion_select.pixelMaskChan
        #end if

        --segmentCytoplasm $segmentCytoplasm
        --cytoDilation $adv.cytoDilation
        --logSigma $adv.logSigma
        --CytoMaskChan $adv.CytoMaskChan
        ##--TissueMaskChan $adv.TissueMaskChan
        --detectPuncta $adv.detectPuncta
        --punctaSigma $adv.punctaSigma
        --punctaSD $adv.punctaSD

        #if not $saveMask
        --saveMask
        #end if

        #if not $saveFig
        --saveFig
        #end if

        --outputPath .
    ]]></command>


    <inputs>

        <param name="imagePath" type="data" format="tiff" label="Image File"/>
        <param name="contoursClassProbPath" type="data" format="tiff" optional="true" label="Contours Class Probabilities"/>
        <param name="nucleiClassProbPath" type="data" format="tiff" optional="true" label="Nuclei Class Probabilities"/>
        <param name="stackProbPath" type="data" format="tiff" optional="true" label="Stack Probabilities"/>
        <param name="probMapChan" type="integer" value="-1" label="Probability Maps Channel"/>

        <conditional name="crop_select">
            <param name="crop" type="select" label="Crop Strategy">
                <option selected="true" value="noCrop">No Crop</option>
                <option value="autoCrop">Automatic Crop</option>
                <option value="dearray">De-array</option>
                <option value="plate">Plate</option>
            </param>
            <when value="dearray">
                <param name="maskPath" type="data" format="tiff" label="TMA Mask File"/>
            </when>
        </conditional>

        <param name="cytoMethod" type="select" label="Cyto Method">
            <option value="hybrid">Hybrid</option>
            <option selected="true" value="distanceTransform">Distance Transform</option>
            <option value="bwdistanceTransform">BW Distance Transform</option>
            <option value="ring">Ring</option>
        </param>
        <param name="nucleiFilter" type="select" label="Nuclei Filter">
            <option selected="true" value="IntPM">IntPM</option>
            <option value="LoG">LoG</option>
            <option value="Int">Int</option>
            <option value="none">none</option>
        </param>

        <conditional name="nucleiRegion_select">
            <param name="nucleiRegion" type="select" label="Nuclei Region">
                <option value="watershedContourDist">watershedContourDist</option>
                <option selected="true" value="watershedContourInt">watershedContourInt</option>
                <option value="watershedBWDist">watershedBWDist</option>
                <option value="dilation">dilation</option>
                <option value="localThreshold">localThreshold</option>
                <option value="localMax">localMax</option>
                <option value="bypass">bypass</option>
                <option value="pixellevel">pixellevel</option>
            </param>
            <when value="pixellevel">
                <param name="pixelThreshold" type="float" value="-1.0" Label="Pixel Threshold"/>
                <param name="pixelMaskChan" type="text" value="2" Label="Pixel Mask Channel"/>
            </when>
        </conditional>

        <param name="segmentCytoplasm" type="select" label="Segment Cytoplasm">
            <option value="segmentCytoplasm">segmentCytoplasm</option>
            <option selected="true" value="ignoreCytoplasm">ignoreCytoplasm</option>
        </param>
        <param name="saveMask" type="boolean" checked="true" label="Save Mask"/>
        <param name="saveFig" type="boolean" checked="true" label="Save Figure"/>

        <section name="adv" title="Advanced Options" expanded="false">
            <param name="cytoDilation" type="integer" value="5" label="Cyto Dilation"/>
            <param name="logSigma" type="text" value="3 60" label="logSigma"/>
            <param name="CytoMaskChan" type="text" value="2" label="Cyto Mask Channel"/>
            <!-- Bug with S3Segmenter code, expects int not list
            <param name="TissueMaskChan" type="text" value="-1" label="Tissue Mask Channel"/>
            -->
            <param name="detectPuncta" type="text" value="-1" label="Detect Puncta"/>
            <param name="punctaSigma" type="text" value="1" label="Puncta Sigma"/>
            <param name="punctaSD" type="text" value="4" label="Puncta SD"/>
        </section>
        

    </inputs>
    <outputs>
        <data format="tiff" name="cell_mask" from_work_dir="image/cell.ome.tif" label="cellMasks">
            <filter>saveMask is True</filter>
        </data>
        <data format="tiff" name="nuclei_mask" from_work_dir="image/nuclei.ome.tif" label="nucleiMasks">
            <filter>saveMask is True</filter>
        </data>
	<data format="tiff" name="cell_outlines" from_work_dir="image/qc/cellOutlines.ome.tif" label="cellOutlines">
            <filter>saveFig is True</filter>
        </data>
	<data format="tiff" name="nuclei_outlines" from_work_dir="image/qc/nucleiOutlines.ome.tif" label="nucleiOutlines">
            <filter>saveFig is True</filter>
        </data>
    </outputs>
    <help><![CDATA[
Inputs are:

1. an .ome.tif (preferably flat field corrected)
2. a 3-class probability maps derived from a deep learning model such as UNet. Classes include background, nuclei contours, and nuclei foreground.

The centers of each nuclei are obtained by finding local maxima from the nuclei foreground. These are used for marker-controlled watershed constrained by the nuclei contours.

To segment cytoplasm, the nuclei are in turn used for a marker-controlled watershed segmentation constrained by a cytoplasmic marker such as B-catenin. The channel number of this marker must be specified. A 3-pixel annulus around each nucleus will also be used to segment cytoplasm.

The source repository can be found here: https://github.com/HMS-IDAC/S3segmenter
OHSU Wrapper Repo: https://github.com/ohsu-comp-bio/S3segmenter
    ]]></help>
    <expand macro="citations" />
</tool>