diff --git a/omero/export_scripts/Batch_Image_Export.py b/omero/export_scripts/Batch_Image_Export.py index 5f8ac5d92..bd814a115 100644 --- a/omero/export_scripts/Batch_Image_Export.py +++ b/omero/export_scripts/Batch_Image_Export.py @@ -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) @@ -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), @@ -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'), diff --git a/omero/figure_scripts/Movie_Figure.py b/omero/figure_scripts/Movie_Figure.py index a9503e5eb..022c31904 100644 --- a/omero/figure_scripts/Movie_Figure.py +++ b/omero/figure_scripts/Movie_Figure.py @@ -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): @@ -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) @@ -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) @@ -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", diff --git a/omero/figure_scripts/Movie_ROI_Figure.py b/omero/figure_scripts/Movie_ROI_Figure.py index 262ea7eb1..8d07cfb04 100644 --- a/omero/figure_scripts/Movie_ROI_Figure.py +++ b/omero/figure_scripts/Movie_ROI_Figure.py @@ -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) @@ -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) @@ -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) diff --git a/omero/figure_scripts/ROI_Split_Figure.py b/omero/figure_scripts/ROI_Split_Figure.py index 30990e047..6a72e39c6 100644 --- a/omero/figure_scripts/ROI_Split_Figure.py +++ b/omero/figure_scripts/ROI_Split_Figure.py @@ -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) @@ -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) @@ -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) diff --git a/omero/figure_scripts/Split_View_Figure.py b/omero/figure_scripts/Split_View_Figure.py index ad0bfe521..6c6a4b814 100644 --- a/omero/figure_scripts/Split_View_Figure.py +++ b/omero/figure_scripts/Split_View_Figure.py @@ -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 = [] @@ -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) @@ -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) diff --git a/omero/figure_scripts/Thumbnail_Figure.py b/omero/figure_scripts/Thumbnail_Figure.py index 2de871d37..387bcc35c 100644 --- a/omero/figure_scripts/Thumbnail_Figure.py +++ b/omero/figure_scripts/Thumbnail_Figure.py @@ -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) @@ -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.