[vtkusers] coloring an isosurface with a second variable

John Clyne clyne at ucar.edu
Fri Oct 29 15:49:46 EDT 2004


Hmm. Doing a print on the vtkPolyData coming out of the isosurfacer shows
"Field Data", "Cell Data", and "Point Data" elements. Only the last, "Point
Data", appears to contain non-empty arrays. So there does seem to be a
distinction between point and field data. Perhaps someone else out there can
explain.

I did call SetScalarModeToUsePointFieldData but that didn't seem to have any
effect.

thanks again

----- Original Message ----- 
From: "Charles Boivin" <Charles.Boivin at rwdiwest.com>
To: <clyne at ucar.edu>; <vtkusers at vtk.org>
Sent: Friday, October 29, 2004 12:34 PM
Subject: Re: [vtkusers] coloring an isosurface with a second variable


> Hi John,
>
> Well, this perhaps will show my ignorance of VTK as I am a relative
> newbie, but as far as I know, point data *is* field data. If you look at
> the vtkPointData documentation, you will see that that class is derived
> from vtkFieldData.
>
> By the way, a call to vtkPolyData::GetPointData() (like you have in
> your example code below) returns a pointer to a vtkPointData object, so
> I think using vtkPolyDataMapper::SelectColorArray() should still work.
> Make sure that you have called
> vtkPolyDataMapper::SetScalarModeToUsePointFieldData() first.
>
> So, as far as I understand it, this should work (it does for me,
> although I am not using the vtkXMLStructuredGridReader). Hope this
> helps!
>
> Charles
>
> >>> "John Clyne" <clyne at ucar.edu> 10/29/04 12:23pm >>>
> Charles, this shows my ignorance of vtk, but it looks like
> SelectColorArray
> can be used when you have "Field" data. the vtkXMLStructureGridReader
> loads
> the scalar data as "Point" data. I don't really understand the
> difference
> between Point and Field data, nor how you might convert one to the
> other.
> Any insight here?
>
> Thanks for your quick response, Charlse.
>
> cheers - jc
>
>
> ----- Original Message ----- 
> From: "Charles Boivin" <Charles.Boivin at rwdiwest.com>
> To: <clyne at ucar.edu>; <vtkusers at vtk.org>
> Sent: Friday, October 29, 2004 11:31 AM
> Subject: Re: [vtkusers] coloring an isosurface with a second variable
>
>
> > Hi John,
> >
> > I have been using vtkPolyDataMapper::SelectColorArray() to color an
> > isosurface with another variable. Seems to work pretty well for me.
> >
> > Charles
> >
> > >>> "John Clyne" <clyne at ucar.edu> 10/29/04 11:16am >>>
> > I'm trying to do what I would think would be a trivial operation but
> I
> > can't for for the life of me figure out how to do in vtk. I have an
> XML
> > data
> > file (.vts) that contains two scalar variables (temperature and
> > humidity).
> > I'd like to generate an isosurface of one and color it with the
> other.
> > Selecting the field to isosurface is easy enough:
> >
> > vtkXMLStructuredGridReader reader
> >     reader SetFileName $Datafile
> >     reader Update
> >     [[reader GetOutput] GetPointData] SetActiveScalars "humidity"
> >
> > This selects the appropriate field for the isosurfacer, and if I do
> a
> >
> > puts "[[mapper GetInput] Print"
> >
> >
> > I see both the temperature and humidity arrays named as "Point
> Data",
> > but
> > now I have no idea how to tell the mapper to map the temperature
> field
> > through the lookup table to assign color to the resulting geometry
> > coming
> > out of the vtkContour.
> >
> > Any pointers would be greatly appreciated.
> >
> > thanks!
> >
> >
> > John Clyne (clyne at ncar.ucar.edu)
> > National Center for Atmospheric Research
> > 1850 Table Mesa Dr. Boulder, CO 80303 USA
> > 1.303.497.1236
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> > <http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list