Skip to content

Commit

Permalink
layer list ignores images added at end of training (or without paths)
Browse files Browse the repository at this point in the history
  • Loading branch information
yrkim98 committed Feb 22, 2024
1 parent ae4a173 commit 4168ce2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/allencell_ml_segmenter/prediction/file_input_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,16 @@ def _from_directory_slot(self) -> None:

def _update_layer_list(self, event: Optional[NapariEvent] = None) -> None:
self._image_list.clear()
channels: Optional[int] = None
for idx, layer in enumerate(self._viewer.get_layers()):
self._image_list.add_item(layer.name)
if idx == 0:
# This is slow, but there's no way around it
channels = extract_num_channels_from_image(layer.source.path)

self._model.set_max_channels(channels)
max_channels: Optional[int] = None
for layer in self._viewer.get_layers():
path_of_layer_image: Path = layer.source.path
if path_of_layer_image:
self._image_list.add_item(layer.name)
if not max_channels:
# This is slow, but there's no way around it
max_channels = extract_num_channels_from_image(path_of_layer_image)
if max_channels:
self._model.set_max_channels(max_channels)

def _set_selected_image_paths_from_napari(
self, event: Optional[Event] = None
Expand Down

0 comments on commit 4168ce2

Please sign in to comment.