Merge pull request #17581 from kostrykin/files_assertions_images

Add content assertion XML tags for test output verification using images
This commit is contained in:
Marius van den Beek
2024-03-13 13:08:55 +01:00
committed by GitHub
5 changed files with 747 additions and 1 deletions
@@ -144,6 +144,7 @@
<tool file="sam_to_unsorted_bam.xml" />
<tool file="top_level_data.xml" />
<tool file="validation_hdf5.xml" />
<tool file="validation_image.xml"/>
<tool file="validation_zip.xml" />
<tool file="validation_tar.xml" />
<tool file="validation_tar_gz.xml" />
+182
View File
@@ -0,0 +1,182 @@
<tool id="validation_image" name="validation_image" version="1.0">
<command><![CDATA[
cp '$input' '$output'
]]></command>
<inputs>
<param name="input" type="data" format="data" />
</inputs>
<outputs>
<data name="output" format="data" />
</outputs>
<tests>
<!-- Tests with intensity images -->
<test>
<param name="input" value="im1_uint8.tif" />
<output name="output">
<assert_contents>
<has_image_width width="32" />
<has_image_height height="32" />
<has_image_channels channels="1" />
<has_image_center_of_mass center_of_mass="15.61, 15.48" />
</assert_contents>
</output>
</test>
<test>
<param name="input" value="im3_b.tif" />
<output name="output">
<assert_contents>
<has_image_width width="30" delta="2" />
</assert_contents>
</output>
</test>
<test expect_test_failure="true">
<param name="input" value="im3_b.tif" />
<output name="output">
<assert_contents>
<has_image_width width="29" delta="2" />
</assert_contents>
</output>
</test>
<test>
<param name="input" value="im3_b.tif" />
<output name="output">
<assert_contents>
<has_image_width width="32" />
<has_image_height height="32" />
<has_image_channels channels="3" />
<has_image_center_of_mass channel="0" center_of_mass="7.5, 7.5" />
<has_image_mean_intensity channel="0" mean_intensity="0.25" />
<has_image_mean_intensity channel="1" mean_intensity="0.0" />
<has_image_mean_intensity channel="2" mean_intensity="0" />
<has_image_center_of_mass center_of_mass="7.5, 7.5" />
<has_image_mean_intensity mean_intensity="0.08333333333" />
</assert_contents>
</output>
</test>
<test expect_test_failure="true">
<param name="input" value="im3_b.tif" />
<output name="output">
<assert_contents>
<has_image_mean_intensity channel="0" mean_intensity="0.24" />
</assert_contents>
</output>
</test>
<test>
<param name="input" value="im3_b.tif" />
<output name="output">
<assert_contents>
<has_image_mean_intensity channel="0" mean_intensity="0.24" eps="0.0100000001" />
</assert_contents>
</output>
</test>
<test>
<param name="input" value="im3_b.tif" />
<output name="output">
<assert_contents>
<has_image_mean_intensity channel="0" min="0.24" max="0.26" />
</assert_contents>
</output>
</test>
<test expect_test_failure="true">
<param name="input" value="im3_b.tif" />
<output name="output">
<assert_contents>
<has_image_mean_intensity channel="0" max="0.24" />
</assert_contents>
</output>
</test>
<test expect_test_failure="true">
<param name="input" value="im3_b.tif" />
<output name="output">
<assert_contents>
<has_image_mean_intensity channel="0" min="0.26" />
</assert_contents>
</output>
</test>
<!-- Tests with label images -->
<test>
<param name="input" value="im2_b.png" />
<output name="output">
<assert_contents>
<has_image_width width="32" />
<has_image_height height="32" />
<has_image_channels channels="1" />
<has_image_n_labels n="1" exclude_labels="0" />
<has_image_mean_object_size mean_object_size="256" exclude_labels="0" />
</assert_contents>
</output>
</test>
<test>
<param name="input" value="im2_b.png" />
<output name="output">
<assert_contents>
<has_image_width width="32" />
<has_image_height height="32" />
<has_image_channels channels="1" />
<has_image_n_labels n="2" />
<has_image_mean_object_size mean_object_size="512" />
</assert_contents>
</output>
</test>
<test>
<param name="input" value="im2_b.png" />
<output name="output">
<assert_contents>
<has_image_mean_object_size labels="0" mean_object_size="768" />
</assert_contents>
</output>
</test>
<test>
<param name="input" value="im2_b.png" />
<output name="output">
<assert_contents>
<has_image_mean_object_size labels="0, 1" mean_object_size="512" />
</assert_contents>
</output>
</test>
<test expect_test_failure="true">
<param name="input" value="im2_b.png" />
<output name="output">
<assert_contents>
<has_image_mean_object_size mean_object_size="511" eps="0.9" />
</assert_contents>
</output>
</test>
<test>
<param name="input" value="im2_b.png" />
<output name="output">
<assert_contents>
<has_image_width width="32" />
<has_image_height height="32" />
<has_image_channels channels="1" />
<has_image_n_labels n="2" />
<has_image_mean_object_size mean_object_size="511" eps="1.0" />
</assert_contents>
</output>
</test>
<test>
<param name="input" value="im2_b.png" />
<output name="output">
<assert_contents>
<has_image_mean_object_size min="511" max="513" />
</assert_contents>
</output>
</test>
<test expect_test_failure="true">
<param name="input" value="im2_b.png" />
<output name="output">
<assert_contents>
<has_image_mean_object_size max="511" />
</assert_contents>
</output>
</test>
<test expect_test_failure="true">
<param name="input" value="im2_b.png" />
<output name="output">
<assert_contents>
<has_image_mean_object_size min="513" />
</assert_contents>
</output>
</test>
</tests>
</tool>