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

Harden style compositing of partial tiles. #889

Merged
merged 1 commit into from
Jul 20, 2022
Merged
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
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