TotalDepth.LIS.core.Rle (Run Length Encoding)

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.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.

__init__(tellLrPos, numFrameS, xAxisValue)

Initialize self. See help(type(self)) for accurate signature.

__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.

__init__(theXUnits, *args)

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

__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).