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

Add a style option #397

Merged
merged 6 commits into from
Jan 10, 2020
Merged

Add a style option #397

merged 6 commits into from
Jan 10, 2020

Conversation

manthey
Copy link
Member

@manthey manthey commented Nov 14, 2019

This better handles high bit-depth images.

The style option is an optional json-encoded parameter. It is either an object with "bands" followed by a list or a single entry as from that list. Each entry is an object with all optional parameters. These are:

  • band: either a number or a string. If -1 or None, unspecified, the same as "gray". If a number, a 1-based numerical index into the channels of the image. If a string, one of ('red', 'green', 'blue', 'gray', 'alpha'). Note that 'gray' on an RGB or RGBA image will use the green band, and all colors on a greyscale image will use the luminance band.

  • min: the value to map to the first palette value. Defaults to 0. 'auto' to use 0 if the reported minimum and maximum of the band are between [0, 255] or use the reported minimum otherwise. 'min' or 'max' to always uses the reported minimum or maximum.

  • max: the value to map to the last palette value. Defaults to 255. 'auto' to use 0 if the reported minimum and maximum of the band are between [0, 255] or use the reported maximum otherwise. 'min' or 'max' to always uses the reported minimum or maximum.

  • palette: a list of two or more color strings, where color strings are of the form #RRGGBB, #RRGGBBAA, #RGB, #RGBA (or anything else PIL can parse).

  • nodata: the value to use for missing data. null or unset to not use a nodata value.

  • composite: either 'lighten' or 'multiply'. Defaults to 'lighten' for all except the alpha band. Bands are composited in the order listed.

  • clamp: either True to clamp values outside of the [min, max] to the ends of the palette or False to make outside values transparent.

As part of this PR, this adds support for small OME TIFF images that aren't tiled. Strips are aggregated together to make a minimum size, as serving individual strips is inefficient.

Add a histogram method and endpoint.

@manthey manthey force-pushed the style-option branch 3 times, most recently from 7f5427c to b096ea7 Compare November 15, 2019 19:36
@manthey manthey force-pushed the style-option branch 2 times, most recently from bab4959 to 163ba50 Compare December 13, 2019 18:02
This adds support for small OME TIFF images that aren't tiled.  Strips
are aggregated together to make a minimum size, as serving individual
strips is inefficient.
This better handles high bit-depth images.

The style option is an optional json-encoded parameter.  It is either an
object with "bands" followed by a list or a single entry as from that
list.  Each entry is an object with all optional parameters.  These are:

- band: either a number or a string.  If -1 or None, unspecified, the
  same as "gray".  If a number, a 1-based numerical index into the
  channels of the image.  If a string, one of ('red', 'green', 'blue',
  'gray', 'alpha').  Note that 'gray' on an RGB or RGBA image will use
  the green band, and all colors on a greyscale image will use the
  luminance band.

- min: the value to map to the first palette value.  Defaults to 0.
  'auto' to use 0 if the reported minimum and maximum of the band are
  between [0, 255] or use the reported minimum otherwise.  'min' or
  'max' to always uses the reported minimum or maximum.

- max: the value to map to the last palette value.  Defaults to 255.
  'auto' to use 0 if the reported minimum and maximum of the band are
  between [0, 255] or use the reported maximum otherwise.  'min' or
  'max' to always uses the reported minimum or maximum.

- palette: a list of two or more color strings, where color strings are
  of the form #RRGGBB, #RRGGBBAA, #RGB, #RGBA (or anything else PIL can
  parse).

- nodata: the value to use for missing data.  null or unset to not use a
  nodata value.

- composite: either 'lighten' or 'multiply'.  Defaults to 'lighten' for
  all except the alpha band.  Bands are composited in the order listed.

- clamp: either True to clamp values outside of the [min, max] to the
  ends of the palette or False to make outside values transparent.

TODO:

- Check that sparse and missing levels with 16-bit output are correct.
@manthey
Copy link
Member Author

manthey commented Jan 10, 2020

This has been field-tested, and new features will need to build on this. Merging.

@manthey manthey merged commit 9c753ba into master Jan 10, 2020
@manthey manthey deleted the style-option branch January 10, 2020 19:45
@manthey manthey mentioned this pull request Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant