From 5b5dfc952d8eeb4f240f7c85b3d4a873936e3ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Dornier?= Date: Thu, 13 Nov 2025 14:31:44 +0100 Subject: [PATCH 1/3] Adding support for custom user label --- omero/figure_scripts/Split_View_Figure.py | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/omero/figure_scripts/Split_View_Figure.py b/omero/figure_scripts/Split_View_Figure.py index 9724ad8f0..607642c14 100644 --- a/omero/figure_scripts/Split_View_Figure.py +++ b/omero/figure_scripts/Split_View_Figure.py @@ -368,7 +368,7 @@ def make_split_view_figure(conn, pixel_ids, z_start, z_end, split_indexes, fontsize = 16 spacer = (width // 25) + 2 - text_gap = 3 # gap between text and image panels + text_gap = 20 # gap between text and image panels left_text_width = 0 text_height = 0 @@ -512,6 +512,10 @@ def get_datasets(name, tags_list, pd_list): def get_tags(name, tags_list, pd_list): return [t for t in tags_list] get_labels = get_tags + elif script_params["Image_Labels"] == "Custom": + def get_custom_label(name, tags_list, pd_list): + return [script_params["Custom_Label"]] + get_labels = get_custom_label else: get_labels = get_image_names @@ -674,7 +678,7 @@ def run_script(): """ data_types = [rstring('Image')] - labels = [rstring('Image Name'), rstring('Datasets'), rstring('Tags')] + labels = [rstring('Image Name'), rstring('Datasets'), rstring('Tags'), rstring('Custom')] algorithms = [rstring('Maximum Intensity'), rstring('Mean Intensity')] formats = [rstring('JPEG'), rstring('PNG'), rstring('TIFF')] ckeys = list(COLOURS.keys()) @@ -750,31 +754,35 @@ def run_script(): description="Label images with Image name (default) or datasets" " or tags", values=labels, default='Image Name'), + scripts.String( + "Custom_Label", grouping="93", + description="User defined label", default=''), + scripts.Int( - "Stepping", grouping="93", + "Stepping", grouping="94", description="The Z increment for projection.", default=1, min=1), scripts.Int( - "Scalebar", grouping="94", + "Scalebar", grouping="95", description="Scale bar size in microns. Only shown if image has" " pixel-size info.", min=1), scripts.String( - "Format", grouping="95", + "Format", grouping="96", description="Format to save image", values=formats, default='JPEG'), scripts.String( - "Figure_Name", grouping="96", + "Figure_Name", grouping="97", description="File name of the figure to save.", default='Split_View_Figure'), scripts.String( - "Overlay_Colour", grouping="97", + "Overlay_Colour", grouping="98", description="The color of the scale bar.", default='White', values=o_colours), - version="4.3.0", + version="4.4.0", authors=["William Moore", "OME Team"], institutions=["University of Dundee"], contact="ome-users@lists.openmicroscopy.org.uk", From ff915a0078cf31a3c05c196a3e369bfd2e3b2ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Dornier?= Date: Wed, 19 Nov 2025 13:02:42 +0100 Subject: [PATCH 2/3] adding support to add a different label for each image --- omero/figure_scripts/Split_View_Figure.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/omero/figure_scripts/Split_View_Figure.py b/omero/figure_scripts/Split_View_Figure.py index 607642c14..1faf1cba6 100644 --- a/omero/figure_scripts/Split_View_Figure.py +++ b/omero/figure_scripts/Split_View_Figure.py @@ -499,22 +499,27 @@ def split_view_figure(conn, script_params): image_labels = [] # function for getting image labels. - def get_image_names(full_name, tags_list, pd_list): + def get_image_names(full_name, tags_list, pd_list, iid): name = full_name.split("/")[-1] return [name] # default function for getting labels is getName (or use datasets / tags) if script_params["Image_Labels"] == "Datasets": - def get_datasets(name, tags_list, pd_list): + def get_datasets(name, tags_list, pd_list, iid): return [dataset for project, dataset in pd_list] get_labels = get_datasets elif script_params["Image_Labels"] == "Tags": - def get_tags(name, tags_list, pd_list): + def get_tags(name, tags_list, pd_list, iid): return [t for t in tags_list] get_labels = get_tags elif script_params["Image_Labels"] == "Custom": - def get_custom_label(name, tags_list, pd_list): - return [script_params["Custom_Label"]] + def get_custom_label(name, tags_list, pd_list, iid): + all_labels = script_params["All_labels"] + for label_pair in all_labels.split("$"): + if str(iid) in label_pair: + if len(label_pair.split(":")) > 1: + return [label_pair.split(":")[1]] + return [""] get_labels = get_custom_label else: get_labels = get_image_names @@ -556,7 +561,7 @@ def get_custom_label(name, tags_list, pd_list): log(" Tags: %s" % tags) log(" Project/Datasets: %s" % pd_string) - image_labels.append(get_labels(name, tags_list, pd_list)) + image_labels.append(get_labels(name, tags_list, pd_list, iid)) # use the first image to define dimensions, channel colours etc. size_x = omero_image.getSizeX() @@ -755,7 +760,7 @@ def run_script(): " or tags", values=labels, default='Image Name'), scripts.String( - "Custom_Label", grouping="93", + "All_labels", grouping="93", description="User defined label", default=''), scripts.Int( From 89ea1487683a71631d980f5b8306ad565f29e736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Dornier?= Date: Thu, 20 Nov 2025 09:14:10 +0100 Subject: [PATCH 3/3] update separators --- omero/figure_scripts/Split_View_Figure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/omero/figure_scripts/Split_View_Figure.py b/omero/figure_scripts/Split_View_Figure.py index 1faf1cba6..bbba1a5c0 100644 --- a/omero/figure_scripts/Split_View_Figure.py +++ b/omero/figure_scripts/Split_View_Figure.py @@ -515,10 +515,10 @@ def get_tags(name, tags_list, pd_list, iid): elif script_params["Image_Labels"] == "Custom": def get_custom_label(name, tags_list, pd_list, iid): all_labels = script_params["All_labels"] - for label_pair in all_labels.split("$"): + for label_pair in all_labels.split("//n"): if str(iid) in label_pair: - if len(label_pair.split(":")) > 1: - return [label_pair.split(":")[1]] + if len(label_pair.split("//s")) > 1: + return [label_pair.split("//s")[1]] return [""] get_labels = get_custom_label else: