Skip to content

Commit

Permalink
Merge pull request #1705 from girder/zarr-channel-data
Browse files Browse the repository at this point in the history
Don't compute channel window in zarr sinks
  • Loading branch information
manthey authored Oct 28, 2024
2 parents 99405bb + 7de60f5 commit 9cc086d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
- Better handle images with signed pixel data ([#1695](../../pull/1695))
- Reduce loading geojs when switching views in Girder ([#1699](../../pull/1699))

### Bug Fixes

- Don't compute channel window in zarr sinks ([#1705](../../pull/1705))

## 1.30.1

### Improvements
Expand Down
30 changes: 15 additions & 15 deletions sources/zarr/large_image_source_zarr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,21 +872,21 @@ def _writeInternalMetadata(self):
'inverted': False,
'label': f'Band {c + 1}',
}
slicing = tuple(
slice(None)
if k != ('c' if 'c' in self._axes else 's')
else c
for k, v in self._axes.items()
)
channel_data = base_array[slicing]
channel_min = np.min(channel_data)
channel_max = np.max(channel_data)
channel_metadata['window'] = {
'end': channel_max,
'max': channel_max,
'min': channel_min,
'start': channel_min,
}
# slicing = tuple(
# slice(None)
# if k != ('c' if 'c' in self._axes else 's')
# else c
# for k, v in self._axes.items()
# )
# channel_data = base_array[slicing]
# channel_min = np.min(channel_data)
# channel_max = np.max(channel_data)
# channel_metadata['window'] = {
# 'end': channel_max,
# 'max': channel_max,
# 'min': channel_min,
# 'start': channel_min,
# }
if len(self._channelNames) > c:
channel_metadata['label'] = self._channelNames[c]
if len(self._channelColors) > c:
Expand Down
15 changes: 7 additions & 8 deletions test/test_sink.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import math
import subprocess
from multiprocessing.pool import Pool, ThreadPool
from os import sys
Expand Down Expand Up @@ -419,13 +418,13 @@ def testMetadata(tmp_path):
assert c.get('family') == 'linear'
assert not c.get('inverted')
assert c.get('label') == channel_names[i]
window = c.get('window')
assert window is not None
# max should be nearly 1 and min should be nearly 0
assert math.ceil(window.get('end')) == 1
assert math.ceil(window.get('max')) == 1
assert math.floor(window.get('start')) == 0
assert math.floor(window.get('min')) == 0
# window = c.get('window')
# assert window is not None
# # max should be nearly 1 and min should be nearly 0
# assert math.ceil(window.get('end')) == 1
# assert math.ceil(window.get('max')) == 1
# assert math.floor(window.get('start')) == 0
# assert math.floor(window.get('min')) == 0

rdefs = omero.get('rdefs')
assert rdefs is not None
Expand Down

0 comments on commit 9cc086d

Please sign in to comment.