view measure_object_size_shape.xml @ 6:d85f11570109 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
author bgruening
date Sun, 05 Nov 2023 09:38:07 +0000
parents acf3aa487283
children
line wrap: on
line source

<tool id="cp_measure_object_size_shape" name="MeasureObjectSizeShape" version="@CP_VERSION@+galaxy@VERSION_SUFFIX@">
    <description>with CellProfiler</description>

    <macros>
        <import>macros.xml</import>
        <token name="@VERSION_SUFFIX@">1</token>
    </macros>

    <edam_operations>
        <edam_operation>operation_3443</edam_operation>
    </edam_operations>
    <xrefs>
        <xref type="bio.tools">CellProfiler</xref>
        <xref type="biii">cellprofiler</xref>
    </xrefs>

    <expand macro="py_requirements"/>
    <expand macro="cmd_modules" />

    <configfiles>
        <inputs name="inputs" />
        <configfile name="script_file">
import json
import sys
import os

FOURSPACES=@SPACES@

input_json_path = sys.argv[1]
input_pipeline= sys.argv[2]

params = json.load(open(input_json_path, "r"))


def writemoss():
    _str = "\nMeasureObjectSizeShape:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:1|show_window:False|notes:\\x5B\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count

    for obj in params['rpt_object']:
        _str += FOURSPACES + "Select objects to measure:%s\n" % obj['objects_to_measure']

    _str += FOURSPACES + "Calculate the Zernike features?:%s\n" % params['zernike_feature']

    return _str

with open(input_pipeline) as fin:
    lines = fin.readlines()

    k, v = lines[4].strip().split(':')

    module_count = int(v)
    new_count = module_count + 1
    lines[4] = k + ":%d\n" % new_count
    with open("output.cppipe", "w") as f:
       f.writelines(lines)
       f.write(writemoss())

    f.close()
        </configfile>
    </configfiles>

    <inputs>
        <expand macro="input_pipeline_param" />
        <repeat name="rpt_object" title="new object" min="1">
            <param name="objects_to_measure" label="Enter the name of the object to measure" type="text">
                <expand macro="text_validator" />
            </param>
        </repeat>
        <param name="zernike_feature" type="select" display="radio" label="Calculate the Zernike features?" help="Select 'Yes' to calculate the Zernike shape features. Because the first 10 Zernike polynomials (from order 0 to order 9) are calculated, this operation can be time-consuming if the image contains a lot of objects. Select 'No' if you are measuring 3D objects with this module.">

            <option value="Yes">Yes</option>
            <option value="No">No</option>
        </param>
    </inputs>

    <outputs>
        <expand macro="output_pipeline_param" />
    </outputs>

    <tests>
        <test>
            <expand macro="test_input_pipeline_param" />
            <repeat name="rpt_object">
                <param name="objects_to_measure" value="Nuclei" />
            </repeat>
            <repeat name="rpt_object">
                <param name="objects_to_measure" value="Nucleoli" />
            </repeat>
            <param name="zernike_feature" value="Yes" />
            <expand macro="test_out_file" file="measure_object_size_shape.cppipe" />
        </test>
    </tests>
    <help>
        <![CDATA[

            .. class:: infomark

            **What it does**

            Given an image with identified objects (e.g., nuclei or cells), this module extracts area and shape features of each one. Note that these features are only reliable for objects that are completely inside the image borders, so you may wish to exclude objects touching the edge of the image using Identify settings for 2D objects, or by applying *FilterObjects* downstream.

            The display window for this module shows per-image aggregates for the per-object measurements. If you want to view the per-object measurements themselves, you will need to use an *Export* module to export them, or use *DisplayDataOnImage* to display the object measurements of choice overlaid on an image of choice.

            @COMMON_HELP@
            ]]>
    </help>
    <expand macro="citations" />

</tool>