How use a 2D array in VTK to produce a 2D texture

I want to convert an array into a 2D texture and pass it into shader’s uniform sampler2D variable.
Is there any good way?

Is there uniform sampler2D S with vtkTexture to achieve texture generation?