@staticmethod
def validateShape(image, texnvals, texndims):
    """Called by :meth:`__init__`. Makes sure that the specified texture
        settings (number of dimensions, and number of values per texture
        element) are compatible with the image.

        :arg image:    :class:`.Image`
        :arg texnvals: Number of values per texture element
        :arg texndims: Number of texture dimensions
        :raises:       :exc:`RuntimeError` if the texture properties are not
                       compatible with the image
        """
    imgnvals = image.nvals
    imgndims = len(image.shape)
    if texnvals == 1:
        return
    if imgnvals == 1:
        expShape = list(image.shape[:3])
        expShape += [1] * (imgndims - 3)
        expShape[-1] = texnvals
        if list(image.shape) != expShape:
            raise RuntimeError(
                'Data shape mismatch: texture size {} requested for image shape {}'
                .format(texnvals, image.shape))
    elif imgnvals != texnvals:
        raise RuntimeError(
            'Data shape mismatch: texture size {} requested for image with nvals {}'
            .format(texnvals, imgnvals))
