LIFSnapshot file format.

This module implements support for reading LIFSnapshot files.

class lifsnapshot.AlphaLUTHardcoded(style: int, exponent: float)

Hardcoded Alpha LUT’s

static from_chunks(chunks: Dict[int, Chunk]) AlphaLUTHardcoded

Load a snapshot hardcoded Alpha LUT

get_float32_lut(wl: WindowLevel) ndarray

Get interpolated AlphaLUT values

class lifsnapshot.BulkChunk(chunk_type: int, bulk_data_offset: int, bulk_data_size: int)

LIF Bulk Chunk

class lifsnapshot.Camera(scene_transform: List[float], zoom_factor: float, transform: List[float] | None, field_of_view: float | None, focal_depth: float | None, near_depth: float | None, far_depth: float | None)
static from_chunks(chunks: Dict[int, Chunk]) Camera

Load a snapshot camera

class lifsnapshot.Chunk(chunk_type: int, data: bytes | None = None)

LIF Chunk

get_bool() bool

Get boolean data

get_color() Tuple[int, int, int, int]

Get uint32 color data as ARGB

get_float64() int

Get float64 data

get_float64_2d() Tuple[float, float]

Get float64 2D data

get_float64_3d() Tuple[float, float, float]

Get float64 3D data

get_int32() int

Get int32 data

get_int32_2d() Tuple[int, int]

Get int32 2D data

get_int32_3d() Tuple[int, int, int]

Get int32 3D data

get_int64() int

Get int64 data

get_str() str

Get string data

get_transform() List[float]

Get 3D transform data

get_uint32() int

Get uint32 data

get_uint8() int

Get uint8 data

class lifsnapshot.ClipPlane(pos: Tuple[float, float, float], normal: Tuple[float, float, float], is_active: bool, side: int, view_aligned_position: float)

Clipping plane

static from_chunks(chunks: Dict[int, Chunk]) ClipPlane

Load snapshot clip plane

class lifsnapshot.ClipPlaneCollection(mode: int, rotation: List[float], voi_center: Tuple[float, float, float], voi_size: Tuple[float, float, float], planes: list[ClipPlane])

Clipping planes

static from_chunks(chunks: Dict[int, Chunk]) ClipPlaneCollection

Load snapshot clip planes

class lifsnapshot.HierarchyChunk(chunk_type: int, items: List[ItemChunk])

LIF Hierarchy Chunk

exception lifsnapshot.InvalidLIFSnapshot
class lifsnapshot.ItemChunk(children: Dict[int, Chunk])

LIF Item Chunk

class lifsnapshot.LightEnv(model: int, direction: Tuple[float, float, float], ambient: Tuple[int, int, int, int], diffuse: Tuple[int, int, int, int], specular: Tuple, specularexp: float, surfacescalar: float, ssao: bool, ssaoradius: float, ssaoattenuation: float, directionlock: int | None, shadows: bool | None)

Light environment

static from_chunks(chunks: Dict[int, Chunk]) LightEnv

Load a snapshot light environment

class lifsnapshot.MeshGroup(name: str, color: Tuple[int, int, int, int], is_visible: bool)

Mesh group

static from_chunks(chunks: Dict[int, Chunk]) MeshGroup

Load a snapshot mesh group

class lifsnapshot.MeshSet(groups: Dict[str, MeshGroup])

Mesh set

static from_chunks(chunks: Dict[int, Chunk]) MeshSet

Load a snapshot mesh set

class lifsnapshot.Snapshot(chunks: Dict[int, Chunk])

LIF Snapshot

class lifsnapshot.SnapshotView(chunks: Dict[int, Chunk])

LIF Snapshot View (Component Model Node)

class lifsnapshot.WindowLevel(min: int, max: int, min_float: float | None, max_float: float | None, offset: int, substitute: bool)

Window / Level

static from_chunks(chunks: Dict[int, Chunk]) WindowLevel

Load a snapshot window / level

lifsnapshot.debug_print_lifsnapshot(snapshot: Snapshot)

Print snapshot chunks for debugging.

lifsnapshot.is_bulk_chunk_type(chunk_type: int) bool

Is the given chunk type a bulk chunk?

lifsnapshot.is_chunk_type_mode(chunk_type: int, mode: int) bool

Is the given chunk type of the given mode?

lifsnapshot.is_generic_chunk_type(chunk_type: int) bool

Is the given chunk type generic?

lifsnapshot.is_hierarchic_chunk_type(chunk_type: int) bool

Is the given chunk type hierarchic?

lifsnapshot.is_standard_chunk_type(chunk_type: int) bool

Is the given chunk type a standard chunk?

lifsnapshot.load_lifsnapshot(filename: Path) Snapshot

Load a LIF Snapshot

lifsnapshot.read_chunk_header(f: BinaryIO) Tuple[int, int]

Read a LIF chunk type and size

lifsnapshot.read_chunks(f: BinaryIO) Dict[int, Chunk]

Read LIF chunks

lifsnapshot.read_compact(f: BinaryIO) int

Read a LIF compact value integer

lifsnapshot.read_header(f: BinaryIO)

Read and check the LIF Snapshot header

lifsnapshot.read_unpack(f: BinaryIO, size: int, format: str) Tuple[Any, ...]

Read and unpack data