def apply_lut(x, lut):
    '\n    Perform a morphological operation on the binary image x using the supplied lookup table\n    :param x:\n    :param lut:\n    :return:\n    '
    if (lut.ndim != 1):
        raise ValueError('lut should have 1 dimension, not {}'.format(lut.ndim))
    if (lut.shape[0] != 512):
        raise ValueError('lut should have 512 entries, not {}'.format(lut.shape[0]))
    lut_indices = binary_image_to_lut_indices(x)
    return lut[lut_indices]
Perform a morphological operation on the binary image x using the supplied lookup table
:param x:
:param lut:
:return:
def apply_lut(x, lut):
    '\n    Perform a morphological operation on the binary image x using the supplied lookup table\n    :param x:\n    :param lut:\n    :return:\n    '
    if (lut.ndim != 1):
        raise ValueError('lut should have 1 dimension, not {}'.format(lut.ndim))
    if (lut.shape[0] != 512):
        raise ValueError('lut should have 512 entries, not {}'.format(lut.shape[0]))
    lut_indices = binary_image_to_lut_indices(x)
    return lut[lut_indices]