Skip to content

Commit

Permalink
Merge pull request #889 from girder/harden-style-compositing
Browse files Browse the repository at this point in the history
Harden style compositing of partial tiles.
  • Loading branch information
manthey authored Jul 20, 2022
2 parents 423649f + 8c76bf9 commit 333cce8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Support more style range options ([883](../../pull/883))
- When converting girder images locally, prefer mount paths ([886](../../pull/886))
- Store the id of job results for easier post-job work ([887](../../pull/887))
- Harden style compositing of partial tiles ([889](../../pull/889))

### Changes
- Be more consistent in source class name attribute assignment ([884](../../pull/884))
Expand Down
10 changes: 6 additions & 4 deletions large_image/tilesource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1213,11 +1213,13 @@ def _applyStyle(self, image, style, x, y, z, frame=None): # noqa
clrs = palette[numpy.floor(band * len(palette)).astype(int).clip(
0, len(palette) - 1), channel]
if composite == 'multiply':
output[:, :, channel] = numpy.multiply(
output[:, :, channel], numpy.where(keep, clrs / 255, 1))
output[:keep.shape[0], :keep.shape[1], channel] = numpy.multiply(
output[:keep.shape[0], :keep.shape[1], channel],
numpy.where(keep, clrs / 255, 1))
else:
output[:, :, channel] = numpy.maximum(
output[:, :, channel], numpy.where(keep, clrs, 0))
output[:keep.shape[0], :keep.shape[1], channel] = numpy.maximum(
output[:keep.shape[0], :keep.shape[1], channel],
numpy.where(keep, clrs, 0))
if dtype == 'uint16':
output = (output * 65535 / 255).astype(numpy.uint16)
elif dtype == 'float':
Expand Down

0 comments on commit 333cce8

Please sign in to comment.