Skip to content

Commit

Permalink
Load images into live viewer on initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
JackEAllen committed Sep 13, 2023
1 parent b8a7a2f commit 5cb476c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mantidimaging/gui/windows/live_viewer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def path(self, path: Path) -> None:
self._dataset_path = path
self.image_watcher = ImageWatcher(path)
self.image_watcher.image_changed.connect(self._handle_image_changed_in_list)
self.image_watcher.find_images()

def _handle_image_changed_in_list(self, image_files: list[Image_Data]) -> None:
"""
Expand All @@ -113,6 +112,15 @@ def _handle_image_changed_in_list(self, image_files: list[Image_Data]) -> None:
self.images = image_files
self.presenter.update_image_list(image_files)

def get_images(self) -> None:
"""
Trigger the image watcher to find images in the directory
in case images are already present.
"""
if self.image_watcher:
image_files = self.image_watcher.find_images()
self._handle_image_changed_in_list(image_files)


class ImageWatcher(QObject):
"""
Expand Down
1 change: 1 addition & 0 deletions mantidimaging/gui/windows/live_viewer/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def show(self) -> None:
self.watch_directory()

self.live_viewer.z_slider.valueChanged.connect(self.presenter.select_image)
self.presenter.model.get_images()

def show_most_recent_image(self, image: np.ndarray) -> None:
"""
Expand Down

0 comments on commit 5cb476c

Please sign in to comment.