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, lifsnapshot.Chunk]) lifsnapshot.AlphaLUTHardcoded

Load a snapshot hardcoded Alpha LUT

get_float32_lut(wl: lifsnapshot.WindowLevel) numpy.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: Optional[List[float]], field_of_view: Optional[float], focal_depth: Optional[float], near_depth: Optional[float], far_depth: Optional[float])
static from_chunks(chunks: Dict[int, lifsnapshot.Chunk]) lifsnapshot.Camera

Load a snapshot camera

class lifsnapshot.Chunk(chunk_type: int, data: Optional[bytes] = None)

LIF Chunk

get_bool() bool

Get boolean data

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.HierarchyChunk(chunk_type: int, items: List[lifsnapshot.ItemChunk])

LIF Hierarchy Chunk

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

LIF Item Chunk

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

Mesh group

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

Load a snapshot mesh group

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

Mesh set

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

Load a snapshot mesh set

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

LIF Snapshot

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

LIF Snapshot View (Component Model Node)

class lifsnapshot.WindowLevel(min: int, max: int, min_float: Optional[float], max_float: Optional[float], offset: int, substitute: bool)

Window / Level

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

Load a snapshot window / level

lifsnapshot.debug_print_lifsnapshot(snapshot: lifsnapshot.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: pathlib.Path) lifsnapshot.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, lifsnapshot.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