Skip to content
Snippets Groups Projects
Commit 95675a7e authored by Alán Muñoz's avatar Alán Muñoz
Browse files

[WIP]feat(tiler): support metaless local expts

parent 16faba8f
No related branches found
No related tags found
No related merge requests found
...@@ -231,16 +231,16 @@ class Tiler(ProcessABC): ...@@ -231,16 +231,16 @@ class Tiler(ProcessABC):
super().__init__(parameters) super().__init__(parameters)
self.image = image self.image = image
self._metadata = metadata self._metadata = metadata
self.channels = metadata["channels"] self.channels = metadata.get(
"channels", list(range(metadata["size_c"]))
)
self.ref_channel = self.get_channel_index(parameters.ref_channel) self.ref_channel = self.get_channel_index(parameters.ref_channel)
self.trap_locs = trap_locs self.trap_locs = trap_locs
try: try:
self.z_perchannel = { self.z_perchannel = {
ch: metadata["zsectioning/nsections"] if zsect else 1 ch: zsect
for zsect, ch in zip( for ch, zsect in zip(self.channels, metadata["zsections"])
metadata["channels"], metadata["channels/zsect"]
)
} }
except Exception as e: except Exception as e:
print(f"Warning:Tiler: No z_perchannel data: {e}") print(f"Warning:Tiler: No z_perchannel data: {e}")
...@@ -555,20 +555,21 @@ class Tiler(ProcessABC): ...@@ -555,20 +555,21 @@ class Tiler(ProcessABC):
def ref_channel_index(self): def ref_channel_index(self):
return self.get_channel_index(self.parameters.ref_channel) return self.get_channel_index(self.parameters.ref_channel)
def get_channel_index(self, item): def get_channel_index(self, channel: str or int):
""" """
Find index for channel using regex. Returns the first matched string. Find index for channel using regex. Returns the first matched string.
Parameters Parameters
---------- ----------
item: string channel: string or int
The channel The channel or index to be used
""" """
channel = find_channel_index(self.channels, item) if isinstance(channel, str):
if channel is None: channel = find_channel_index(self.channels, channel)
raise Warning( if channel is None:
f"Reference channel {channel} not in the available channels: {self.channels}" raise Warning(
) f"Reference channel {channel} not in the available channels: {self.channels}"
)
return channel return channel
@staticmethod @staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment