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

Don't compute channel window in zarr sinks #1705

Merged
merged 1 commit into from
Oct 28, 2024
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
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