[vtkusers] Problems with visualizing multiple scalars on vtkDataSetMapper

Sarah Macumber S.Macumber at QuestReliability.com
Fri Jul 11 13:51:14 EDT 2008


Hey Gerrick thanks for the quick reply, can you please say more.  How do you connect your field data to begin with?  Also I am using a vtkDataSetMapper because I have 3D data and I think it may have issues with visualizing more than the 0th scalar.  When I try your code I get it to render correctly on the first pass but if I try to switch scalars I get a solid color rendering so it is not switching to the other field.
 
If you can send some code which shows how you connect your "field data" to your polydata / grid that would be very useful.  
 
Thanks Sarah

________________________________

From: Gerrick Bivins [mailto:gbivins at objectreservoir.com]
Sent: Fri 7/11/2008 12:08 PM
To: Sarah Macumber; VTK-users
Subject: Re: [vtkusers] Problems with visualizing multiple scalars on vtkDataSetMapper



Hi Sarah,
How are you setting up your mapper?

I use a lookup table and setup my mapper something like this:
...
 lut = new vtkLookupTable();
 lut.SetNumberOfTableValues(256);
 lut.SetHueRange( 2.0f / 3.0f, 0.0f );
       
 mapper = new vtkPolyDataMapper();
 mapper.SetLookupTable( lut );
 mapper.SetScalarModeToUsePointFieldData();
...

Then anytime I change the current scalar, I update the mapper:

void updateCurrentScalarForMapper( String currentScalar,
                                   double [] currentScalarRange )
{
   mapper.SelectColorArray( currentScalar );
   mapper.SetScalarRange( currentScalarRange );
}



Gerrick


On 7/11/08 11:46 AM, "Sarah Macumber" <S.Macumber at QuestReliability.com>
wrote:

> Hi,
> 
> I have 2D / 3D data so I am using an vtkUnstructuredGrid & a vtkDataSetMapper
> to visualize my data.  My data has several associated scalar values which I
> want to be able to switch between for coloring purposes.  Calling SetScalars
> with the new scalar value does not update the visualization pipeline as
> described in this thread :
> Grid.GetCellData().SetScalars(currentScalars);
>
> http://www.vtk.org/pipermail/vtk-developers/2007-September/004700.html
> <http://www.vtk.org/pipermail/vtk-developers/2007-September/004700.html>
>
> but I still don't fully understand what to do about it.
>
> What is the best way to switch your viewable scalar value on a
> vtkUnstructuredGrid?
>
> Thanks, Sarah
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list