acia.segm.local#
Local segmentation functionality dealing with files from HDD.
- acia.segm.local.list_sequence_sources(folder, pattern='*.tif', storage_options=None, recursive=False, **kwargs)[source]#
Discover image stacks in a folder and return one source per file.
Works for a local directory or any fsspec URL (e.g. an
smb://share), using the same credential resolution as the sources themselves: credentials for the listing are looked up by host in the acia config (seeacia.config) and can be overridden viastorage_options.- Parameters:
folder (str) – directory to scan. A plain local path or an fsspec URL, e.g.
"/data/experiments"or"smb://fileserver.lab/data/exp".pattern (str) – glob pattern for the file names. Defaults to
"*.tif".storage_options (dict, optional) – extra fsspec options (e.g. credentials) merged on top of the config entry for the folder’s host.
recursive (bool) – if True, search sub-folders too (
**glob).**kwargs – forwarded to each
LocalSequenceSource(e.g.normalize_image,luts,channel_index).
- Returns:
list[LocalSequenceSource] – one source per matching file, sorted by path.
- Return type:
- acia.segm.local.prepare_image(image, normalize_image=True)[source]#
Normalize and convert image to RGB, or preserve it as raw data.
- Parameters:
image ([type]) – [description]
normalize_image (bool, optional) – Whether to normalize the image into uint8 domain (0-255) and (for a 2D frame) artificially triplicate it to 3 channels for display. Defaults to True. When False, the original dtype/intensity is preserved; a genuinely 2D frame only gains a trailing singleton channel axis (matching the raw-frame convention used by ND2SequenceSource/CZISequenceSource), no triplication.
- Returns:
[np.array] –
- RGB image (Width, height, 3 color channels) if normalize_image,
otherwise the original data with a channel axis.
- class acia.segm.local.LocalImage[source]#
Bases:
BaseImageClass for a single image
- property raw#
- property num_channels#
- class acia.segm.local.LocalImageSource[source]#
Bases:
ImageSequenceSource,JupyterVisualizationMixinSource for a single image only
- __init__(image)[source]#
- Parameters:
image (LocalImage)
- class acia.segm.local.InMemorySequenceSource[source]#
Bases:
ImageSequenceSource,JupyterVisualizationMixinImage sequence for an in memory image stack
- class acia.segm.local.THWCSequenceSource[source]#
Bases:
ImageSequenceSource,JupyterVisualizationMixinImage sequence for an in memory image stack [TxHxWxC]
- __init__(image_stack, frame_interval=None, timepoints=None, pixel_size=None)[source]#
- Parameters:
image_stack (ndarray)
- class acia.segm.local.LocalSequenceSource[source]#
Bases:
ImageSequenceSource,JupyterVisualizationMixinImage sequence source for files in the local file system (e.g. a tif).
- __init__(tif_file, normalize_image=True, luts=None, channel_index=0, storage_options=None, frame_interval=None, timepoints=None, pixel_size=None)[source]#
Create a new local image source
- Parameters:
tif_file (str) – path to the image file. May be a plain local path or any fsspec-supported URL (e.g.
smb://,s3://,http://).normalize_image (bool, optional) – Normalizes the image pixels t0 [0, 255]. Defaults to True.
luts – (List, optional): List of lut functions applied to the channels
channel_index (int, optional) – index in image of the channel. For example, for H,W,C dims where C is channel we should have a 2.
storage_options (dict, optional) – extra fsspec storage options (e.g. credentials) for remote URLs. Merged on top of any matching entry in the acia credentials config (see
acia.config).frame_interval – scalar time between frames (pint Quantity or str like
"15 minute"); overrides any value read from the file’s own OME-XML/ImageJ metadata.None(default) resolves it from the file lazily, on first access to a calibration property.timepoints – explicit per-frame timepoints (pint Quantity array); same override-vs-auto-detect behavior as
frame_interval.pixel_size – physical pixel size (pint length per pixel) for spatial calibration; same override-vs-auto-detect behavior.
- property pixel_size#
user override, else auto-read, else
None.- Type:
Pint length per pixel
- property timepoints#
user override, else auto-read, else
None.- Type:
Per-frame pint timepoints
- property calibration_source: str | None#
"ome","imagej", orNone(either nothing was auto-detected, or every field was user-supplied so no file read happened).- Type:
Where auto-detected calibration came from
- property size_t#
- class acia.segm.local.SambaSequenceSource[source]#
Bases:
LocalSequenceSourceImage sequence source for TIFFs on an SMB/SAMBA share (via fsspec).
This is a thin convenience wrapper around
LocalSequenceSource: it builds thesmb://URL and forwards credentials as fsspec storage options. All reading, iteration and visualization logic is inherited.Credentials are optional. If
username/password(etc.) are omitted, they are looked up in the acia credentials config by host (seeacia.config), so regular usage needs no secrets in code. Any value passed explicitly here overrides the config.- __init__(host, share, path, username=None, password=None, domain=None, port=None, **kwargs)[source]#
Create a new SAMBA/SMB image source.
- Parameters:
host (str) – SMB server host name or IP.
share (str) – name of the share.
path (str) – path to the image file within the share.
username (str, optional) – SMB username. Defaults to config lookup.
password (str, optional) – SMB password. Defaults to config lookup.
domain (str, optional) – SMB/Windows domain. Defaults to config lookup.
port (int, optional) – SMB port. Defaults to the backend default.
**kwargs – forwarded to
LocalSequenceSource(e.g.normalize_image,luts,channel_index).
- classmethod from_url(url, username=None, password=None, domain=None, port=None, **kwargs)[source]#
Create a SambaSequenceSource from a full
smb://URL.The URL is split into host / share / path, e.g.
smb://fileserver.lab/data/exp/img.tif-> hostfileserver.lab, sharedata, pathexp/img.tif. Credentials may be embedded in the URL (smb://user:pass@host/share/...) or passed as keyword arguments; anything omitted is resolved from the acia credentials config.- Parameters:
- Return type:
- class acia.segm.local.RoiStorer[source]#
Bases:
objectStores and loads overlay results in the roi format (readable by ImageJ)