<div class="gmail_extra">The two result screen shots intented to be presented in the former mail is missing, sorry...<br><br><div class="gmail_quote">2012/4/24 Kenn Lin <span dir="ltr"><<a href="mailto:cqqlin@gmail.com" target="_blank">cqqlin@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello World:<br><br>I got some problem when using 'SetInputArrayToProcess' to get the specified data I want, here's the details:<br>
<br>I have an UnstructuredGrid data file(generated by opemfoam) in hand containing several arrays of scalar(temperature, pressure etc.) data and one array of vector(air current velocity) data of a room like this:<br>
<br># vtk DataFile Version 2.0<br>outlet<br>ASCII<br>DATASET UNSTRUCTURED_GRID<br>POINTS 116 float<br>......<br>CELLS 57 285<br>......<br>CELL_TYPES 57<br>......<br>CELL_DATA 57<br>FIELD attributes 6<br>patchID 1 57 float<br>
......<br>p 1 57 float<br>......<br>nut 1 57 float<br>......<br>T 1 57 float<br>......<br>k 1 57 float<br>......<br>epsilon 1 57 float<br>......<br>U 3 57 float<br>......<br><br>POINT_DATA 116<br>FIELD attributes 5<br>p 1 116 float<br>
......<br>nut 1 116 float<br>......<br>T 1 116 float<br>......<br>k 1 116 float<br>......<br>epsilon 1 116 float<br>......<br>U 3 116 float<br>......<br><br>Now I wish to visualize the array of "T"(Temperature) and "U"(Air current volocity), and after some efforts I achieved to visualize the latter one, which I thought may be the harder, by using a vtkGlyph3D and vtkArrowSource. I used 'glyp.SetInputArrayToProcess(1,0,0,0,"U")' to correctly specify the vector data array I want, it works.<br>
<br>However, when I switch to specify the scalar data "T" using 'mapper.SetInputArrayToProcess(0,0,0,0,"T")', the program dose not work, seems to find no data to process in its pipeline.<br><br>
Below is the pipeline part of my code that <span style="color:rgb(255,0,0)">can work</span> with "volicity" visulization:<br><br>vtkUnstructuredGridReader reader = new vtkUnstructuredGridReader();<br>reader.setFileName(...);<br>
<br>vtkCutter sliceCutter = new vtkCutter();<br>vtkPlane slicePlane = new vtkPlane(); // slicePlane is controlled by a vtkImplicitPlaneWidget<br>sliceCutter.SetCutFunction(slicePlane);<br>sliceCutter.SetInput(reader.GetOutput());<br>
<br>vtkArrowSource arrow= new vtkArrowSource();<br>// ... some configuration of the arrow ...<br><br>vtkGlyph3D glyp = new vtkGlyph3D();<br>glyp.SetSource(arrow.GetOutput());<br>glyp.SetInput(sliceCutter.GetOutput());<br>
<span style="color:rgb(255,0,0)">glyp.SetInputArrayToProcess(1,0,0,0,"U"); // vectors</span><br>glyp.SetScaleFactor(0.075);<br>glyp.SetScaleFactor(10);<br>glyp.SetColorModeToColorByVector();<br>glyp.SetScaleModeToScaleByVector();<br>
<br>sliceMapper = new vtkPolyDataMapper();<br>sliceMapper.SetInput(glyp.GetOutput());<br>....<br><br>The result is obvious:<br><img src="" alt=""><br>
<br>
Below is the code that <span style="color:rgb(255,0,0)">can not work</span> with "temperature" visulization:<br>(When it comes to scalar data "T", I removed the glyp3D, changed the pipeline simply to this:)<br>
<br>vtkUnstructuredGridReader reader = new vtkUnstructuredGridReader();<br>reader.setFileName(...)<br>vtkCutter sliceCutter = new vtkCutter();<br>vtkPlane slicePlane = new vtkPlane();<br>sliceCutter.SetCutFunction(slicePlane);<br>
sliceCutter.SetInput(reader.GetOutput());<br><br>sliceMapper = new vtkPolyDataMapper();<br>sliceMapper.SetInput(sliceCutter.GetOutput());<br><br><span style="color:rgb(255,0,0)">sliceMapper.SetInputArrayToProcess(0,0,0,0,"T"); // scalar</span><br>
// Here I also tried reader/sliceCutter.SetInputArrayToProcess(0,0,0,0,"T"), and even removed this sentence, only to get the same result.<br><br>vtkActor sliceActor = new vtkActor();<br>sliceActor.SetMapper(sliceMapper);<br>
<br>The result is always a strange white plate:<br clear="all"><img src="" alt=""><br>
<br>Could anyone tell me what's wrong with my scalar visualization pipeline or how to retrieve the specified scalar data I want?<br><br>I uploaded the code files and data file as attachments. Due to the real temperature data file is really big, I replaced it with a smaller data file with the same data structure whose scalar data array is named 'p'.<br>
<br>Really thanks very much for reading such a long question of mine :)<span class="HOEnZb"><font color="#888888"><br><br>-- <br><div><div>Sincerely,</div><div>Kenn<br></div>
</div>
</font></span></blockquote></div>
</div>