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

Raise detailed exception with unsupported channel information #83

Merged
merged 1 commit into from
Oct 3, 2023
Merged
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
15 changes: 13 additions & 2 deletions pytools/HedwigZarrImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,20 @@ def neuroglancer_shader_parameters(self, mad_scale=3) -> dict:

if _shader_type == "MultiChannel":
assert self._ome_ngff_multiscale_dims()[1] == "C"
assert len(list(self.ome_info.channel_names(self.ome_idx))) == self.shape[1]

if len(list(self.ome_info.channel_names(self.ome_idx))) != self.shape[1]:
raise RuntimeError(
f"Mismatch of number of Channels! Array has {self.shape[1]} but there"
f"are {len(list(self.ome_info.channel_names(self.ome_idx)))} names:"
f"{list(self.ome_info.channel_names(self.ome_idx))}"
)
color_sequence = ["red", "green", "blue", "cyan", "yellow", "magenta"]
assert self.shape[1] <= len(color_sequence)

if self.shape[1] > len(color_sequence):
raise RuntimeError(
f"Too many channels! The array has {self.shape[1]} channels but"
f" only {len(color_sequence)} is supported!"
)

json_channel_array = []

Expand Down