Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right panel performance fixes #17

Closed
wants to merge 11 commits into from
Closed
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
36 changes: 21 additions & 15 deletions omeroweb/webclient/controller/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ def countTablesOnParents(self):

return total

def canExportAsJpg(self, request, objDict=None):
def canExportAsJpg(self, request, image_ids=None):
"""
Can't export as Jpg, Png, Tiff if bigger than approx 12k * 12k.
Limit set by OOM error in omeis.providers.re.RGBIntBuffer
"""
can = True
can = False
try:
limit = request.session["server_settings"]["download_as"]["max_size"]
except Exception:
Expand All @@ -283,13 +283,24 @@ def canExportAsJpg(self, request, objDict=None):
sizey = self.image.getSizeY()
if sizex is None or sizey is None or (sizex * sizey) > limit:
can = False
elif objDict is not None:
if "image" in objDict:
for i in objDict["image"]:
sizex = i.getSizeX()
sizey = i.getSizeY()
if sizex is None or sizey is None or (sizex * sizey) > limit:
can = False
else:
can = True
elif image_ids is not None:
params = omero.sys.ParametersI()
params.addIds(image_ids)
query = (
"select max(pix.sizeX * pix.sizeY) from Pixels as pix"
" where pix.image.id in (:ids)"
)
try:
result = self.conn.getQueryService().projection(
query, params, self.conn.SERVICE_OPTS
)
if result[0][0].val < limit:
can = True
except omero.ValidationException:
# e.g. Big Image pixel count causes HQL convertHibernateAccessException
pass
return can

def canDownload(self, objDict=None):
Expand Down Expand Up @@ -368,12 +379,7 @@ def listFigureScripts(self, objDict=None, request=None):
)
elif objDict is not None:
if "image" in objDict:
for i in objDict["image"]:
if i.getSizeC() > 1:
splitView["enabled"] = (
"Split_View_Figure.py" in availableScripts
)
break
splitView["enabled"] = "Split_View_Figure.py" in availableScripts
thumbnailFig = {
"id": "Thumbnail",
"name": "Thumbnail Figure",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<!--
This template is used as an 'include' for metadata_general but
also as a standalone response template for dynamically-loaded menu for batch annotate
-->
{% if canDownload %}
<!-- Here we handle a single image (in metadata general) - see below for multiple images (batch annotate) -->
{% if not share and image.getImportedFilesInfo.count %}
{% with filesetInfo=image.getImportedFilesInfo %}
<li>
<!-- if we have a single orig file, download directly. Otherwise popup a
'preparing zip' download placeholder -->
<a id="download-origfile"
{% if filesetInfo.count == 1 %}
href="{% url 'archived_files' image.id %}"
{% else %}
href="#"
onClick="return OME.openPopup('{% url 'download_placeholder' %}?ids=image-{{ image.id }}&fileCount={{ fileCount }}&name={{ image.name }}');"
{% endif %}
title="Download {{ filesetInfo.count }} original imported file{{ filesetInfo.count|pluralize:'s'}} ({{ filesetInfo.size|filesizeformat }})"
>
Download...</a>
</li>
{% endwith %}
<li>
<a href="{% url 'download_orig_metadata' image.id %}"
title="Download Original Metadata as a text file">
Download Original Metadata
</a>
</li>
<!-- Here we handle multiple images (batch annotate panel) -->
{% elif filesetInfo %}
<li {% if not filesetInfo.count %}class='disabled'{% endif %}>
<a id="download-origfile"
{% if filesetInfo.count == 0 %}
href="#"
{% else %}
{% if filesetInfo.count == 1 %}
href="{% url 'archived_files' %}?{{ obj_string }}"
{% else %}
href="#"
onClick="return OME.openPopup('{% url 'download_placeholder' %}?ids={{ link_string }}&fileCount={{ filesetInfo.count }}&index={{ index }}');"
{% endif %}
{% endif %}
title="Download {{ filesetInfo.count }} original imported file{{ filesetInfo.count|pluralize:'s'}} ({{ filesetInfo.size|filesizeformat }})"
>
Download...</a>
</li>
<li class="disabled">
<a href="#"
title="Download Original Metadata (for single images only)">
Download Original Metadata
</a>
</li>
{% else %}
<li class="disabled">
<a title="No original imported files to download">Download...</a>
</li>
{% endif %}
<!-- endif canDownload -->
{% endif %}

{% if not share %}
{% if image and not image.requiresPixelsPyramid and ome.can_create %}
<li>
<a id="create-ometiff" href="{% url 'ome_tiff_script' image.id %}"
title="Create OME-TIFF File for Download">Export as OME-TIFF...</a>
</li>
{% else %}
<li class="disabled">
<a href="#" class="disabled"
title="Create OME-TIFF File for Download">Export as OME-TIFF...</a>
</li>
{% endif %}
{% endif %}

{% if image %}
{% with ex=canExportAsJpg %}
<li {% if not ex %}class="disabled"{% endif %}>
<a
{% if not ex %}
href="#" class="disabled" title="Image is too big to download as JPEG"
{% else %}
{% if share and not share.share.isOwned %}
href="{% url 'web_render_image_download' share_id=share.share.id iid=image.id %}"
{% else %}
href="{% url 'web_render_image_download' image.id %}"
{% endif %}
title="Download as JPEG"
{% endif %}
>
Export as JPEG
</a>
</li>
<li {% if not ex %}class="disabled"{% endif %}>
<a
{% if not ex %}
href="#" class="disabled" title="Image is too big to download as PNG"
{% else %}
{% if share and not share.share.isOwned %}
href="{% url 'web_render_image_download' share_id=share.share.id iid=image.id %}?format=png"
{% else %}
href="{% url 'web_render_image_download' image.id %}?format=png"
{% endif %}
title="Download as PNG"
{% endif %}
>
Export as PNG
</a>
</li>
<li {% if not ex %}class="disabled"{% endif %}>
<a
{% if not ex %}
href="#" class="disabled" title="Image is too big to download as TIFF"
{% else %}
{% if share and not share.share.isOwned %}
href="{% url 'web_render_image_download' share_id=share.share.id iid=image.id %}?format=tif"
{% else %}
href="{% url 'web_render_image_download' image.id %}?format=tif"
{% endif %}
title="Download as TIFF"
{% endif %}
>
Export as TIFF
</a>
</li>
{% endwith %}
{% else %}
{% if filesetInfo %}
{% with ex=canExportAsJpg %}
<li {% if not ex %}class="disabled"{% endif %}>
<a href="#"
{% if not ex %}
class="disabled" title="Images are too big to download as JPEGs"
{% else %}
onClick="return OME.openPopup('{% url 'download_placeholder' %}?ids={{ link_string }}&format=jpeg&index={{ index }}');"
title="Download as JPEGs (zip)"
{% endif %}
>
Export as JPEG
</a>
</li>
<li {% if not ex %}class="disabled"{% endif %}>
<a href="#"
{% if not ex %}
class="disabled" title="Images are too big to download as PNGs"
{% else %}
onClick="return OME.openPopup('{% url 'download_placeholder' %}?ids={{ link_string }}&format=png&index={{ index }}');"
title="Download as PNGs (zip)"
{% endif %}
>
Export as PNG
</a>
</li>
<li {% if not ex %}class="disabled"{% endif %}>
<a href="#"
{% if not ex %}
class="disabled" title="Images are too big to download as TIFFs"
{% else %}
onClick="return OME.openPopup('{% url 'download_placeholder' %}?ids={{ link_string }}&format=tif&index={{ index }}');"
title="Download as TIFFs (zip)"
{% endif %}
>
Export as TIFF
</a>
</li>
{% endwith %}
{% endif %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h1 style="word-wrap: break-word;">{{ nameText|escape }}</h1>
</table>

{% if not manager.tag %}
<select id="annotationFilter" title="Filter annotations by user" data-userId="{{ ome.user.id }}"
<select id="annotationFilter" title="Filter annotations by user" data-userId="{{ ome.user_id }}"
style="position:absolute; right:0; bottom:3px; width:80px">
<option value="all">Show all</option>
<option value="me">Show added by me</option>
Expand Down
Loading
Loading