diff --git a/mantidimaging/gui/windows/live_viewer/presenter.py b/mantidimaging/gui/windows/live_viewer/presenter.py index a4e5aa5c092..abb63f7db59 100644 --- a/mantidimaging/gui/windows/live_viewer/presenter.py +++ b/mantidimaging/gui/windows/live_viewer/presenter.py @@ -117,10 +117,13 @@ def load_image(image_path: Path) -> np.ndarray: if image_path.suffix.lower() in [".tif", ".tiff"]: with tifffile.TiffFile(image_path) as tif: image_data = tif.asarray() + return image_data elif image_path.suffix.lower() == ".fits": - with fits.open(image_path.__str__()) as fit: - image_data = fit[0].data - return image_data + with fits.open(image_path) as fits_hdul: + image_data = fits_hdul[0].data + return image_data + else: + raise ValueError(f"Unsupported file type: {image_path.suffix}") def update_image_modified(self, image_path: Path) -> None: """