mantidimaging.core.io.loader.img_loader module

This module handles the loading of FIT, FITS, TIF, TIFF

class mantidimaging.core.io.loader.img_loader.ImageLoader(load_func: Callable[[str], ndarray], img_format: str, img_shape: Tuple[int, ...], data_dtype: npt.DTypeLike, indices: List[int] | Indices | None, progress: Progress | None = None)[source]

Bases: object

load_data(file_path: str | None) Tuple[ndarray | None, List[str] | None][source]
load_files(files: List[str]) ndarray[source]
load_sample_data(input_file_names: List[str]) ndarray | Images[source]
mantidimaging.core.io.loader.img_loader.execute(load_func: Callable[[str], ndarray], sample_path: List[str], flat_before_path: str | None, flat_after_path: str | None, dark_before_path: str | None, dark_after_path: str | None, img_format: str, dtype: npt.DTypeLike, indices: List[int] | Indices | None, progress: Progress | None = None) StrictDataset[source]

Reads a stack of images into memory, assuming dark and flat images are in separate directories.

If several files are found in the same directory (for example you give image0001.fits and there’s also image0002.fits, image0003.fits) these will also be loaded as the usual convention in ImageJ and related imaging tools, using the last digits to sort the images in the stack.

Usual type in fits is 16-bit pixel depth, data type is denoted with:

‘>i2’ - uint16 ‘>f2’ - float16 ‘>f4’ - float32

Returns:

Images object