Skip to content

Commit

Permalink
Merge pull request #1262 from girder/style-memory
Browse files Browse the repository at this point in the history
Reduce memory allocation during some styling operations
  • Loading branch information
manthey authored Aug 14, 2023
2 parents b6a49a5 + 1679f5a commit e7191d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Add an endpoint to make it easier to replace thumbnails ([#1253](../../pull/1253))
- Presets from Large Image Configuration file ([#1248](../../pull/1248), [#1256](../../pull/1256))
- Reduce memory allocation during some region tiling operations ([#1261](../../pull/1261))
- Reduce memory allocation during some styling operations ([#1262](../../pull/1262))

### Changes
- Minor code changes based on suggestions from ruff linting ([#1257](../../pull/1257))
Expand Down
4 changes: 3 additions & 1 deletion large_image/tilesource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,9 @@ def _applyStyle(self, image, style, x, y, z, frame=None): # noqa
if not style or ('icc' in style and len(style) == 1):
sc.output = image
else:
sc.output = np.zeros((image.shape[0], image.shape[1], 4), float)
sc.output = np.zeros(
(image.shape[0], image.shape[1], 4),
np.float32 if image.dtype != np.float64 else image.dtype)
image = self._applyStyleFunction(image, sc, 'pre')
for eidx, entry in enumerate(sc.style['bands']):
sc.styleIndex = eidx
Expand Down

0 comments on commit e7191d6

Please sign in to comment.