def _apply_affine_scalar(i, j, k, affine_matrix):
    """
    Applies an affine matrix to the given coordinates. The 3 values i, j and k must be scalars. The affine matrix consists of a 3x3 rotation matrix and a 3x1 transposition matrix (plus the last row).

    Parameters
    ----------
    i, j, k: numeric scalars
        The source coordinates.

    affine_matrix: numpy 2D float array with shape (4, 4)
        The affine matrix

    Returns
    -------
    The coordinate vector after applying the matrix.
    """
    rotation = affine_matrix[:3, :3]
    translation = affine_matrix[:3, 3]
    return rotation.dot([i, j, k]) + translation