[vtkusers] Using vtkXMLStructuredGridReader to read only part of a data file
Ben Medina
ben.medina at gmail.com
Wed Mar 17 13:32:09 EDT 2010
I have this working well, but I'm missing one piece of the puzzle. How
do you query the reader for the range (i.e. min/max) of a particular
data array?
What I'm trying to do is:
1) tell the reader to load a particular array
2) tell the mapper downstream to use that array for color mapping
3) set the mapper's scalar range to the entire range of the variable
I have 1 and 2 working fine. 3 I am accomplishing by observing the
reader, grabbing its data object output when it sends an EndEvent,
getting the range from the data object, then setting the range on the
mapper.
But I'd rather query the reader directly for this information, since
it seems to be available in the data file headers. Does anyone know?
Thanks,
Ben
On Mon, Mar 15, 2010 at 4:18 PM, Ben Medina <ben.medina at gmail.com> wrote:
> Yes, that works perfectly. Thanks Jean!
>
> Now to get the mapper downstream to use the newly-loaded array for
> color mapping....
>
> - Ben
>
> On Fri, Mar 12, 2010 at 9:10 AM, David E DeMarle
> <dave.demarle at kitware.com> wrote:
>> I stand corrected. Thanks Jean!
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 28 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-371-3971 x109
>>
>>
>> On Fri, Mar 12, 2010 at 11:03 AM, Favre Jean <jfavre at cscs.ch> wrote:
>>>
>>> I believe It is possible to select which array to load or skip over, before executing Update().
>>>
>>> You must execute UpdateInformation() first, and then set or unset the arrays of your choice. Here is the example python code
>>>
>>> reader = vtkXMLUnstructuredGridReader()
>>> reader.SetFileName("/local/data/slice.vtu")
>>> reader.UpdateInformation()
>>>
>>> print reader.GetPointDataArraySelection()
>>>
>>> reader.SetPointArrayStatus('Temperature', 0)
>>> reader.GetPointArrayStatus('Temperature')
>>>
>>> reader.Update()
>>>
>>> -----------------
>>> Jean M. Favre
>>> Swiss National Supercomputing Center
>>>
>>
>
More information about the vtkusers
mailing list