[Paraview-developers] Paraview for Data Display Over Time

Cory Quammen cory.quammen at kitware.com
Wed Apr 27 11:06:27 EDT 2016


Hi Matthew,

It looks like you solved your problem over on StackOverflow.

http://stackoverflow.com/questions/36843331/paraview-for-data-display-over-time

Is everything working for you now?

- Cory

On Fri, Apr 22, 2016 at 1:44 PM, Czech, Matthew
<Matthew.Czech at pfizer.com> wrote:
> Hello,
>
> I work at Pfizer and we are trying to use Paraview to display data related
> to network connectivity in the brain. We are trying to display points as
> colored boxes that change scalar value over time. I have tried to write a
> programmable filter that adds box glyphs to data points and will change the
> scalar value of the data point based on the time point. Specifically I am
> trying to return a value for the current time point and use that value to
> grab certain scalar weights within a text file. I can’t quite get it to work
> though and I have two big questions:
>
> Is there script I can write within a programmable filter to create glyph
> boxes for the data points?
> Is script I wrote below on the right track to have the filter return a value
> for the current time point and then use this value to parse through a text
> file and choose the scalar value corresponding to that time point?
>
> Below I included a simplified example of what I have at the moment for just
> one point with 4 scalar values (txt file attached). I am getting an error
> with the filter that does not occur with just the source saying list indices
> must be integers not float.
>
> Any information would be greatly appreciated.
>
> Many thanks,
> Matt
>
> #Programmable Source Script
> import vtk
> import numpy as np
>
> coordinate = np.array([[0,0,0]])
>
> node_file = open(‘…/pointWeights_test.txt', 'r')
> data = node_file.readlines()
>
> timePoint = 0
> pointWeight = float(data[timePoint])
>
> node_file.close()
>
> output.Points = coordinate
>
> output.Allocate(1)
>
> output.PointData.append(pointWeight, "Point Weight")
>
>
> #Programmable Source RequestInformation
> timeSteps = range(4)
>
> outInfo = self.GetOutputInformation(0)
>
> timeRange = [timeSteps[0], timeSteps[-1]]
> outInfo.Set(vtk.vtkStreamingDemandDrivenPipeline.TIME_RANGE(), timeRange, 2)
> outInfo.Set(vtk.vtkStreamingDemandDrivenPipeline.TIME_STEPS(), timeSteps,
> len(timeSteps))
>
>
> #Programmable Filter Script
> import vtk
> import numpy as np
>
> outInfo = self.GetOutputInformation(0)
> if outInfo.Has(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_TIME_STEP()):
>   time =
> outInfo.Get(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_TIME_STEP())
> else:
>   time = 0
>
> coordinate = np.array([[0,0,0]])
>
> node_file = open(‘…/pointWeights_test.txt', 'r')
> data = node_file.readlines()
>
> pointWeight = float(data[time])
>
> node_file.close()
>
> output.Points = coordinate
>
> output.Allocate(1)
>
> output.PointData.append(pointWeight, "Point Weight")
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at:
> http://markmail.org/search/?q=Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview-developers
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.


More information about the Paraview-developers mailing list