neuralib.scan.lsm.TiffScanner
- final class neuralib.scan.lsm.TiffScanner[source]
Bases:
AbstractScannerLSM confocal image data.
TODO: multi-scene and different dimension data are lacking of testing
Methods
__init__(filepath)close()Explicitly close any open resources associated with the scanner.
get_channel_names([scene_idx])Get the names of the fluorescence channels for a specific scene.
view([channel, depth, project_type, norm])Generates a view of the image data based on the provided parameters.
z_projection(stacks[, project_type, axis])Computes a z-projection of a stack of images along a specified axis using a chosen method of projection.
Attributes
Get dimension code for the image array
file type of the image
filepathThe absolute path to the loaded confocal file.
image array
metadataReturn the metadata dictionary parsed from the file.
Total number of scenes (positions/series) in the file.
- close()[source]
Explicitly close any open resources associated with the scanner. Subclasses should override this if they open files or other resources.
- property image: ndarray
image array
- property file_type: str
file type of the image
- property dimcode: str
Get dimension code for the image array
- property n_scenes: int
Total number of scenes (positions/series) in the file.
- get_channel_names(scene_idx=None)[source]
Get the names of the fluorescence channels for a specific scene.
- Parameters:
scene_idx – The 0-based index of the scene.
- Returns:
A list of strings representing the channel names. Returns generic names (e.g., [‘Channel 1’, ‘Channel 2’]) if specific names are not available.
- Raises:
IndexError – If scene_idx is out of bounds.
- Return type:
list[str]
- view(channel=0, depth=None, project_type='max', norm=True, **kwargs)[source]
Generates a view of the image data based on the provided parameters. Only provide a single scene view for now.
- Parameters:
channel (int) – The channel index to select from the image. Defaults to 0.
depth (int | slice | ndarray | None) – Depth levels to process, which can be an integer, a slice, or a NumPy array. If None, all depth levels are used.
project_type (Literal['avg', 'max', 'min', 'std', 'median']) – Type of Z-projection to apply if multiple Z-slices are selected. Options include ‘avg’, ‘max’, ‘min’, ‘std’, ‘median’. Defaults to ‘max’.
norm (bool) – A flag indicating whether to normalize the projected image by its maximum intensity value. Defaults to True.
kwargs (Any)
- Returns:
A NumPy array representing the resulting image after applying depth projection, channel selection, and optional normalization.
- Return type:
ndarray