<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font size="-1">Hi Sebastien,<br>
I made the change, but it still seems not to be running the
filter. Attached is a java file and a .vtp data file to see what's
happening. Also below is the code.<br>
Thanks,<br>
Jim<br>
<br>
package com.profiles;<br>
<br>
import vtk.*;<br>
<br>
public class PlotSomePolyDataFromFileRead {<br>
<br>
public static void main(String[] args) {<br>
try {<br>
new PlotSomePolyDataFromFileRead();<br>
} catch (Exception ex_new_PlotSomePolyDataFromFileRead) {<br>
System.out.println("[main] Exception at new
PlotSomePolyDataFromFileRead()");<br>
ex_new_PlotSomePolyDataFromFileRead.printStackTrace();<br>
}<br>
}<br>
<br>
// Load VTK libraries<br>
static {<br>
if (!vtkNativeLibrary.LoadAllNativeLibraries()) {<br>
{<br>
for (vtkNativeLibrary lib :
vtkNativeLibrary.values()) {<br>
if (!lib.IsLoaded())<br>
System.out<br>
.println(lib.GetLibraryName() + "
not loaded");<br>
}<br>
System.out.println("Make sure the search path is
correct: ");<br>
System.out.println(System.getProperty("java.library.path"));<br>
}<br>
vtkNativeLibrary.DisableOutputWindow(null);<br>
}<br>
}<br>
<br>
private PlotSomePolyDataFromFileRead() {<br>
<br>
// Read the polyData from the data file<br>
vtkXMLPolyDataReader xmlReader = new
vtkXMLPolyDataReader();<br>
xmlReader.SetFileName("C:\\vtk123\\test_data.vtp");<br>
xmlReader.Update();<br>
<br>
// Use the filter vtkPointDataToCellData to create the<br>
// cells from the point data that's in the vtkPolyData
from the reader<br>
// *The vtkPolyData from the reader intentionally only
includes vtkPoints<br>
// and their scalars (that's the given data from the
application output)<br>
vtkPointDataToCellData polyDataCreateCells = new
vtkPointDataToCellData();<br>
polyDataCreateCells.SetInputConnection(xmlReader.GetOutputPort());<br>
polyDataCreateCells.PassPointDataOn();<br>
polyDataCreateCells.Update();<br>
<br>
// In order to check if the vtkPointDataToCellData filter
worked:<br>
// Create new polyData, retrieve polyData (with cells now)
from<br>
// polyDataCreateCells filter, check values during debug
operation<br>
vtkPolyData polyDataWithCells = new vtkPolyData();<br>
polyDataWithCells =
polyDataCreateCells.GetPolyDataOutput();<br>
// At this point, polyDataWithCells has (when I run it)<br>
// point data but not cell data, nor scalar data <br>
// and it should have all 3<br>
<br>
vtkPolyDataMapper polyMapper = new vtkPolyDataMapper();<br>
polyMapper.SetInputData(polyDataCreateCells.GetPolyDataOutput());<br>
polyMapper.Update();<br>
<br>
vtkActor polyActor = new vtkActor();<br>
polyActor.SetMapper(polyMapper);<br>
polyActor.GetProperty().SetColor(1.0, 1.0, 1.0);<br>
<br>
vtkRenderer renderer = new vtkRenderer();<br>
renderer.AddActor(polyActor);<br>
renderer.SetBackground(0.0, 0.0, 0.0);<br>
<br>
vtkRenderWindow renderWindow = new vtkRenderWindow();<br>
renderWindow.AddRenderer(renderer);<br>
renderWindow.SetSize(800, 800);<br>
<br>
vtkRenderWindowInteractor renderWindowInteractor = new
vtkRenderWindowInteractor();<br>
renderWindowInteractor.SetRenderWindow(renderWindow);<br>
<br>
renderWindow.Render();<br>
renderWindowInteractor.Start();<br>
}<br>
}<br>
</font><br>
<br>
<div class="moz-cite-prefix">On 9/21/2015 10:38 AM, Sebastien
Jourdain wrote:<br>
</div>
<blockquote
cite="mid:CABObKxdLbqzRSeCmwR6bQK70j3oR+zSH91qa3oFaF1TSbw80oA@mail.gmail.com"
type="cite">
<div dir="ltr">Try that
<div><br>
</div>
<div>vtkPointDataToCellData polyDataCreateCells = new
vtkPointDataToCellData();<br>
polyDataCreateCells.SetInputData(polyData);<br>
polyDataCreateCells.PassPointDataOn();<br>
polyDataCreateCells.Update(); // <==== For the execution
of the filter</div>
<div><br>
// Create new polyData, retrieve completed polyData from
polyDataCreateCells<br>
vtkPolyData polyDataComplete =
polyDataCreateCells.GetPolyDataOutput(); // No need to create
a polydata just get a ref from the filter<br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Sep 21, 2015 at 8:20 AM, James
Labiak <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:jim@jslengineeringsoftware.com"
target="_blank">jim@jslengineeringsoftware.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> <font size="-1">Hello
all,<br>
I created a pipeline that seems to make sense to me, but
always my polyDataComplete is empty. Any ideas why this
code doesn't work? The only vtkPointToCellData example
on the web that I can find uses blow.vtk, which doesn't
exist on my 6.0.0 installation anywhere. The polyData
variable gets correctly populated with the points and
their scalars below.<br>
<br>
// Create a new, empty polyData<br>
polyData = new vtkPolyData();<br>
<br>
// populate the polyData points<br>
polyData.SetPoints(points);<br>
<br>
// populate the polyData scalars<br>
polyData.GetPointData().SetScalars(colorsScalars);<br>
<br>
vtkPointDataToCellData polyDataCreateCells = new
vtkPointDataToCellData();<br>
polyDataCreateCells.SetInputData(polyData);<br>
polyDataCreateCells.PassPointDataOn();<br>
<br>
// Create new polyData, retrieve completed
polyData from polyDataCreateCells<br>
vtkPolyData polyDataComplete = new
vtkPolyData();<br>
polyDataComplete =
polyDataCreateCells.GetPolyDataOutput();<br>
<br>
vtkPolyDataMapper polyMapper = new
vtkPolyDataMapper();<br>
polyMapper.SetInputData(polyDataComplete);<br>
polyMapper.ScalarVisibilityOn();<br>
polyMapper.SetScalarRange(scalarMin, scalarMax);<br>
polyMapper.Update();<br>
<br>
vtkActor polyActor = new vtkActor();<br>
polyActor.SetMapper(polyMapper);<br>
polyActor.GetProperty().SetColor(1.0, 1.0, 1.0);<br>
<br>
// ...Usual render stuff...<br>
<br>
Thanks,<br>
Jim</font><br>
</div>
<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" rel="noreferrer"
target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a></a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a
moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer"
target="_blank"><a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a></a><br>
<br>
Search the list archives at: <a moz-do-not-send="true"
href="http://markmail.org/search/?q=vtkusers"
rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://public.kitware.com/mailman/listinfo/vtkusers"
rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>