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

added _repr_html_ method for _ImageWrapper #394

Merged
merged 6 commits into from
Apr 24, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
escaped non-existing pixsizes/units
  • Loading branch information
jo-mueller committed Apr 18, 2024
commit b0a7fada46d8af0764eeb94882474a610fbadde4
21 changes: 13 additions & 8 deletions src/omero/gateway/utils.py
Original file line number Diff line number Diff line change
@@ -225,6 +225,17 @@ def propertiesToDict(m, prefix=None):
def image_to_html(image):
import base64

try:
pixsizeX = '{:.3f}'.format(image.getPixelSizeX())
pixsizeY = '{:.3f}'.format(image.getPixelSizeY())
pixsizeZ = '{:.3f}'.format(image.getPixelSizeZ())
UnitX = image.getPixelSizeX().getUnit()
UnitY = image.getPixelSizeY().getUnit()
UnitZ = image.getPixelSizeZ().getUnit()
except:
pixsizeX, pixsizeY, pixsizeZ = 'na', 'na', 'na'
UnitX, UnitY, UnitZ = 'na', 'na', 'na'

html_style_header = """
<!DOCTYPE html>
<html lang="en">
@@ -273,14 +284,8 @@ def obj_html(obj, otype):
{image.getSizeZ()},
{image.getSizeY()},
{image.getSizeX()})"""
physical_dims = """({:.3f}, {:.3f}, {:.3f})""".format(
image.getPixelSizeZ(),
image.getPixelSizeY(),
image.getPixelSizeX())
physical_units = f"""(
{image.getPixelSizeZ(units=True).getUnit()},
{image.getPixelSizeY(units=True).getUnit()},
{image.getPixelSizeX(units=True).getUnit()})"""
physical_dims = f"""({pixsizeZ}, {pixsizeY}, {pixsizeX})""".format()
physical_units = f"""({UnitZ}, {UnitY}, {UnitX})"""

table_dimensions = f"""
<table>\n