BioFormatsVirtualLoader¶
- class io.loaders.BioFormatsVirtualLoader¶
Bases:
handleBIOFORMATSVIRTUALLOADER - On-demand plane reader for MIB3 BioFormats virtual datasets.
Wraps a single microscopy file accessible via the Bio-Formats library. A loci.formats.Memoizer reader is opened lazily on the first readPlane call and kept open for the lifetime of the loader, avoiding the overhead of re-opening the reader for every z-slice and time-point.
Call close() (or let closeVirtualDataset delete the loader) to release the file handle when the virtual dataset is closed.
Unlike the batch loaders in +io/+loaders/ this class does NOT implement BaseImageLoader - it is stateful and designed for repeated single-plane reads rather than single full-dataset loads.
Usage example:
loader = io.loaders.BioFormatsVirtualLoader('/data/stack.czi', 0, tempdir); planes = loader.readPlane([1 512], [1 512], 5, [1 2], 0, 'uint16'); % planes is [512, 512, 2] - one tile per requested channel loader.close();- Constructor Summary
- BioFormatsVirtualLoader(filename, seriesIndex, memoDir)¶
BIOFORMATSVIRTUALLOADER - Create an on-demand Bio-Formats plane reader.
- Syntax:
obj = BioFormatsVirtualLoader(filename, seriesIndex, memoDir)- Input Arguments:
filename - [char] full path to the BioFormats-readable file
seriesIndex - [numeric] 0-based series index
memoDir - [char] directory for BioFormats Memoizer memo files
- Output Arguments:
obj - [BioFormatsVirtualLoader] new loader instance
- Property Summary
- filename¶
- memoDir¶
[numeric] 0-based series index (Virtual.seriesName{fileIdx} - 1)
- reader¶
[char] directory for the BioFormats Memoizer memo files
- seriesIndex¶
[char] full path to the BioFormats-readable file
- Method Summary
- close()¶
CLOSE - Close the Bio-Formats reader and release the file handle.
- Syntax:
obj.close()
Safe to call multiple times.
- delete()¶
DELETE - Destructor - closes the Bio-Formats reader when the object is destroyed.
- Syntax:
obj.delete()
- readPlane(Ylim, Xlim, planeId, colChannel, timepoint, dataClass)¶
READPLANE - Read one XY tile across the requested colour channels from a single z/t plane.
- Syntax:
planes = obj.readPlane(Ylim, Xlim, planeId, colChannel, timepoint, dataClass)
The Bio-Formats reader is opened on the first call and reused on all subsequent calls to this loader.
- Input Arguments:
Ylim - [1x2 numeric] pixel row range
[ymin ymax](1-based, inclusive)Xlim - [1x2 numeric] pixel column range
[xmin xmax](1-based, inclusive)planeId - [numeric] 1-based z-plane index within this file/series
colChannel - [1 x nC numeric] vector of 1-based colour channel indices
timepoint - [numeric] 0-based time-point index (as used by getIndex)
dataClass - [char] output class, e.g.
'uint8'or'uint16'
- Output Arguments:
planes - [nY x nX x nC numeric] array - one slice per requested channel