Skip to content

new API #20

@will-moore

Description

@will-moore

After having got some usage, it's time to consider missing features and other issues that could be addressed via a change in API...

Issues

  • renderThumbnail() and renderImage() don't need to be different methods. They both do the same thing but some features are not supported in both (e.g. can't specify rendering settings in renderThumbnail(), calling renderImage() may try to render a very large image - no targetSize option)
  • renderThumbnail(url, targetSize, autoBoost, maxSize) with lots of optional arguments (and more to come) makes for a painful API if you just want to specify just one of the options
  • It would be nice to separate the rendering to rgb array from the conversion to a dataUrl (which uses canvas). This would allow testing without needing browser API (see Test library using framework #18). Also it would support users who want the rgb values to render to their own canvas.
  • When setting omero rendering settings, we currently have to load and update the omero object "manually", then pass it in as an argument to 'render'.

Proposal

Single render function that supports various options, behaves same as current renderThumbnail(), defaulting to smallest resolution:

omezarr.render(url, options)

Create a Multiscales object that we can update and render. This is equivalent of current getMultiscaleWithArray()

import { Multiscales } from omezarr

const img = new Multiscales(url)
img.axes     // [{"name": "c", "type": "channel"}, {"name": "y", "type": "space"}, {"name": "x", "type": "space"}] 
img.channels  // [{"label": "DAPI", "window": {}, "active": True}...]
img.shapes   // [[2, 236, 275, 271], [2, 236, 138, 136], [2, 236, 69, 68]]

img.setChannelActive(0, false)
img.setChannelColor(0, "FF0000")
img.render(options)

Options to render to rgb:

omezarr.renderRbg(url, options)
img.renderRbg(options)

Options

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions