glymur/jp2box.py
def _parse_standard_flag(read_buffer, mask_length):
    """Construct standard flag, standard mask data from the file.

    Specifically working on Reader Requirements box.

    Parameters
    ----------
    fptr : file object
        File object for JP2K file.
    mask_length : int
        Length of standard mask flag
    """
    # The mask length tells us the format string to use when unpacking
    # from the buffer read from file.
    mask_format = {1: 'B', 2: 'H', 4: 'I'}[mask_length]

    num_standard_flags, = struct.unpack_from('>H', read_buffer, offset=0)

    # Read in standard flags and standard masks.  Each standard flag should
    # be two bytes, but the standard mask flag is as long as specified by
    # the mask length.
    fmt = '>' + ('H' + mask_format) * num_standard_flags
    data = struct.unpack_from(fmt, read_buffer, offset=2)

    standard_flag = data[0:num_standard_flags * 2:2]
    standard_mask = data[1:num_standard_flags * 2:2]

    return standard_flag, standard_mask
Construct standard flag, standard mask data from the file.

    Specifically working on Reader Requirements box.

    Parameters
    ----------
    fptr : file object
        File object for JP2K file.
    mask_length : int
        Length of standard mask flag
    
Construct standard flag, standard mask data from the file.
Specifically working on Reader Requirements box.

Parameters

fptr : file object
File object for JP2K file.
mask_length : int
Length of standard mask flag
Construct standard flag standard mask data from the file . Specifically working on Reader Requirements box . Parameters fptr : file object File object for JP2K file . mask_length : int Length of standard mask flag
def _parse_standard_flag(read_buffer, mask_length):
    mask_format = {1: 'B', 2: 'H', 4: 'I'}[mask_length]
    num_standard_flags, = struct.unpack_from('>H', read_buffer, offset=0)
    fmt = '>' + ('H' + mask_format) * num_standard_flags
    data = struct.unpack_from(fmt, read_buffer, offset=2)
    standard_flag = data[0:num_standard_flags * 2:2]
    standard_mask = data[1:num_standard_flags * 2:2]
    return standard_flag, standard_mask
def _parse_standard_flag ( read_buffer , mask_length ) : mask_format = { 1 : 'B' , 2 : 'H' , 4 : 'I' } [ mask_length ] num_standard_flags , = struct . unpack_from ( '>H' , read_buffer , offset = 0 ) fmt = '>' + ( 'H' + mask_format ) * num_standard_flags data = struct . unpack_from ( fmt , read_buffer , offset = 2 ) standard_flag = data [ 0 : num_standard_flags * 2 : 2 ] standard_mask = data [ 1 : num_standard_flags * 2 : 2 ] return standard_flag , standard_mask
Construct standard flag, standard mask data from the file.
Construct standard flag standard mask data from the file .
"""Construct standard flag, standard mask data from the file.

    Specifically working on Reader Requirements box.

    Parameters
    ----------
    fptr : file object
        File object for JP2K file.
    mask_length : int
        Length of standard mask flag
    """ # The mask length tells us the format string to use when unpacking # from the buffer read from file. # Read in standard flags and standard masks.  Each standard flag should # be two bytes, but the standard mask flag is as long as specified by # the mask length.
read_buffer
mask_length