view measure_object_intensity.xml @ 4:980aed9e8fd5 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
author bgruening
date Sat, 06 Feb 2021 09:55:43 +0000
parents b867e9317a06
children 407925835dd9
line wrap: on
line source

<tool id="cp_measure_object_intensity" name="MeasureObjectIntensity" version="@CP_VERSION@">
    <description>measure several intensity features for identified objects</description>

    <macros>
        <import>macros.xml</import>
    </macros>

    <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 writemoi():
    _str = "\nMeasureObjectIntensity:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:3|show_window:False|notes:\\x5B\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count

    hidden = len(params['rpt_image'])

    _str += FOURSPACES + "Hidden:%d\n" % hidden

    for img in params['rpt_image']:
        _str += FOURSPACES + "Select an image to measure:%s\n" % img['image_to_measure']

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

    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(writemoi())

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

    <inputs>
        <expand macro="input_pipeline_param" />
        <repeat name="rpt_image" title="new image" min="1">
            <param name="image_to_measure" label="Enter the name of an image to measure" type="text">
                <expand macro="text_validator" />
            </param>
        </repeat>

        <repeat name="rpt_object" title="new object" min="1">
            <param name="objects_to_measure" label="Enter the name of the objects to measure" type="text">
                <expand macro="text_validator" />
            </param>
        </repeat>
    </inputs>

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

    <tests>
        <test>
            <expand macro="test_input_pipeline_param" />
            <repeat name="rpt_image">
                <param name="image_to_measure" value="DNA"/>
            </repeat>
            <repeat name="rpt_object">
                <param name="objects_to_measure" value="Nuclei" />
            </repeat>
            <expand macro="test_out_file" file="measure_object_intensity.cppipe" />
        </test>
    </tests>

    <help>
        <![CDATA[

            .. class:: infomark

            **What it does**

            MeasureObjectIntensity measures several intensity features for identified objects.

            Given an image with objects identified (e.g., nuclei or cells), this module extracts intensity features for each object based on one or more corresponding grayscale images.
            Measurements are recorded for each object.
            Intensity measurements are made for all combinations of the images and objects entered.
            If you want only specific image/object measurements, you can use multiple MeasureObjectIntensity modules for each group of measurements desired.
            Note that for publication purposes, the units of intensity from microscopy images are usually described as “Intensity units” or “Arbitrary intensity units” because microscopes are not calibrated to an absolute scale.
            Also, it is important to note whether you are reporting the mean vs. the integrated intensity, so specify “Mean intensity units” or “Integrated intensity units” accordingly.
            Keep in mind that the default behavior in CellProfiler is to rescale the image intensity from 0 to 1 by dividing all pixels in the image by the maximum possible intensity value.
            This “maximum possible” value is defined by the “Set intensity range from” setting in NamesAndTypes; see the help for that setting for more details.

            @COMMON_HELP@
            ]]>
    </help>



    <expand macro="citations" />

</tool>