[vtkusers] filter to pass one (cell or point) array
Rodrigo Valiña Gutiérrez
rodrigo.valina at usc.es
Fri Apr 30 03:55:55 EDT 2010
Thank you very much !
Solution "2" worked, at least in the test program I wrote.
In this case I was not using vtkXYPlotActor, but some regular 3D
Actors. Maybe I sould have said "render" instead of "plot".
I think I have to deactivate all attributes before feeding
vtkAssignAttribute, because this way there are no conflicts like when
I select a cell scalar array and then I pass it to one filter that
looks before in point arrays and finds one active array there.
d = src.GetOutput().GetPointData()
d.SetActiveScalars(None)
d = src.GetOutput().GetCellData()
d.SetActiveScalars(None)
--
Rodrigo
On Thu, Apr 29, 2010 at 9:13 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:
> Hey Rodrigo,
>
> Yes, there must be a way to do it without having to have multiple readers for the same data. I can see two possible quick options, and I'm sure there are more (that people who have really used vtkXYPlotActor before can suggest):
>
> 1. Instead of using AddInput(vtkDataSet), try using the other version: AddInput(vtkDataSet, string, int) -- this should allow you to pass in an attribute name to plot values which aren't the "active" scalar.
>
> 2. You can use the vtkAssignAttribute filter to make the array you want the active attribute. With this you can have the single reader output feeding in to many assign attribute filters, one for each plot, and then feed these outputs into your plot actors.
>
> I know this probably won't work for you right now since it sounds (from your other posts) like you're doing selections right on the plots, but the newer Charts classes (e.g. vtkChartXY) take in a table of values to plot, and you just tell it which columns of the table to use for each plot. It's easy then to use a vtkDataObjectToTable filter to get a single table of all the attribute values for your data set, and then tell multiple plots to use different columns of the table.
>
> Good luck,
> -Eric
>
>
> On Apr 29, 2010, at 1:10 PM, Rodrigo Valiña Gutiérrez wrote:
>
>> Hi,
>>
>> I have several sources, some ones read with vtkUnstructuredGridReader,
>> and others read with vtkXMLUnstructuredGridReader.
>>
>> I wanted to use the same source object to feed other filters and
>> finally plot some data: say the file has as point data "pressure" and
>> "temperature" and some other arrays as cell data.
>>
>> I want to plot several times, some ones with the "pressure" array,
>> some others with another array, at the same time.
>>
>> Now I am creating a vtkUnstructuredGridReader object for each field I
>> want to plot, even of the same file, and I am setting the active
>> scalars or vectors for that object corresponding to what I want to
>> plot.
>>
>> If I create only one vtkUnstructuredGridReader, is there any filter
>> that only passes the field I want (say "temperature")?
>>
>> Then I would have several (light) filters like that, and only one
>> vtkUnstructuredGridReader that would hold most data (and no need to
>> read the file several times)
>>
>> I can not create one vtkUnstructuredGridReader and change active
>> scalars each time I want to plot, since I must have several plots open
>> (in tabs).
>>
>> I want the filter to have GetOutput() and GetOutputPort()
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK 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