From 6231f4feb04157d46c4123898edf85f7f7df574c Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 7 Mar 2025 10:39:27 +0100 Subject: [PATCH 1/5] Remove ``num_unique_values`` tiff metadata element This was added in https://github.com/galaxyproject/galaxy/pull/18951 but it's memory consumption scales with input size. On a 5.5GB TIFF file this consumed a peak of 18GB of memory. @kostrykin added a workaround for the memory consumption in https://github.com/galaxyproject/galaxy/pull/19830, but this now very slow. Besides improving the efficient, Perhaps there is a more gentle way to approach > Many tools assume that images are binary, or label maps, for example, and it makes no sense to run those tools on other images. ? Could those tools just error out, and/or consume a different datatype ? Do we need the full unique values, or is it ok to just check if it's more than `n` unique values ? --- lib/galaxy/datatypes/images.py | 12 ------------ test/unit/data/datatypes/test_images.py | 9 --------- 2 files changed, 21 deletions(-) diff --git a/lib/galaxy/datatypes/images.py b/lib/galaxy/datatypes/images.py index 64067c203ac..2f851b0f00f 100644 --- a/lib/galaxy/datatypes/images.py +++ b/lib/galaxy/datatypes/images.py @@ -84,14 +84,6 @@ class Image(data.Data): optional=True, ) - MetadataElement( - name="num_unique_values", - desc="Number of unique values in the image data (e.g., should be 2 for binary images)", - readonly=True, - visible=True, - optional=True, - ) - MetadataElement( name="width", desc="Width of the image (in pixels)", @@ -271,7 +263,6 @@ class Tiff(Image): "channels", "depth", "frames", - "num_unique_values", ] } @@ -289,9 +280,6 @@ class Tiff(Image): metadata["depth"].append(Tiff._get_axis_size(series.shape, axes, "Z")) metadata["frames"].append(Tiff._get_axis_size(series.shape, axes, "T")) - # Determine the metadata values that require reading the image data - metadata["num_unique_values"].append(Tiff._get_num_unique_values(series)) - # Populate the metadata fields based on the values determined above for key, values in metadata.items(): if len(values) > 0: diff --git a/test/unit/data/datatypes/test_images.py b/test/unit/data/datatypes/test_images.py index 167090c4cff..b05be9f40bd 100644 --- a/test/unit/data/datatypes/test_images.py +++ b/test/unit/data/datatypes/test_images.py @@ -52,7 +52,6 @@ def __assert_empty_metadata(metadata): for key in ( "axes", "dtype", - "num_unique_values", "width", "height", "channels", @@ -69,8 +68,6 @@ test_tiff_axes_zcyx = __create_test(Tiff, "im6_uint8.tif", "axes", "ZCYX") test_tiff_dtype_uint8 = __create_test(Tiff, "im6_uint8.tif", "dtype", "uint8") test_tiff_dtype_uint16 = __create_test(Tiff, "im8_uint16.tif", "dtype", "uint16") test_tiff_dtype_float64 = __create_test(Tiff, "im4_float.tif", "dtype", "float64") -test_tiff_num_unique_values_2 = __create_test(Tiff, "im3_b.tif", "num_unique_values", 2) -test_tiff_num_unique_values_618 = __create_test(Tiff, "im4_float.tif", "num_unique_values", 618) test_tiff_width_16 = __create_test(Tiff, "im7_uint8.tif", "width", 16) # axes: ZYX test_tiff_width_32 = __create_test(Tiff, "im3_b.tif", "width", 32) # axes: YXS test_tiff_height_8 = __create_test(Tiff, "im7_uint8.tif", "height", 8) # axes: ZYX @@ -100,15 +97,11 @@ def test_tiff_unsupported_compression(metadata): assert metadata.depth == 0 assert metadata.frames == 0 - # The other fields should be missing - assert getattr(metadata, "num_unique_values", None) is None - @__test(Tiff, "im9_multiseries.tif") def test_tiff_multiseries(metadata): assert metadata.axes == ["YXS", "YX"] assert metadata.dtype == ["uint8", "uint16"] - assert metadata.num_unique_values == [2, 255] assert metadata.width == [32, 256] assert metadata.height == [32, 256] assert metadata.channels == [3, 0] @@ -121,8 +114,6 @@ def test_tiff_multiseries(metadata): test_png_axes_yx = __create_test(Image, "im1_uint8.png", "axes", "YX") test_png_axes_yxc = __create_test(Image, "im3_a.png", "axes", "YXC") test_png_dtype_uint8 = __create_test(Image, "im1_uint8.png", "dtype", "uint8") -test_png_num_unique_values_1 = __create_test(Image, "im2_a.png", "num_unique_values", None) -test_png_num_unique_values_2 = __create_test(Image, "im2_b.png", "num_unique_values", None) test_png_width_32 = __create_test(Image, "im2_b.png", "width", 32) test_png_height_32 = __create_test(Image, "im2_b.png", "height", 32) test_png_channels_0 = __create_test(Image, "im1_uint8.png", "channels", 0) From bfd1f3347a6b2a43140536d6d1f2f5efd60362c6 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Fri, 20 Jun 2025 12:18:27 -0500 Subject: [PATCH 2/5] [25.0] Prevent DCE collections from being renamed Fixes https://help.galaxyproject.org/t/how-can-i-rename-a-paired-fastq-file/15784 Adds a `renameable` prop to `DetailsLayout` in addition to the existing `writeable` prop, because this way, we allow anonymous user histories to still be renamed (https://github.com/galaxyproject/galaxy/issues/20197) and in the case of the collection layout, DCEs are made not-renamaeable and unwriteable. --- .../CurrentCollection/CollectionDetails.vue | 1 + .../History/Layout/DetailsLayout.test.js | 31 +++++++++++++++++-- .../History/Layout/DetailsLayout.vue | 23 +++++++++----- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/client/src/components/History/CurrentCollection/CollectionDetails.vue b/client/src/components/History/CurrentCollection/CollectionDetails.vue index 81af7a85e0c..170986dfcb6 100644 --- a/client/src/components/History/CurrentCollection/CollectionDetails.vue +++ b/client/src/components/History/CurrentCollection/CollectionDetails.vue @@ -24,6 +24,7 @@ const jobState = computed(() => { :name="dsc.name ?? ''" :tags="dsc.tags" :writeable="writeable" + :renameable="writeable" :show-annotation="false" @save="$emit('update:dsc', $event)">