<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div style="font-family: -webkit-standard;"><font face="Calibri" style="font-size: 13px;">Hello,</font></div>
<div style="font-family: -webkit-standard;"><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div style="font-family: -webkit-standard;"><font face="Calibri" style="font-size: 13px;">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:</font></div>
<ol style="font-family: -webkit-standard;">
<li><font face="Calibri" style="font-size: 13px;">Is there script I can write within a programmable filter to create glyph boxes for the data points?</font></li><li><font face="Calibri" style="font-size: 13px;">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?</font></li></ol>
<div style="font-family: -webkit-standard;"><font face="Calibri" style="font-size: 13px;">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.</font></div>
<div style="font-family: -webkit-standard;"><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div style="font-family: -webkit-standard;"><font face="Calibri"><span style="font-size: 13px;">Any information</span></font><font face="Calibri" style="font-size: 13px;"> would be greatly appreciated.</font></div>
<div style="font-family: -webkit-standard;"><br>
</div>
<div style="font-family: -webkit-standard;"><font face="Calibri" style="font-size: 13px;">Many thanks,</font></div>
<div style="font-family: -webkit-standard;"><font face="Calibri" style="font-size: 13px;">Matt</font></div>
<div style="font-family: -webkit-standard;"><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div style="font-family: -webkit-standard;">
<div><font face="Calibri" style="font-size: 13px;"><b><i>#Programmable Source Script</i></b></font></div>
<div><font face="Calibri" style="font-size: 13px;">import vtk</font></div>
<div><font face="Calibri" style="font-size: 13px;">import numpy as np</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">coordinate = np.array([[0,0,0]])</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">node_file = open(‘…/pointWeights_test.txt', 'r')</font></div>
<div><font face="Calibri" style="font-size: 13px;">data = node_file.readlines()</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">timePoint = 0</font></div>
<div><font face="Calibri" style="font-size: 13px;">pointWeight = float(data[timePoint])</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">node_file.close()</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">output.Points = coordinate</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">output.Allocate(1)</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">output.PointData.append(pointWeight, "Point Weight")</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;"><b><i>#Programmable Source RequestInformation</i></b></font></div>
<div><font face="Calibri" style="font-size: 13px;">timeSteps = range(4)</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">outInfo = self.GetOutputInformation(0)</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">timeRange = [timeSteps[0], timeSteps[-1]]</font></div>
<div><font face="Calibri" style="font-size: 13px;">outInfo.Set(vtk.vtkStreamingDemandDrivenPipeline.TIME_RANGE(), timeRange, 2)</font></div>
<div><font face="Calibri" style="font-size: 13px;">outInfo.Set(vtk.vtkStreamingDemandDrivenPipeline.TIME_STEPS(), timeSteps, len(timeSteps))</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;"><b><i>#Programmable Filter Script</i></b></font></div>
<div><font face="Calibri" style="font-size: 13px;">import vtk</font></div>
<div><font face="Calibri" style="font-size: 13px;">import numpy as np</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">outInfo = self.GetOutputInformation(0)</font></div>
<div><font face="Calibri" style="font-size: 13px;">if outInfo.Has(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_TIME_STEP()):</font></div>
<div><font face="Calibri" style="font-size: 13px;">  time = outInfo.Get(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_TIME_STEP())</font></div>
<div><font face="Calibri" style="font-size: 13px;">else:</font></div>
<div><font face="Calibri" style="font-size: 13px;">  time = 0</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">coordinate = np.array([[0,0,0]])</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">node_file = open(‘…/pointWeights_test.txt', 'r')</font></div>
<div><font face="Calibri" style="font-size: 13px;">data = node_file.readlines()</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">pointWeight = float(data[time])</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">node_file.close()</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">output.Points = coordinate</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">output.Allocate(1)</font></div>
<div><font face="Calibri" style="font-size: 13px;"><br>
</font></div>
<div><font face="Calibri" style="font-size: 13px;">output.PointData.append(pointWeight, "Point Weight")</font></div>
</div>
</div>
</body>
</html>