diff --git a/omero/figure_scripts/Split_View_Figure.py b/omero/figure_scripts/Split_View_Figure.py index 9724ad8f0..79ce8b450 100644 --- a/omero/figure_scripts/Split_View_Figure.py +++ b/omero/figure_scripts/Split_View_Figure.py @@ -499,19 +499,28 @@ 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, iid): + all_labels = script_params["All_labels"] + for label_pair in all_labels.split("//n"): + if str(iid) in label_pair: + if len(label_pair.split("//s")) > 1: + return [label_pair.split("//s")[1]] + return [""] + get_labels = get_custom_label else: get_labels = get_image_names @@ -552,7 +561,7 @@ def get_tags(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() @@ -674,7 +683,8 @@ 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,6 +760,10 @@ def run_script(): description="Label images with Image name (default) or datasets" " or tags", values=labels, default='Image Name'), + scripts.String( + "All_labels", grouping="93", + description="User defined label", default=''), + scripts.Int( "Stepping", grouping="93", description="The Z increment for projection.", default=1, min=1),