tomodrgn.mrc.LazyImageStack#
- class LazyImageStack(fname: str, indices_image: list[int], representative_header: MRCHeader | None = None)[source]#
Bases:
object
Efficiently load a particle stack from an NxDxD stack.mrcs file on-the-fly. Minimizes calls to file opening, file seeking, and file reading in single-process context.
Methods
Load the image data from disk to a numpy array
- get(low_memory: bool = True) ndarray [source]#
Load the image data from disk to a numpy array
- Parameters:
low_memory – if True, only load selected slices into memory via multiple disk accesses of sequentially grouped slices (slower, but uses less RAM). If False, load the whole file in one disk access and then return selected slices (faster on slow filesystems but uses more RAM).
- Returns:
the numpy array of data