Mercurial > repos > bgruening > cp_measure_image_intensity
view measure_image_intensity.xml @ 3:aed1bb820734 draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
author | bgruening |
---|---|
date | Mon, 11 May 2020 11:40:13 +0000 |
parents | b48c318a9503 |
children | bd0a391f8545 |
line wrap: on
line source
<tool id="cp_measure_image_intensity" name="MeasureImageIntensity" version="@CP_VERSION@"> <description>measure several intensity features across an entire image</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 writemii(): _str = "\nMeasureImageIntensity:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:2|show_window:False|notes:\\x5B\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count for intensity in params['rpt_intensity']: obj_flag = intensity['con_intensity']['only_from_objects'] _str += FOURSPACES + "Select the image to measure:%s\n" % intensity['image_to_measure'] _str += FOURSPACES + "Measure the intensity only from areas enclosed by objects?:%s\n" % obj_flag if obj_flag == "No": _str += FOURSPACES + "Select the input objects:None\n" else: _str += FOURSPACES + "Select the input objects:%s\n" % intensity['con_intensity']['input_objects'] 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(writemii()) f.close() </configfile> </configfiles> <inputs> <expand macro="input_pipeline_param" /> <repeat name="rpt_intensity" title="new image" min="1"> <param name="image_to_measure" label="Enter the name of the image to measure" type="text"> <expand macro="text_validator" /> </param> <conditional name="con_intensity"> <param name="only_from_objects" label="Measure the intensity only from areas enclosed by objects?" type="select" help="Select 'Yes' to measure only those pixels within an object type you choose, identified by a prior tool. Note that this module will aggregate intensities across all objects in the image: to measure each object individually, see MeasureObjectIntensity instead. "> <option value="Yes">Yes</option> <option value="No">No</option> </param> <when value="Yes"> <param name="input_objects" label="Enter the name of the objects that the intensity will be aggregated within" type="text" help="The intensity measurement will be restricted to the pixels within these objects. "> <expand macro="text_validator" /> </param> </when> <when value="No" /> </conditional> </repeat> </inputs> <outputs> <expand macro="output_pipeline_param" /> </outputs> <tests> <test> <expand macro="test_input_pipeline_param" /> <repeat name="rpt_intensity"> <param name="image_to_measure" value="DNA" /> <conditional name="con_intensity"> <param name="only_from_objects" value="No" /> </conditional> </repeat> <repeat name="rpt_intensity"> <param name="image_to_measure" value="DNA" /> <conditional name="con_intensity"> <param name="only_from_objects" value="Yes" /> <param name="input_objects" value="Nuclei" /> </conditional> </repeat> <expand macro="test_out_file" file="measure_image_intensity.cppipe" /> </test> </tests> <help> <![CDATA[ .. class:: infomark **What it does** MeasureImageIntensity measures several intensity features across an entire image (excluding masked pixels). For example, this module will sum all pixel values to measure the total image intensity. You can choose to measure all pixels in the image or restrict the measurement to pixels within objects that were identified in a prior module. If the image has a mask, only unmasked pixels will be measured. 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>