[vtkusers] Plotting raster data with colormap

Shashwath T.R. trshash at gmail.com
Wed Feb 4 23:38:02 EST 2009


Hi Nicholas,

On Wed, Feb 4, 2009 at 11:55 PM, Nicholas Kinar <n.kinar at usask.ca> wrote:

> I am wondering if it would be possible to plot raster data using VTK in a
> similar fashion to the Matlab imagesc(X) function.  Essentially what I have
> is a (m x n) matrix of doubles, and I would like to display this matrix as a
> 2D plot with a colormap.  The colormap intensity would correspond to the
> scaled double values.  Would it be possible to set this up in the form of an
> animation, i.e. code that continues to update and display the plot on the
> screen?


You'll want to use vtkImageViewer or vtkImageViewer2. Create an image of
size MxNx1, fill it with your input data, and set it as input to your image
viewer.


> Does anyone have some sample code in C/C++?  Which functions would I use in
> VTK to create such a plot?
>

Take a look at the image viewer and image data examples in the VTK source
code... They may not exactly contain what you want, but it should point you
in the right direction.

HTH

Shash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090205/faa58cf1/attachment.htm>


More information about the vtkusers mailing list