Skip to content

Commit

Permalink
Raise detailed exception with unsupported channel information
Browse files Browse the repository at this point in the history
  • Loading branch information
blowekamp committed Oct 2, 2023
1 parent 1b7793e commit fb6873c
Showing 1 changed file with 13 additions and 2 deletions.
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 bug"
f" only {len(color_sequence)} is supported!"
)

json_channel_array = []

Expand Down

0 comments on commit fb6873c

Please sign in to comment.