Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion omero/export_scripts/Batch_Image_Export.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def savePlane(image, format, cName, zRange, projectZ, t=0, channel=None, greysca
imgName = makeImageName(originalName, cName, zRange, t, "png", folder_name)
log("Saving image: %s" % imgName)
plane.save(imgName, "PNG")
elif format == 'TIFF':
imgName = makeImageName(originalName, cName, zRange, t, "tiff", folder_name)
log("Saving image: %s" % imgName)
plane.save(imgName, 'TIFF')
else:
imgName = makeImageName(originalName, cName, zRange, t, "jpg", folder_name)
log("Saving image: %s" % imgName)
Expand Down Expand Up @@ -410,6 +414,7 @@ def runScript():
dataTypes = [rstring('Dataset'),rstring('Image')]
formats = [rstring('JPEG'),
rstring('PNG'),
rstring('TIFF'),
rstring('OME-TIFF')]
defaultZoption = 'Default-Z (last-viewed)'
zChoices = [rstring(defaultZoption),
Expand Down Expand Up @@ -471,7 +476,7 @@ def runScript():
description="The max width of each image panel. Default is actual size", min=1),

scripts.String("Format", grouping="8",
description="Format to save image", values=formats, default='PNG'),
description="Format to save image", values=formats, default='JPEG'),

scripts.String("Folder_Name", grouping="9",
description="Name of folder (and zip file) to store images", default='Batch_Image_Export'),
Expand Down
17 changes: 8 additions & 9 deletions omero/figure_scripts/Movie_Figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
COLOURS = scriptUtil.COLOURS # name:(rgba) map
OVERLAY_COLOURS = dict(COLOURS, **scriptUtil.EXTRA_COLOURS)

JPEG = "image/jpeg"
PNG = "image/png"

logLines = [] # make a log / legend of the figure
def log(text):
Expand Down Expand Up @@ -476,19 +474,20 @@ def getTags(name, tagsList, pdList):

#print figLegend # bug fixing only

format = JPEG
if "Format" in commandArgs:
if commandArgs["Format"] == "PNG":
format = PNG
format = commandArgs["Format"]

output = "movieFigure"
if "Figure_Name" in commandArgs:
output = str(commandArgs["Figure_Name"])

if format == PNG:
if format == 'PNG':
output = output + ".png"
figure.save(output, "PNG")
mimetype = "image/png"
elif format == 'TIFF':
output = output + ".tiff"
figure.save(output, "TIFF")
mimetype = "image/tiff"
else:
output = output + ".jpg"
figure.save(output)
Expand All @@ -511,7 +510,7 @@ def runAsScript():
labels = [rstring('Image Name'), rstring('Datasets'), rstring('Tags')]
algorithums = [rstring('Maximum Intensity'),rstring('Mean Intensity')]
tunits = [rstring("SECS"), rstring("MINS"), rstring("HOURS"), rstring("MINS SECS"), rstring("HOURS MINS")]
formats = [rstring('JPEG'),rstring('PNG')]
formats = [rstring('JPEG'),rstring('PNG'),rstring('TIFF')]
ckeys = COLOURS.keys()
ckeys.sort()
cOptions = wrap(ckeys)
Expand Down Expand Up @@ -551,7 +550,7 @@ def runAsScript():
scripts.String("Scalebar_Colour", grouping="10.2",
description="The colour of the scalebar.",default='White',values=oColours),
scripts.String("Format", grouping="11",
description="Format to save image.", values=formats),
description="Format to save image.", values=formats, default='JPEG'),
scripts.String("Figure_Name", grouping="12",
description="File name of the figure to save."),
scripts.String("Time_Units", grouping="13",
Expand Down
15 changes: 7 additions & 8 deletions omero/figure_scripts/Movie_ROI_Figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
except ImportError:
import Image, ImageDraw # see ticket:2597

JPEG = "image/jpeg"
PNG = "image/png"

COLOURS = scriptUtil.COLOURS
OVERLAY_COLOURS = dict(COLOURS, **scriptUtil.EXTRA_COLOURS)
Expand Down Expand Up @@ -628,19 +626,20 @@ def getTags(name, tagsList, pdList):

#print figLegend # bug fixing only

format = JPEG
if "Format" in commandArgs:
if commandArgs["Format"] == "PNG":
format = PNG
format = commandArgs["Format"]

output = "movieROIFigure"
if "Figure_Name" in commandArgs:
output = str(commandArgs["Figure_Name"])

if format == PNG:
if format == 'PNG':
output = output + ".png"
fig.save(output, "PNG")
mimetype = "image/png"
elif format == 'TIFF':
output = output + ".tiff"
fig.save(output, "TIFF")
mimetype = "image/tiff"
else:
output = output + ".jpg"
fig.save(output)
Expand All @@ -666,7 +665,7 @@ def runAsScript():
algorithums = [rstring('Maximum Intensity'),rstring('Mean Intensity')]
roiLabel = """Specify an ROI to pick by specifying it's shape label. 'FigureROI' by default,
(not case sensitive). If matching ROI not found, use any ROI."""
formats = [rstring('JPEG'),rstring('PNG')]
formats = [rstring('JPEG'),rstring('PNG'),rstring('TIFF')]
ckeys = COLOURS.keys()
ckeys.sort()
cOptions = wrap(ckeys)
Expand Down
15 changes: 7 additions & 8 deletions omero/figure_scripts/ROI_Split_Figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
except ImportError:
import Image, ImageDraw # see ticket:2597

JPEG = "image/jpeg"
PNG = "image/png"

COLOURS = scriptUtil.COLOURS # name:(rgba) map
OVERLAY_COLOURS = dict(COLOURS, **scriptUtil.EXTRA_COLOURS)
Expand Down Expand Up @@ -692,19 +690,20 @@ def getTags(name, tagsList, pdList):

#print figLegend # bug fixing only

format = JPEG
if "Format" in commandArgs:
if commandArgs["Format"] == "PNG":
format = PNG
format = commandArgs["Format"]

output = "roiFigure"
if "Figure_Name" in commandArgs:
output = str(commandArgs["Figure_Name"])

if format == PNG:
if format == 'PNG':
output = output + ".png"
fig.save(output, "PNG")
mimetype = "image/png"
elif format == 'TIFF':
output = output + ".tiff"
fig.save(output, "TIFF")
mimetype = "image/tiff"
else:
output = output + ".jpg"
fig.save(output)
Expand All @@ -730,7 +729,7 @@ def runAsScript():
algorithums = [rstring('Maximum Intensity'),rstring('Mean Intensity')]
roiLabel = """Specify an ROI to pick by specifying it's shape label. 'FigureROI' by default,
(not case sensitive). If matching ROI not found, use any ROI."""
formats = [rstring('JPEG'),rstring('PNG')]
formats = [rstring('JPEG'),rstring('PNG'),rstring('TIFF')]
ckeys = COLOURS.keys()
ckeys.sort()
cOptions = wrap(ckeys)
Expand Down
16 changes: 8 additions & 8 deletions omero/figure_scripts/Split_View_Figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
COLOURS = scriptUtil.COLOURS # name:(rgba) map
OVERLAY_COLOURS = dict(COLOURS, **scriptUtil.EXTRA_COLOURS)

JPEG = "image/jpeg"
PNG = "image/png"

# keep track of log strings.
logStrings = []
Expand Down Expand Up @@ -587,15 +585,17 @@ def getTags(name, tagsList, pdList):
mergedIndexes, mergedColours, mergedNames, width, height, imageLabels, algorithm, stepping, scalebar, overlayColour)

figLegend = "\n".join(logStrings)
format = JPEG
if scriptParams["Format"] == "PNG":
format = PNG
output = scriptParams["Figure_Name"]

if format == PNG:
output = scriptParams["Figure_Name"]
format = scriptParams["Format"]
if format == "PNG":
output = output + ".png"
fig.save(output, "PNG")
mimetype = "image/png"
elif format == 'TIFF':
output = output + ".tiff"
fig.save(output, "TIFF")
mimetype = "image/tiff"
else:
output = output + ".jpg"
fig.save(output)
Expand All @@ -619,7 +619,7 @@ def runAsScript():
dataTypes = [rstring('Image')]
labels = [rstring('Image Name'), rstring('Datasets'), rstring('Tags')]
algorithums = [rstring('Maximum Intensity'),rstring('Mean Intensity')]
formats = [rstring('JPEG'),rstring('PNG')]
formats = [rstring('JPEG'),rstring('PNG'),rstring('TIFF')]
ckeys = COLOURS.keys()
ckeys.sort()
cOptions = wrap(ckeys)
Expand Down
6 changes: 5 additions & 1 deletion omero/figure_scripts/Thumbnail_Figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ def makeThumbnailFigure(conn, scriptParams):
output = output + ".png"
figure.save(output, "PNG")
mimetype = "image/png"
elif format == 'TIFF':
output = output + ".tiff"
figure.save(output, "TIFF")
mimetype = "image/tiff"
else:
output = output + ".jpg"
figure.save(output)
Expand All @@ -305,7 +309,7 @@ def runAsScript():
def __init__(self, name, optional = False, out = False, description = None, type = None, min = None, max = None, values = None)
"""

formats = [rstring('JPEG'),rstring('PNG')]
formats = [rstring('JPEG'),rstring('PNG'),rstring('TIFF')]
dataTypes = [rstring('Dataset'),rstring('Image')]

client = scripts.client('Thumbnail_Figure.py', """Export a figure of thumbnails, optionally sorted by tag.
Expand Down