Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions omero/figure_scripts/Split_View_Figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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("$"):
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

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -674,7 +683,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())
Expand Down Expand Up @@ -750,31 +759,35 @@ 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",
"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="[email protected]",
Expand Down