def makeLUTfromCTF(sclist, N=None):
    """
    Use a Color Transfer Function to generate colors in a vtk lookup table.
    See `here <http://www.vtk.org/doc/nightly/html/classvtkColorTransferFunction.html>`_.

    :param list sclist: a list in the form ``[(scalar1, [r,g,b]), (scalar2, 'blue'), ...]``.
    :return: the lookup table object ``vtkLookupTable``. This can be fed into ``colorMap``.
    """
    ctf = vtk.vtkColorTransferFunction()
    ctf.SetColorSpaceToDiverging()

    for sc in sclist:
        scalar, col = sc
        r, g, b = getColor(col)
        ctf.AddRGBPoint(scalar, r, g, b)

    if N is None:
        N = len(sclist)

    lut = vtk.vtkLookupTable()
    lut.SetNumberOfTableValues(N)
    lut.Build()

    for i in range(N):
        rgb = list(ctf.GetColor(float(i) / N)) + [1]
        lut.SetTableValue(i, rgb)

    return lut