[Paraview-developers] Paraview for Data Display Over Time
Czech, Matthew
Matthew.Czech at pfizer.com
Fri Apr 22 13:44:02 EDT 2016
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:
1. Is there script I can write within a programmable filter to create glyph boxes for the data points?
2. 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")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20160422/af5482a6/attachment.html>
More information about the Paraview-developers
mailing list