cigvis.utils.slice_provider module#

class cigvis.utils.slice_provider.SliceProvider(source, *, preproc: Callable | None = None, forcefp32: bool = False, display_range: Dict[str, Tuple[int, int]] | None = None, transpose_line_first: bool = True, transpose_rgb: bool = True)#

Bases: object

Axis-aware 2D slice reader for numpy-like 3D/4D data sources.

source can be a single volume or a dict such as {'x': iline_source, 'y': xline_source, 'z': time_source}. A source may also declare its physical axis order, for example {'data': time_source, 'axes': ('z', 'y', 'x')} for data stored as (nt, nx, ni). Sources must expose numpy-like shape metadata and support slicing. ndim is used when available and inferred from shape otherwise. display_range is pushed into the source index so lazy/chunked sources only read the visible part of a slice.

property clim_source#
get_shape2d(axis: str) Tuple[int, int]#
set_source(source, *, display_range: Dict[str, Tuple[int, int]] | None = None, validate: bool = True)#
set_volume(new_volume, *, validate: bool = True, **_kwargs)#
slice2d(axis: str, pos: int)#
source_for_axis(axis: str)#
cigvis.utils.slice_provider.clim_source(source_or_sources)#
cigvis.utils.slice_provider.is_axis_source_dict(value) bool#
cigvis.utils.slice_provider.is_source_spec(value) bool#

Return True for a single source spec such as {‘data’: arr, ‘axes’: …}.

cigvis.utils.slice_provider.normalize_axis_key(axis: str, *, allow_default: bool = False) str#
cigvis.utils.slice_provider.normalize_axis_sources(sources) Tuple[Dict[str, Any], Any]#
cigvis.utils.slice_provider.normalize_display_range(display_range, shape) Dict[str, Tuple[int, int]]#