Mercurial > repos > imgteam > color_deconvolution
comparison color_deconvolution.xml @ 4:5bd113d38acc draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/color_deconvolution/ commit f546b3cd5cbd3a8613cd517975c7ad1d1f83514e
author | imgteam |
---|---|
date | Thu, 06 Mar 2025 18:12:27 +0000 |
parents | be70a57d7174 |
children |
comparison
equal
deleted
inserted
replaced
3:be70a57d7174 | 4:5bd113d38acc |
---|---|
1 <tool id="ip_color_deconvolution" name="Perform color decomposition" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@"> | 1 <tool id="ip_color_deconvolution" name="Perform color deconvolution or transformation" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@"> |
2 <description></description> | 2 <description></description> |
3 <macros> | 3 <macros> |
4 <import>creators.xml</import> | 4 <import>creators.xml</import> |
5 <import>tests.xml</import> | 5 <import>tests.xml</import> |
6 <token name="@TOOL_VERSION@">0.8</token> | 6 <token name="@TOOL_VERSION@">0.9</token> |
7 <token name="@VERSION_SUFFIX@">2</token> | 7 <token name="@VERSION_SUFFIX@">0</token> |
8 </macros> | 8 </macros> |
9 <creator> | 9 <creator> |
10 <expand macro="creators/bmcv"/> | 10 <expand macro="creators/bmcv"/> |
11 </creator> | 11 </creator> |
12 <edam_operations> | 12 <edam_operations> |
19 <requirement type="package" version="0.24.0">scikit-image</requirement> | 19 <requirement type="package" version="0.24.0">scikit-image</requirement> |
20 <requirement type="package" version="11.0.0">pillow</requirement> | 20 <requirement type="package" version="11.0.0">pillow</requirement> |
21 <requirement type="package" version="1.5.2">scikit-learn</requirement> | 21 <requirement type="package" version="1.5.2">scikit-learn</requirement> |
22 <requirement type="package" version="2.1.2">numpy</requirement> | 22 <requirement type="package" version="2.1.2">numpy</requirement> |
23 <requirement type="package" version="2024.9.20">tifffile</requirement> | 23 <requirement type="package" version="2024.9.20">tifffile</requirement> |
24 <requirement type="package" version="0.3.1">giatools</requirement> | |
24 </requirements> | 25 </requirements> |
25 <command detect_errors="aggressive"> | 26 <command detect_errors="aggressive"> |
26 <![CDATA[ | 27 <![CDATA[ |
27 python '$__tool_directory__/color_deconvolution.py' '$input' '$output' '$convtype' | 28 |
29 python '$__tool_directory__/color_deconvolution.py' | |
30 | |
31 '$input' | |
32 '$output' | |
33 '$convtype' | |
34 | |
35 #if str($isolate_channel) != '': | |
36 --isolate_channel '${isolate_channel}' | |
37 #end if | |
38 | |
28 ]]> | 39 ]]> |
29 </command> | 40 </command> |
30 <inputs> | 41 <inputs> |
31 <param name="input" type="data" format="tiff,png,jpg,bmp" label="Image file with 3 channels"/> | 42 <param name="input" type="data" format="tiff,png,jpg,bmp" label="Input image" help="The input image must have 3 axes and 3 channels. The channels must correspond to the last axis."/> |
32 <param name="convtype" type="select" label="Transformation type"> | 43 <param name="convtype" type="select" label="Transformation type"> |
33 <option value="ica" selected="True">ica</option> | 44 |
34 <option value="pca">pca</option> | 45 <!-- Color deconvolution and recomposition operations --> |
35 <option value="nmf">nmf</option> | 46 <option value="he_from_rgb">Deconvolve RGB into H&E (Hematoxylin + Eosin)</option> |
36 <option value="fa">fa</option> | 47 <option value="rgb_from_he">Recompose RGB from H&E (Hematoxylin + Eosin)</option> |
37 <option value="xyz2rgb">xyz2rgb</option> | 48 <option value="hdx_from_rgb">Deconvolve RGB into Hematoxylin + DAB</option> |
38 <option value="rgb_from_rbd">rgb_from_rbd</option> | 49 <option value="rgb_from_hdx">Recompose RGB from Hematoxylin + DAB</option> |
39 <option value="rgb_from_hdx">rgb_from_hdx</option> | 50 <option value="rgb2hed">Deconvolve RGB into Hematoxylin + Eosin + DAB</option> |
40 <option value="rgb2hsv">rgb2hsv</option> | 51 <option value="hed2rgb">Recompose RGB from Hematoxylin + Eosin + DAB</option> |
41 <option value="rgb_from_bro">rgb_from_bro</option> | 52 <option value="hpx_from_rgb">Deconvolve RGB into Hematoxylin + PAS</option> |
42 <option value="bpx_from_rgb">bpx_from_rgb</option> | 53 <option value="rgb_from_hpx">Recompose RGB from Hematoxylin + PAS</option> |
43 <option value="hed_from_rgb">hed_from_rgb</option> | 54 <option value="hax_from_rgb">Deconvolve RGB into Hematoxylin + AEC</option> |
44 <option value="rgbcie2rgb">rgbcie2rgb</option> | 55 <option value="rgb_from_hax">Recompose RGB from Hematoxylin + AEC</option> |
45 <option value="hdx_from_rgb">hdx_from_rgb</option> | 56 <option value="ahx_from_rgb">Deconvolve RGB into Alcian Blue + Hematoxylin</option> |
46 <option value="xyz2luv">xyz2luv</option> | 57 <option value="rgb_from_ahx">Recompose RGB from Alcian Blue + Hematoxylin</option> |
47 <option value="rgb2lab">rgb2lab</option> | 58 <option value="bro_from_rgb">Deconvolve RGB to AZAN</option> |
48 <option value="hpx_from_rgb">hpx_from_rgb</option> | 59 <option value="rgb_from_bro">Recompose RGB from AZAN</option> |
49 <option value="rgb_from_fgx">rgb_from_fgx</option> | 60 <option value="rbd_from_rgb">Deconvolve RGB into FastRed + FastBlue + DAB</option> |
50 <option value="rgb_from_gdx">rgb_from_gdx</option> | 61 <option value="rgb_from_rbd">Recompose RGB from FastRed + FastBlue + DAB</option> |
51 <option value="lab2xyz">lab2xyz</option> | 62 <option value="fgx_from_rgb">Deconvolve RGB into Feulgen + Light Green</option> |
52 <option value="rgb_from_hpx">rgb_from_hpx</option> | 63 <option value="rgb_from_fgx">Recompose RGB from Feulgen + Light Green</option> |
53 <option value="lab2rgb">lab2rgb</option> | 64 <option value="bex_from_rgb">Deconvolve RGB into Giemsa stain (Methyl Blue + Eosin)</option> |
54 <option value="rgb2rgbcie">rgb2rgbcie</option> | 65 <option value="rgb_from_bex">Recompose RGB from Giemsa stain (Methyl Blue + Eosin)</option> |
55 <option value="bex_from_rgb">bex_from_rgb</option> | 66 <option value="bpx_from_rgb">Deconvolve RGB into Methyl Blue + Ponceau Fuchsin</option> |
56 <option value="xyz2lab">xyz2lab</option> | 67 <option value="rgb_from_bpx">Recompose RGB from Methyl Blue + Ponceau Fuchsin</option> |
57 <option value="rgb_from_bex">rgb_from_bex</option> | 68 <option value="gdx_from_rgb">Deconvolve RGB into Methyl Green + DAB</option> |
58 <option value="fgx_from_rgb">fgx_from_rgb</option> | 69 <option value="rgb_from_gdx">Recompose RGB from Methyl Green + DAB</option> |
59 <option value="rbd_from_rgb">rbd_from_rgb</option> | 70 |
60 <option value="rgb2hed">rgb2hed</option> | 71 <!-- Unsupervised machine learning-based operations --> |
61 <option value="hed2rgb">hed2rgb</option> | 72 <option value="ica">Project onto independent components (ICA)</option> |
62 <option value="luv2rgb">luv2rgb</option> | 73 <option value="pca">Project onto principal components (PCA)</option> |
63 <option value="luv2xyz">luv2xyz</option> | 74 <option value="nmf">Non-negative matrix factorization</option> |
64 <option value="lch2lab">lch2lab</option> | 75 <option value="fa">Factor analysis</option> |
65 <option value="rgb2luv">rgb2luv</option> | 76 |
66 <option value="ahx_from_rgb">ahx_from_rgb</option> | 77 <!-- General color space conversion operations --> |
67 <option value="rgb_from_hax">rgb_from_hax</option> | 78 <option value="rgb2hsv" selected="True">Convert RGB to HSV</option> |
68 <option value="hax_from_rgb">hax_from_rgb</option> | 79 <option value="hsv2rgb">Convert HSV to RGB</option> |
69 <option value="rgb_from_bpx">rgb_from_bpx</option> | 80 <option value="rgb2xyz">Convert RGB to XYZ (CIE 1931)</option> |
70 <option value="rgb2xyz">rgb2xyz</option> | 81 <option value="xyz2rgb">Convert XYZ (CIE 1931) to RGB</option> |
71 <option value="gdx_from_rgb">gdx_from_rgb</option> | 82 <option value="rgb2luv">Convert RGB to CIE-LUV</option> |
72 <option value="rgb_from_ahx">rgb_from_ahx</option> | 83 <option value="luv2rgb">Convert CIE-LUV to RGB</option> |
73 <option value="lab2lch">lab2lch</option> | 84 <option value="xyz2luv">Convert XYZ (CIE 1931) to CIE-LUV</option> |
74 <option value="rgb_from_hed">rgb_from_hed</option> | 85 <option value="luv2xyz">Convert CIE-LUV to XYZ (CIE 1931)</option> |
75 <option value="bro_from_rgb">bro_from_rgb</option> | 86 <option value="rgb2lab">Convert RGB to CIE-LAB (illuminant D65, aperture angle 2°)</option> |
76 <option value="hsv2rgb">hsv2rgb</option> | 87 <option value="lab2rgb">Convert CIE-LAB (illuminant D65, aperture angle 2°) to RGB</option> |
88 <option value="lab2xyz">Convert CIE-LAB (illuminant D65, aperture angle 2°) to XYZ (CIE 1931)</option> | |
89 <option value="xyz2lab">Convert XYZ (CIE 1931) to CIE-LAB (illuminant D65, aperture angle 2°)</option> | |
90 <option value="lch2lab">Convert CIE-LCh to CIE-LAB</option> | |
91 <option value="lab2lch">Convert CIE-LAB to CIE-LCh</option> | |
92 <option value="rgb2rgbcie">Convert RGB to RGB-CIE</option> | |
93 <option value="rgbcie2rgb">Convert RGB-CIE to RGB</option> | |
94 | |
77 </param> | 95 </param> |
96 <param name="isolate_channel" type="integer" optional="true" value="" label="Isolate channel" help="Must be empty or the number of a channel (1 to 3). If used, all other channels are set to zero before performing the chosen transformation." /> | |
78 </inputs> | 97 </inputs> |
79 <outputs> | 98 <outputs> |
80 <data format="tiff" name="output"/> | 99 <data format="tiff" name="output"/> |
81 </outputs> | 100 </outputs> |
82 <tests> | 101 <tests> |
83 <test> | 102 |
103 <!-- Tests with compatible input files --> | |
104 | |
105 <test> | |
106 <!-- Test PNG input and standard color transformation --> | |
84 <param name="input" value="galaxyIcon_noText.png" /> | 107 <param name="input" value="galaxyIcon_noText.png" /> |
85 <param name="convtype" value="rgb2hsv" /> | 108 <param name="convtype" value="rgb2hsv" /> |
86 <expand macro="tests/intensity_image_diff" name="output" value="galaxyIcon_noText.tiff" ftype="tiff"/> | 109 <expand macro="tests/intensity_image_diff" name="output" value="galaxyIcon_noText.tiff" ftype="tiff"/> |
87 </test> | 110 </test> |
111 <test> | |
112 <!-- Test deconvolution using scikit-image (H&E + DAB) --> | |
113 <param name="input" value="he1.tiff" /> | |
114 <param name="convtype" value="rgb2hed" /> | |
115 <expand macro="tests/intensity_image_diff" name="output" value="he1_deconv_hed.tiff" ftype="tiff"/> | |
116 </test> | |
117 <test> | |
118 <!-- Test full recomposition --> | |
119 <param name="input" value="he1_deconv_hed.tiff" /> | |
120 <param name="convtype" value="hed2rgb" /> | |
121 <expand macro="tests/intensity_image_diff" name="output" value="he1_deconv_hed_recomposed.tiff" ftype="tiff"/> | |
122 </test> | |
123 <test> | |
124 <!-- Test recomposition with isolated channel --> | |
125 <param name="input" value="he1_deconv_hed.tiff" /> | |
126 <param name="convtype" value="hed2rgb" /> | |
127 <param name="isolate_channel" value="1" /> | |
128 <expand macro="tests/intensity_image_diff" name="output" value="he1_deconv_hed_recomposed1.tiff" ftype="tiff"/> | |
129 </test> | |
130 <test> | |
131 <!-- Test deconvolution using custom stain matrix --> | |
132 <param name="input" value="he1.tiff" /> | |
133 <param name="convtype" value="he_from_rgb" /> | |
134 <expand macro="tests/intensity_image_diff" name="output" value="he1_deconv_he.tiff" ftype="tiff"/> | |
135 </test> | |
136 <test> | |
137 <!-- Test deconvolution using scikit-image (Hematoxylin + DAB) --> | |
138 <param name="input" value="hdab1.tiff" /> | |
139 <param name="convtype" value="hdx_from_rgb" /> | |
140 <expand macro="tests/intensity_image_diff" name="output" value="hdab1_deconv_hdab.tiff" ftype="tiff"/> | |
141 </test> | |
142 <test> | |
143 <!-- Test with image that has 3 axes but in unusual order (and 3 channels) --> | |
144 <param name="input" value="he1_axes_cyx.tiff" /> | |
145 <param name="convtype" value="rgb2hsv" /> | |
146 <expand macro="tests/intensity_image_diff" name="output" value="he1_hsv.tiff" ftype="tiff"/> | |
147 </test> | |
148 | |
149 <!-- Tests with incompatible input files (should fail) --> | |
150 | |
151 <test expect_failure="true"> | |
152 <!-- Test with image that only has 2 axes instead of required 3 --> | |
153 <param name="input" value="im_axes_yx.tif" /> | |
154 <param name="convtype" value="rgb2hsv" /> | |
155 </test> | |
156 <test expect_failure="true"> | |
157 <!-- Test with image that has 3 axes but YXZ instead of YXC (and 3 slices) --> | |
158 <param name="input" value="he1_axes_yxz.tiff" /> | |
159 <param name="convtype" value="rgb2hsv" /> | |
160 </test> | |
161 | |
88 </tests> | 162 </tests> |
89 <help> | 163 <help><![CDATA[ |
90 | 164 |
91 **What it does** | 165 **This tool converts the color space of an image.** |
92 | 166 |
93 This tools performs several color deconvolution techniques. | 167 Several color deconvolution techniques are also supported. |
94 | 168 |
95 </help> | 169 Color Deconvolution Example |
170 =========================== | |
171 | |
172 In this example, we are going to perform color deconvolution of the following RGB image: | |
173 | |
174 .. image:: he.png | |
175 :width: 434px | |
176 :scale: 50% | |
177 | |
178 Using the option "Deconvolve RGB into H&E (Hematoxylin + Eosin)" for the **Transformation type** performs color deconvolution and yields a new image with three chnnales: | |
179 | |
180 .. image:: he_deconv.png | |
181 :width: 1305px | |
182 :scale: 50% | |
183 | |
184 The channels of the deconvolved image are the Hematoxylin intensities (Channel 1), the Eosin intensities (Channel 2), and the residuals (Channel 3). White image regions correspond to high intensities and black image regions correspond to low intensities. | |
185 | |
186 For visual inspection of the color deconvolution results, it may be useful to recompose separate RGB images for the Hematoxylin, Eosin, and residual channels. To create such images, this tool must be run once for each channel of the deconvolved image (i.e. three times), using the following options: | |
187 | |
188 * **Input image:** The result of the color deconvolution (image shown in the figure above) | |
189 * **Transformation type:** Recompose RGB from H&E (Hematoxylin + Eosin) | |
190 | |
191 The **Isolate channel** field must be set to 1, 2, and 3 during the three runs, respectively. This will yield the following recomposed RGB images for better visualization of the color deconvolution results: | |
192 | |
193 .. image:: he_recomposed.png | |
194 :width: 1305px | |
195 :scale: 50% | |
196 | |
197 ]]></help> | |
96 <citations> | 198 <citations> |
97 <citation type="doi">10.7717/peerj.453</citation> | 199 <citation type="doi">10.7717/peerj.453</citation> |
98 <citation type="bibtex">@inproceedings{sklearn_api, | 200 <citation type="bibtex">@inproceedings{sklearn_api, |
99 author = {Lars Buitinck and Gilles Louppe and Mathieu Blondel and | 201 author = {Lars Buitinck and Gilles Louppe and Mathieu Blondel and |
100 Fabian Pedregosa and Andreas Mueller and Olivier Grisel and | 202 Fabian Pedregosa and Andreas Mueller and Olivier Grisel and |