Mercurial > repos > imgteam > slice_image
comparison slice_image.xml @ 3:1faa7e3c94ff draft
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/slice_image/ commit c045f067a57e8308308cf6329060c7ccd3fc372f
author | imgteam |
---|---|
date | Thu, 04 Apr 2024 15:26:38 +0000 |
parents | f312d414f234 |
children | a72590196440 |
comparison
equal
deleted
inserted
replaced
2:f312d414f234 | 3:1faa7e3c94ff |
---|---|
1 <tool id="ip_slice_image" name="Slice image" version="0.3-2"> | 1 <tool id="ip_slice_image" name="Slice image into patches" version="0.3-3"> |
2 <description></description> | 2 <description></description> |
3 <macros> | |
4 <import>creators.xml</import> | |
5 <import>tests.xml</import> | |
6 </macros> | |
7 <creator> | |
8 <expand macro="creators/bmcv" /> | |
9 </creator> | |
3 <edam_operations> | 10 <edam_operations> |
4 <edam_operation>operation_3443</edam_operation> | 11 <edam_operation>operation_3443</edam_operation> |
5 </edam_operations> | 12 </edam_operations> |
6 <xrefs> | 13 <xrefs> |
7 <xref type="bio.tools">galaxy_image_analysis</xref> | 14 <xref type="bio.tools">galaxy_image_analysis</xref> |
10 <requirement type="package" version="0.14.2">scikit-image</requirement> | 17 <requirement type="package" version="0.14.2">scikit-image</requirement> |
11 <requirement type="package" version="1.15.4">numpy</requirement> | 18 <requirement type="package" version="1.15.4">numpy</requirement> |
12 <requirement type="package" version="1.1.0">scipy</requirement> | 19 <requirement type="package" version="1.1.0">scipy</requirement> |
13 <requirement type="package" version="0.15.1">tifffile</requirement> | 20 <requirement type="package" version="0.15.1">tifffile</requirement> |
14 </requirements> | 21 </requirements> |
15 <command detect_errors="aggressive"> | 22 <command detect_errors="aggressive"><![CDATA[ |
16 <![CDATA[ | 23 |
17 mkdir ./out && | 24 mkdir ./out && |
25 | |
18 python '$__tool_directory__/slice_image.py' | 26 python '$__tool_directory__/slice_image.py' |
19 '$input_file' ./out | 27 '$input_file' ./out |
20 --stride $stride --window_size $patch_size --bg_thresh $bg_thresh | 28 |
21 --limit_slices $limit_slices | 29 --stride '$stride' |
22 #if $limit_slices: | 30 --window_size '$patch_size' |
23 --n_thresh $n_thresh | 31 --bg_thresh '$bg_thresh' |
32 | |
33 #if $n_thresh > 0: | |
34 --n_thresh '$n_thresh' | |
24 #end if | 35 #end if |
25 #if $control_rng: | 36 |
26 --seed $seed | 37 #if len('$seed') > 0: |
38 --seed '$seed' | |
27 #end if | 39 #end if |
40 | |
28 && ls -l ./out | 41 && ls -l ./out |
29 ]]> | 42 |
30 </command> | 43 ]]></command> |
31 <inputs> | 44 <inputs> |
32 <param name="input_file" type="data" format="tiff,png,jpg,bmp" label="Input image"/> | 45 <param name="input_file" type="data" format="tiff,png" label="Input image"/> |
33 <!--<param name="out_folder" type="text" label="Output folder for image slices"/> | 46 <param name="stride" type="integer" optional="true" value="16" min="1" label="Stride" help="Minimum offset between any two patches in pixels."/> |
34 <param name="label_file" type="data" format="tiff,png,jpg,bmp" label="Auxiliary label file to split in the same way"/>--> | 47 <param name="patch_size" type="integer" optional="true" value="64" label="Patch size" help="Width of the patches in pixels (the height is identical)."/> |
35 <param name="stride" type="integer" optional="true" value="16"/> | 48 <param name="bg_thresh" type="float" optional="true" value="0" min="0" label="Maximum patch homogeneity" help="If larger than 0, patches with a homogeneity above this threshold will be considered as purely background and discarded."/> |
36 <param name="patch_size" type="integer" optional="true" value="64" label="Size of resulting (quadratic-shaped) slices"/> | 49 <param name="n_thresh" type="integer" optional="true" label="Maximum number of patches" value="0" min="0" help="If larger than 0, only the specified number of patches will be retained (or less). Those will be selected randomly."/> |
37 <param name="bg_thresh" type="float" optional="true" value="0" label="Threshold to not be considered background"/> | 50 <param name="seed" type="hidden" value=""/> |
38 <param name="limit_slices" type="boolean" checked="true" label="Should the number of slices be limited?"/> | |
39 <param name="n_thresh" type="integer" optional="true" label="Maximum amount of slices; only needed if limit_slices is selected"/> | |
40 <param name="control_rng" type="boolean" checked="false" label="Boolean that controls if a certain seed should be selected for the random number generator"/> | |
41 <param name="seed" type="integer" value="1" | |
42 label="Seed chosen for the random number generator of the random choice of limited slices. Only required if cotrol_rng is selected"/> | |
43 </inputs> | 51 </inputs> |
44 <outputs> | 52 <outputs> |
45 <collection name="slices" type="list" label="Slices obtained from input"> | 53 <collection name="slices" type="list" label="Slices obtained from input"> |
46 <discover_datasets directory="out" format="tiff" pattern="__name__"/> | 54 <discover_datasets directory="out" format="tiff" pattern="__name__"/> |
47 </collection> | 55 </collection> |
48 </outputs> | 56 </outputs> |
49 <tests> | 57 <tests> |
58 <!-- Tests for TIFF input --> | |
50 <test> | 59 <test> |
51 <param name="input_file" value="input.tiff"/> | 60 <param name="input_file" value="input.tiff"/> |
52 <param name="limit_slices" value="true"/> | |
53 <param name="n_thresh" value="5"/> | 61 <param name="n_thresh" value="5"/> |
54 <param name="control_rng" value="true"/> | |
55 <param name="seed" value="17"/> | 62 <param name="seed" value="17"/> |
56 <output_collection name="slices" type="list"> | 63 <output_collection name="slices" type="list"> |
57 <element name="148.tiff" file="input_148.tiff" ftype="tiff" compare="sim_size"/> | 64 <expand macro="tests/intensity_image_diff/element" name="148.tiff" value="input_148.tiff" ftype="tiff"/> |
58 <element name="155.tiff" file="input_155.tiff" ftype="tiff" compare="sim_size"/> | 65 <expand macro="tests/intensity_image_diff/element" name="155.tiff" value="input_155.tiff" ftype="tiff"/> |
59 <element name="187.tiff" file="input_187.tiff" ftype="tiff" compare="sim_size"/> | 66 <expand macro="tests/intensity_image_diff/element" name="187.tiff" value="input_187.tiff" ftype="tiff"/> |
60 <element name="212.tiff" file="input_212.tiff" ftype="tiff" compare="sim_size"/> | 67 <expand macro="tests/intensity_image_diff/element" name="212.tiff" value="input_212.tiff" ftype="tiff"/> |
61 <element name="267.tiff" file="input_267.tiff" ftype="tiff" compare="sim_size"/> | 68 <expand macro="tests/intensity_image_diff/element" name="267.tiff" value="input_267.tiff" ftype="tiff"/> |
62 </output_collection> | 69 </output_collection> |
63 </test> | 70 </test> |
71 <!-- TODO: Add tests for PNG input --> | |
64 </tests> | 72 </tests> |
65 <help> | 73 <help> |
66 **What it does** | |
67 | 74 |
68 Slices image into multiple smaller patches. | 75 **Slices an image into multiple smaller, square-shaped patches.** |
76 | |
77 For overlapping patches, set the stride to a value smaller than the patch size. | |
78 For non-overlapping patches, set the stride to a value identical to the patch size (or larger). | |
79 If the stride is set to a value larger than the patch size, parts of the original image will be skipped. | |
80 | |
81 Optionally, patches entirely corresponding to image background are discarded. | |
82 To decide whether a patch corresponds to image background, the `homogeneity`_ of its `gray-level co-occurrence matrix`_ is considered. | |
83 | |
84 .. _homogeneity: https://scikit-image.org/docs/stable/api/skimage.feature.html#skimage.feature.graycoprops | |
85 .. _gray-level co-occurrence matrix: https://scikit-image.org/docs/stable/api/skimage.feature.html#skimage.feature.graycomatrix | |
86 | |
87 In addition, the number of the remaining patches can be reduced by specifying a maximum number of patches to retain. | |
88 Those will be selected randomly. | |
89 | |
69 </help> | 90 </help> |
70 <citations> | 91 <citations> |
71 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> | 92 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> |
72 </citations> | 93 </citations> |
73 </tool> | 94 </tool> |