Hello,<div>I am trying to visualize a contour surface from a set of measured values in 3d space.  The measured 3d points are irregular because of the experiment design.  I&#39;m trying to accomplish the visualization by using the vtkUnstructuredGrid and vtkContourFilter objects.  My code is below.  I have verified the pipeline and visualization setup by testing with a vtkRectilinearGrid and that works great.  However, nothing is displayed when I swap in the vtkUnstructuredGrid.</div>
<div><br></div><div>Has anyone had success visualizing a contour surface from vtkUnstructredGrid data?</div><div><br></div><div>Thanks in advance!</div><div>Bjorn</div><div><br></div><div><div>const string positionFileName = @&quot;Positions.txt&quot;;</div>
<div>const string thresholdFileName = @&quot;Thresholds.txt&quot;;</div><div><br></div><div>// Read in points (375 non-repeating points)</div><div>var points = new vtkPoints();</div><div>var positionFile = File.OpenText(positionFileName);</div>
<div>string line = null;</div><div>while ((line = positionFile.ReadLine()) != null)</div><div>{</div><div>var tokens = line.Trim().Split(&#39; &#39;);</div><div>var x = double.Parse(tokens[0]);</div><div>var y = double.Parse(tokens[1]);</div>
<div>var z = double.Parse(tokens[2]);</div><div><br></div><div>points.InsertNextPoint(x, y, z);</div><div>}</div><div>positionFile.Close();</div><div><br></div><div>// Read in thresholds (375 floats ranging from 0.217 to 349.9)</div>
<div>var thresholds = new vtkFloatArray();</div><div>var thresholdFile = File.OpenText(thresholdFileName);</div><div>while ((line = thresholdFile.ReadLine()) != null)</div><div>{</div><div>var threshold = float.Parse(line.Trim());</div>
<div>thresholds.InsertNextValue(threshold);</div><div>}</div><div>thresholdFile.Close();</div><div><br></div><div>// Temp sgrid code to verify pipeline and visualization setup</div><div>#region TEMP CODE</div><div>var xarray = new float[] { 0.0f, 1.0f, 2.0f };</div>
<div>var yarray = new float[] { 0.0f, 1.0f, 2.0f };</div><div>var zarray = new float[] { 0.0f, 1.0f, 2.0f };</div><div>var thresholdCount = xarray.Length*yarray.Length*zarray.Length;</div><div><br></div><div>var xCoords = new vtkFloatArray();</div>
<div>for (int i = 0; i &lt; xarray.Length; i++) xCoords.InsertNextValue(xarray[i]);</div><div>var yCoords = new vtkFloatArray();</div><div>for (int i = 0; i &lt; yarray.Length; i++) yCoords.InsertNextValue(yarray[i]);</div>
<div>var zCoords = new vtkFloatArray();</div><div>for (int i = 0; i &lt; zarray.Length; i++) zCoords.InsertNextValue(zarray[i]);</div><div>var tValues = new vtkFloatArray();</div><div>for (int i = 0; i &lt; thresholdCount; i++) tValues.InsertNextValue(i*0.1f + 10.0f);</div>
<div><br></div><div>var sgrid = new vtkRectilinearGrid();</div><div>sgrid.SetDimensions(xCoords.GetSize(), yCoords.GetSize(), zCoords.GetSize());</div><div>sgrid.SetXCoordinates(xCoords);</div><div>sgrid.SetYCoordinates(yCoords);</div>
<div>sgrid.SetZCoordinates(zCoords);</div><div>sgrid.GetPointData().SetScalars(tValues);</div><div>#endregion</div><div><br></div><div>// Setup pipeline and visualization</div><div>var ugrid = new vtkUnstructuredGrid();</div>
<div>ugrid.SetPoints(points);</div><div>ugrid.GetPointData().SetScalars(thresholds);</div><div><br></div><div>var contour = new vtkContourFilter();</div><div>//contour.SetInputConnection(sgrid.GetProducerPort());  // Works great</div>
<div>contour.SetInputConnection(ugrid.GetProducerPort());  // Displays nothing</div><div>contour.SetValue(0, 10.5);</div><div><br></div><div>var mapper = vtkPolyDataMapper.New();</div><div>mapper.SetInputConnection(contour.GetOutputPort());</div>
<div><br></div><div>var actor = new vtkActor();</div><div>actor.SetMapper(mapper);</div><div><br></div><div>renderer.AddActor(actor);</div><div>renderer.ResetCamera();</div><div>renderWindow.Render();</div></div><div><br>
</div>