neuralib.scan.czi.CziScanner
- final class neuralib.scan.czi.CziScanner[source]
Bases:
AbstractScannerCZI confocal image data
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.
get_code(scene_idx, code)Retrieves a specific shape value associated with a given scene index and access code from the internal czi_file data structure.
get_tile_info([scene_idx])Extracts tile region information from metadata, if available.
view([scene, channel, depth, project_type, norm])Generates a view of the image data based on the provided parameters such as scene, channel, depth, projection type, and normalization.
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
Checks if the CZI file have consistent scanning configs across scenes
get
aicspylibczi.CziFileobjectGet dimension code for the image array
filepathThe absolute path to the loaded confocal file.
Checks if the CZI file is marked as mosaic by the reader.
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 czi_file: CziFile
get
aicspylibczi.CziFileobject
- property consistent_config: bool
Checks if the CZI file have consistent scanning configs across scenes
- property is_mosaic: bool
Checks if the CZI file is marked as mosaic by the reader.
- property n_scenes: int
Total number of scenes (positions/series) in the file.
- property dimcode: str
Get dimension code for the image array
- get_code(scene_idx, code)[source]
Retrieves a specific shape value associated with a given scene index and access code from the internal czi_file data structure.
- Parameters:
scene_idx (int) – The index representing a specific scene in the czi_file’s dimensions.
code (Literal['S', 'C', 'Z', 'X', 'Y', 'M']) – A string key for accessing a particular value related to the given scene index.
- Returns:
Returns the shape value corresponding to the scene index and
code- Return type:
int
- get_tile_info(scene_idx=0)[source]
Extracts tile region information from metadata, if available. Returns None if not a tiled acquisition or info is missing
- Parameters:
scene_idx (int)
- Return type:
dict[str, Any] | None
- get_channel_names(scene_idx)[source]
Get the names of the fluorescence channels for a specific scene. (Implementation copied from czi_scanner_impl_v1 for completeness)
- Parameters:
scene_idx (int)
- Return type:
list[str]
- view(scene=None, channel=0, depth=None, project_type='max', norm=True, **kwargs)[source]
Generates a view of the image data based on the provided parameters such as scene, channel, depth, projection type, and normalization. The function retrieves image data from either a mosaic file or a standard image file, processes it according to the specified depth, performs projection if required, and applies normalization if requested.
- Parameters:
scene (int | None) – Scene index to be used for image loading. If None and the file is non-mosaic, defaults to 0. Used only for non-mosaic CZI files.
channel (int) – Index of the channel to be visualized. Defaults to 0.
depth (int | slice | ndarray | None) – Z-plane depth index, slice, or array. If None, all Z-slices are loaded. Can also be a specific integer index or an array of indices/slice.
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) – Whether to normalize the image intensity values. If True, divides the data by its maximum intensity value. Defaults to True.
kwargs (Any)
- Returns:
A NumPy array containing the processed image data, which may be normalized and/or projected based on the input parameters.
- Return type:
ndarray