How to use the pylinac.core.utilities.decode_binary function in pylinac

To help you get started, we’ve selected a few pylinac examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, file):
        f = file
        self.header = decode_binary(f, str, 16)  # for version 1.5 will be "VOSTL"
        self.version = float(decode_binary(f, str, 16))  # in the format of 2.x or 3.x
        self.header_size = decode_binary(f, int)  # fixed at 1024 in 1.5 specs
        self.sampling_interval = decode_binary(f, int)
        self.num_axes = decode_binary(f, int)
        self.axis_enum = decode_binary(f, int, self.num_axes)
        self.samples_per_axis = decode_binary(f, int, self.num_axes)
        self.num_mlc_leaves = self.samples_per_axis[-1] - 2  # subtract 2 (each carriage counts as an "axis" and must be removed)
        self.axis_scale = decode_binary(f, int)
        self.num_subbeams = decode_binary(f, int)
        self.is_truncated = decode_binary(f, int)
        self.num_snapshots = decode_binary(f, int)
        # the section after MLC model is reserved. Cursor is moved to the end of this reserved section.
        self.mlc_model = decode_binary(f, int, cursor_shift=1024 - (64 + self.num_axes * 8))
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, file, log_version):
        f = file
        self.control_point = decode_binary(f, int)
        self.mu_delivered = decode_binary(f, float)
        self.rad_time = decode_binary(f, float)
        self.sequence_num = decode_binary(f, int)
        # In Tlogs version 3.0 and up, beam names are 512 byte unicode strings, but in <3.0 they are 32 byte unicode strings
        if log_version >= 3:
            chars = 512
        else:
            chars = 32
        self.beam_name = decode_binary(f, str, chars, 32)
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, file):
        f = file
        self.header = decode_binary(f, str, 16)  # for version 1.5 will be "VOSTL"
        self.version = float(decode_binary(f, str, 16))  # in the format of 2.x or 3.x
        self.header_size = decode_binary(f, int)  # fixed at 1024 in 1.5 specs
        self.sampling_interval = decode_binary(f, int)
        self.num_axes = decode_binary(f, int)
        self.axis_enum = decode_binary(f, int, self.num_axes)
        self.samples_per_axis = decode_binary(f, int, self.num_axes)
        self.num_mlc_leaves = self.samples_per_axis[-1] - 2  # subtract 2 (each carriage counts as an "axis" and must be removed)
        self.axis_scale = decode_binary(f, int)
        self.num_subbeams = decode_binary(f, int)
        self.is_truncated = decode_binary(f, int)
        self.num_snapshots = decode_binary(f, int)
        # the section after MLC model is reserved. Cursor is moved to the end of this reserved section.
        self.mlc_model = decode_binary(f, int, cursor_shift=1024 - (64 + self.num_axes * 8))
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, file, log_version):
        f = file
        self.control_point = decode_binary(f, int)
        self.mu_delivered = decode_binary(f, float)
        self.rad_time = decode_binary(f, float)
        self.sequence_num = decode_binary(f, int)
        # In Tlogs version 3.0 and up, beam names are 512 byte unicode strings, but in <3.0 they are 32 byte unicode strings
        if log_version >= 3:
            chars = 512
        else:
            chars = 32
        self.beam_name = decode_binary(f, str, chars, 32)
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, file):
        f = file
        self.header = decode_binary(f, str, 16)  # for version 1.5 will be "VOSTL"
        self.version = float(decode_binary(f, str, 16))  # in the format of 2.x or 3.x
        self.header_size = decode_binary(f, int)  # fixed at 1024 in 1.5 specs
        self.sampling_interval = decode_binary(f, int)
        self.num_axes = decode_binary(f, int)
        self.axis_enum = decode_binary(f, int, self.num_axes)
        self.samples_per_axis = decode_binary(f, int, self.num_axes)
        self.num_mlc_leaves = self.samples_per_axis[-1] - 2  # subtract 2 (each carriage counts as an "axis" and must be removed)
        self.axis_scale = decode_binary(f, int)
        self.num_subbeams = decode_binary(f, int)
        self.is_truncated = decode_binary(f, int)
        self.num_snapshots = decode_binary(f, int)
        # the section after MLC model is reserved. Cursor is moved to the end of this reserved section.
        self.mlc_model = decode_binary(f, int, cursor_shift=1024 - (64 + self.num_axes * 8))
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, log, file, subbeams):
        # step size in bytes
        step_size = sum(log.header.samples_per_axis) * 2

        # read in all snapshot data at once, then assign
        snapshot_data = decode_binary(file, float, step_size * log.header.num_snapshots)

        # reshape snapshot data to be a x-by-num_snapshots matrix
        snapshot_data = snapshot_data.reshape(log.header.num_snapshots, -1)

        clm_iter = itertools.count(step=2)

        self.collimator = _get_axis(snapshot_data, next(clm_iter), HeadAxis)
        self.gantry = _get_axis(snapshot_data, next(clm_iter), GantryAxis)
        jaw_y1 = _get_axis(snapshot_data, next(clm_iter), HeadAxis)
        jaw_y2 = _get_axis(snapshot_data, next(clm_iter), HeadAxis)
        jaw_x1 = _get_axis(snapshot_data, next(clm_iter), HeadAxis)
        jaw_x2 = _get_axis(snapshot_data, next(clm_iter), HeadAxis)
        self.jaws = JawStruct(jaw_x1, jaw_y1, jaw_x2, jaw_y2)

        vrt = _get_axis(snapshot_data, next(clm_iter), CouchAxis)
        lng = _get_axis(snapshot_data, next(clm_iter), CouchAxis)
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, file):
        f = file
        self.header = decode_binary(f, str, 16)  # for version 1.5 will be "VOSTL"
        self.version = float(decode_binary(f, str, 16))  # in the format of 2.x or 3.x
        self.header_size = decode_binary(f, int)  # fixed at 1024 in 1.5 specs
        self.sampling_interval = decode_binary(f, int)
        self.num_axes = decode_binary(f, int)
        self.axis_enum = decode_binary(f, int, self.num_axes)
        self.samples_per_axis = decode_binary(f, int, self.num_axes)
        self.num_mlc_leaves = self.samples_per_axis[-1] - 2  # subtract 2 (each carriage counts as an "axis" and must be removed)
        self.axis_scale = decode_binary(f, int)
        self.num_subbeams = decode_binary(f, int)
        self.is_truncated = decode_binary(f, int)
        self.num_snapshots = decode_binary(f, int)
        # the section after MLC model is reserved. Cursor is moved to the end of this reserved section.
        self.mlc_model = decode_binary(f, int, cursor_shift=1024 - (64 + self.num_axes * 8))
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, file):
        f = file
        self.header = decode_binary(f, str, 16)  # for version 1.5 will be "VOSTL"
        self.version = float(decode_binary(f, str, 16))  # in the format of 2.x or 3.x
        self.header_size = decode_binary(f, int)  # fixed at 1024 in 1.5 specs
        self.sampling_interval = decode_binary(f, int)
        self.num_axes = decode_binary(f, int)
        self.axis_enum = decode_binary(f, int, self.num_axes)
        self.samples_per_axis = decode_binary(f, int, self.num_axes)
        self.num_mlc_leaves = self.samples_per_axis[-1] - 2  # subtract 2 (each carriage counts as an "axis" and must be removed)
        self.axis_scale = decode_binary(f, int)
        self.num_subbeams = decode_binary(f, int)
        self.is_truncated = decode_binary(f, int)
        self.num_snapshots = decode_binary(f, int)
        # the section after MLC model is reserved. Cursor is moved to the end of this reserved section.
        self.mlc_model = decode_binary(f, int, cursor_shift=1024 - (64 + self.num_axes * 8))
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, file, log_version):
        f = file
        self.control_point = decode_binary(f, int)
        self.mu_delivered = decode_binary(f, float)
        self.rad_time = decode_binary(f, float)
        self.sequence_num = decode_binary(f, int)
        # In Tlogs version 3.0 and up, beam names are 512 byte unicode strings, but in <3.0 they are 32 byte unicode strings
        if log_version >= 3:
            chars = 512
        else:
            chars = 32
        self.beam_name = decode_binary(f, str, chars, 32)
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def __init__(self, file):
        f = file
        self.header = decode_binary(f, str, 16)  # for version 1.5 will be "VOSTL"
        self.version = float(decode_binary(f, str, 16))  # in the format of 2.x or 3.x
        self.header_size = decode_binary(f, int)  # fixed at 1024 in 1.5 specs
        self.sampling_interval = decode_binary(f, int)
        self.num_axes = decode_binary(f, int)
        self.axis_enum = decode_binary(f, int, self.num_axes)
        self.samples_per_axis = decode_binary(f, int, self.num_axes)
        self.num_mlc_leaves = self.samples_per_axis[-1] - 2  # subtract 2 (each carriage counts as an "axis" and must be removed)
        self.axis_scale = decode_binary(f, int)
        self.num_subbeams = decode_binary(f, int)
        self.is_truncated = decode_binary(f, int)
        self.num_snapshots = decode_binary(f, int)
        # the section after MLC model is reserved. Cursor is moved to the end of this reserved section.
        self.mlc_model = decode_binary(f, int, cursor_shift=1024 - (64 + self.num_axes * 8))