Run Length Encoding Module

The RLE module provides Run Length Encoding suitable for recording the file positions of a set of LIS Logical Records that represent frame data.

Created on 5 Jan 2011

class RLEItem()

A generic item in a Run Length Encoding list.

class RLE()

A generic Run Length Encoding list.

class RLEItemType01()

A specialised item in a Run Length Encoding list for type 0/1 LIS Logical Records.

class RLEType01()

A specialised Run Length Encoding list for type 0/1 LIS Logical Records.

API Reference

class TotalDepth.LIS.core.Rle.RLEItem(v)

Class that represents a single entry in a Run Length Encoding set. v - The datum value.

__str__()

String representation.

datum

The initial datum value.

stride

The stride as a number or None if there is only one entry.

repeat

The repeat count.

numValues()

Total number of record values.

add(v)

Returns True if v has been absorbed in this entry. False means a new entry is required.

values()

Generates all values.

value(i)

Returns a particular value.

range()

Returns a range object that has (start, stop, step) or None if a single entry.

first()

Returns the first value.

last()

Returns the last value.

__weakref__

list of weak references to the object (if defined)

class TotalDepth.LIS.core.Rle.RLE(theFunc=None)

Class that represents Run Length Encoding.

theFunc - optional unary function to convert all values with.

__init__(theFunc=None)

Constructor, optionally takes a unary function to convert all values with.

__str__()

String representation.

__len__()

The number of RLEItem(s).

__getitem__(key)

Returns a RLEItem.

numValues()

Total number of record values.

add(v)

Adds a value to this RLE object.

values()

Generates all values entered.

value(i)

Indexing; this returns the i’th value added.

rangeList()

Returns a list of range() or None objects. A None object means that the RLEItem has a single value.

first()

Returns the first value or None if no values added.

last()

Returns the last value or None if no values added.

__weakref__

list of weak references to the object (if defined)

class TotalDepth.LIS.core.Rle.RLEItemType01(tellLrPos, numFrameS, xAxisValue)

Specialisation of an RLEItem for type 0 and type 1 LIS Logical Records. This is a RLEItem for the Logical Record but within we have a RLE() object for the X axis values.

tellLrPos - the position in the LIS file of the start of the Logical Record.

numFrameS - integer number of frames in this Logical Record.

xAxisValue - The value of the X axis of the first frame in the Logical Record.

__str__()

String representation.

numFrames

Total number of frames.

add(tellLrPos, numFrameS, xAxisValue)

Returns True if v has been absorbed in this entry. False means a new entry is required. A new entry is required if the tellLrPos is not regular or numFrameS is different than before.

values()

Generates ordered tuples of (value, number of frames, xaxis value).

value(i)

Returns the i’th tuple of (i, (value, number of frames, xaxis value)).

totalFrames()

Returns the total number of frames in this RLE item.

tellLrForFrame(fNum)

Returns the Logical Record position that contains the integer frame number.

xAxisFirst()

Returns the first X-axis value loaded.

xAxisLast()

Returns the first X-axis value loaded.

class TotalDepth.LIS.core.Rle.RLEType01(theXUnits, *args)

Class that represents Run Length Encoding for type 0/1 logical records.

theXUnits - the X axis units.

__str__()

String representation.

xAxisUnits

X axis units.

hasXaxisData

True if there is X axis data.

add(tellLrPos, numFrameS, xAxisValue)

Adds a value to this RLE object.

tellLrForFrame(fNum)

Returns the (lr_seek, frame_offset) i.e. the Logical Record position that contains the integer frame number and the number of excess frames.

totalFrames()

Returns the total number of frames in this RLE object.

xAxisFirst()

Returns the first X-axis value loaded or None if nothing loaded.

xAxisLast()

Returns the last X-axis value at the satart of the last Logical Record loaded or None if nothing loaded.

xAxisLastFrame()

Returns the last X-axis value of the last frame loaded or None if nothing loaded.

frameSpacing()

Returns the frame spacing from the first/last entries, or None if nothing loaded. Returned value is -ve for decreasing X (up logs), +ve for increasing X (down and time logs).

Table Of Contents

Previous topic

Logical Record Handler

Next topic

Type01Plan

This Page