Mercurial > repos > bgruening > cp_measure_texture
view measure_texture.xml @ 6:b76841ee5560 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:34:24 +0000 |
parents | 80b200ae516b |
children |
line wrap: on
line source
<tool id="cp_measure_texture" name="MeasureTexture" version="@CP_VERSION@+galaxy@VERSION_SUFFIX@"> <description>with CellProfiler</description> <macros> <import>macros.xml</import> <token name="@VERSION_SUFFIX@">1</token> <xml name="measureImgObj"> <repeat name="rpt_obj_to_measure" title="new object" min="1"> <param name="obj_to_measure" label="Enter the names of the objects to measure" type="text" /> </repeat> </xml> </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 writemi(): _str = "\nMeasureTexture:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:5|show_window:False|notes:\\x5B\\'PARAMS\\x3A\\', \\'- Texture scale\'\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count img_count = len(params['rpt_image_to_measure']) obj_count = len(params['con_img_obj']['rpt_obj_to_measure']) scale_count = len(params['rpt_scale_to_measure']) img_obj = params['con_img_obj']['img_obj'] _str += FOURSPACES + "Hidden:%d\n" % img_count _str += FOURSPACES + "Hidden:%d\n" % obj_count _str += FOURSPACES + "Hidden:%d\n" % scale_count for img in params['rpt_image_to_measure']: _str += FOURSPACES + "Select an image to measure:%s\n" % img['image_to_measure'] if img_obj == "Images": _str += FOURSPACES + "Select objects to measure:None\n" else: for obj in params['con_img_obj']['rpt_obj_to_measure']: _str += FOURSPACES + "Select objects to measure:%s\n" % obj['obj_to_measure'] for scale in params['rpt_scale_to_measure']: _str += FOURSPACES + "Texture scale to measure:%s\n" % str(scale['scale_to_measure']) _str += FOURSPACES + "Measure images or objects?:%s\n" % params['con_img_obj']['img_obj'] 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(writemi()) f.close() </configfile> </configfiles> <inputs> <expand macro="input_pipeline_param" /> <repeat name="rpt_image_to_measure" 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> <conditional name="con_img_obj"> <param name="img_obj" label="Measure images or objects?" type="select"> <help> <![CDATA[ This setting determines whether the module computes image-wide measurements, per-object measurements or both. <br> - Images: Select if you only want to measure the texture across entire images. <br> - Objects: Select if you want to measure the texture on a per-object basis only. <br> - Both: Select to make both image and object measurements. ]]> </help> <option value="Images">Images</option> <option value="Objects">Objects</option> <option value="Both">Both</option> </param> <when value="Objects"> <expand macro="measureImgObj" /> </when> <when value="Both"> <expand macro="measureImgObj" /> </when> <when value="Images" /> </conditional> <repeat name="rpt_scale_to_measure" title="new scale" min="1"> <param name="scale_to_measure" label="Texture scale to measure" type="integer" value="3" min="0"> <help> You can specify the scale of texture to be measured, in pixel units. The texture scale is the distance between correlated intensities in the image. A higher number for the scale of texture measures larger patterns of texture whereas smaller numbers measure more localized patterns of texture. It is best to measure texture on a scale smaller than your objects’ sizes, so be sure that the value entered for the scale of texture is smaller than most of your objects. For very small objects (smaller than the scale of texture you are measuring), the texture cannot be measured and will result in an undefined value in the output file. </help> </param> </repeat> </inputs> <outputs> <expand macro="output_pipeline_param" /> </outputs> <tests> <test> <expand macro="test_input_pipeline_param" /> <repeat name="rpt_image_to_measure"> <param name="image_to_measure" value="DNA" /> </repeat> <conditional name="con_img_obj"> <param name="img_obj" value="Objects" /> <repeat name="rpt_obj_to_measure"> <param name="obj_to_measure" value="Nuclei" /> </repeat> </conditional> <repeat name="rpt_scale_to_measure"> <param name="scale_to_measure" value="3" /> </repeat> <expand macro="test_out_file" file="measure_texture.cppipe" /> </test> </tests> <help> <![CDATA[ .. class:: infomark **What it does** MeasureTexture measures the degree and nature of textures within images and objects to quantify their roughness and smoothness. This module measures intensity variations in grayscale images. An object or entire image without much texture has a smooth appearance; an object or image with a lot of texture will appear rough and show a wide variety of pixel intensities. Note that any input objects specified will have their texture measured against all input images specified, which may lead to image-object texture combinations that are unnecessary. If you do not want this behavior, use multiple MeasureTexture modules to specify the particular image-object measures that you want. @COMMON_HELP@ ]]> </help> <expand macro="citations" /> </tool>