Skip to content

Commit

Permalink
FLASH PR Refactor How Fits Files are Loaded to Remove String Formatti…
Browse files Browse the repository at this point in the history
…ng (#2462)
  • Loading branch information
samtygier-stfc authored Jan 20, 2025
2 parents a2e5302 + c2f20e5 commit 92c4cfc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mantidimaging/gui/windows/live_viewer/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down

0 comments on commit 92c4cfc

Please sign in to comment.