Skip to content

Commit 399a62b

Browse files
authored
Merge pull request #1609 from anuprulez/fix_axes
Fix transposed dimensions
2 parents 973836f + 3d7461f commit 399a62b

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

tools/bioimaging/bioimage_inference.xml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<description>with PyTorch</description>
33
<macros>
44
<token name="@TOOL_VERSION@">2.4.1</token>
5-
<token name="@VERSION_SUFFIX@">2</token>
5+
<token name="@VERSION_SUFFIX@">3</token>
66
</macros>
77
<creator>
88
<organization name="European Galaxy Team" url="https://galaxyproject.org/eu/" />
@@ -38,9 +38,8 @@
3838
<param name="input_image_file" type="data" format="tiff,png" label="Input image" help="Please provide an input image for the analysis."/>
3939
<param name="input_image_input_size" type="text" optional="false" label="Size of the input image" help="Provide the size of the input image. See the chosen model's RDF file to find the correct input size. For example: for the BioImage.IO model MitochondriaEMSegmentationBoundaryModel, the input size is 256 x 256 x 32 x 1. Enter the size as 256,256,32,1."/>
4040
<param name="input_image_input_axes" type="select" label="Axes of the input image" optional="false" help="Provide the input axes of the input image. See the chosen model's RDF file to find the correct axes. For example: for the BioImage.IO model MitochondriaEMSegmentationBoundaryModel, the input axes is 'bczyx'">
41-
<option value="bczyx">bczyx</option>
42-
<option value="bcyx">bcyx</option>
43-
<option value="byxc">byxc</option>
41+
<option value="bcyx">Four axes (e.g., bcyx, byxc)</option>
42+
<option value="bczyx">Five axes (e.g., bczyx)</option>
4443
</param>
4544
</inputs>
4645
<outputs>
@@ -53,11 +52,7 @@
5352
<param name="input_image_file" value="input_image_file.tif" location="https://zenodo.org/api/records/6647674/files/sample_input_0.tif/content"/>
5453
<param name="input_image_input_size" value="256,256,1,1"/>
5554
<param name="input_image_input_axes" value="bcyx"/>
56-
<output name="output_predicted_image" ftype="tiff">
57-
<assert_contents>
58-
<has_size size="524846" delta="110" />
59-
</assert_contents>
60-
</output>
55+
<output name="output_predicted_image" ftype="tiff" file="output_nucleisegboundarymodel.tiff" compare="image_diff" />
6156
<output name="output_predicted_image_matrix" ftype="npy">
6257
<assert_contents>
6358
<has_size size="524416" delta="110" />
@@ -69,11 +64,7 @@
6964
<param name="input_image_file" value="input_nucleisegboundarymodel.png"/>
7065
<param name="input_image_input_size" value="256,256,1,1"/>
7166
<param name="input_image_input_axes" value="bcyx"/>
72-
<output name="output_predicted_image" ftype="tiff">
73-
<assert_contents>
74-
<has_size size="524846" delta="110" />
75-
</assert_contents>
76-
</output>
67+
<output name="output_predicted_image" ftype="tiff" file="output_nucleisegboundarymodel.tiff" compare="image_diff" />
7768
<output name="output_predicted_image_matrix" ftype="npy">
7869
<assert_contents>
7970
<has_size size="524416" delta="110" />

tools/bioimaging/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ def dynamic_resize(image: torch.Tensor, target_shape: tuple):
108108
# check if image dimensions are reversed
109109
reversed_order = list(reversed(range(exp_test_data.dim())))
110110
exp_test_data_T = exp_test_data.permute(*reversed_order)
111-
if exp_test_data_T.shape == target_image_dim:
111+
if exp_test_data_T.shape == target_image_dim and exp_test_data.shape != target_image_dim:
112112
exp_test_data = exp_test_data_T
113+
# check if image dimensions are not equal to target image dimensions
113114
if exp_test_data.shape != target_image_dim:
114115
for i in range(len(target_image_dim) - exp_test_data.dim()):
115116
exp_test_data = exp_test_data.unsqueeze(i)
513 KB
Binary file not shown.

0 commit comments

Comments
 (0)