Skip to content

Commit

Permalink
Merge pull request #1261 from girder/tile-memory-allocation
Browse files Browse the repository at this point in the history
Reduce memory allocation during some region tiling operations
  • Loading branch information
manthey authored Aug 14, 2023
2 parents 77a667f + defafd3 commit b6a49a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Allow caching rounded histograms ([#1252](../../pull/1252))
- 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))

### Changes
- Minor code changes based on suggestions from ruff linting ([#1257](../../pull/1257))
Expand Down
2 changes: 2 additions & 0 deletions large_image/tilesource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2135,6 +2135,8 @@ def _addRegionTileToImage(
if tiled:
return self._addRegionTileToTiled(image, subimage, x, y, width, height, tile, **kwargs)
if image is None:
if (x, y, width, height) == (0, 0, subimage.shape[1], subimage.shape[0]):
return subimage
try:
image = np.zeros(
(height, width, subimage.shape[2]),
Expand Down

0 comments on commit b6a49a5

Please sign in to comment.