diff --git a/mantidimaging/gui/windows/live_viewer/model.py b/mantidimaging/gui/windows/live_viewer/model.py index 9d41dfd01d0..44b5400eb38 100644 --- a/mantidimaging/gui/windows/live_viewer/model.py +++ b/mantidimaging/gui/windows/live_viewer/model.py @@ -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: """ @@ -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): """ diff --git a/mantidimaging/gui/windows/live_viewer/view.py b/mantidimaging/gui/windows/live_viewer/view.py index 805a49820c7..13f4377b0bd 100644 --- a/mantidimaging/gui/windows/live_viewer/view.py +++ b/mantidimaging/gui/windows/live_viewer/view.py @@ -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: """