<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font size="-1">I got the verts to work and can plot the points, but
am struggling to create a surface through the points. Any
recommendations on an approach? The geometry is similar to: cut a
rectangle through a sphere and slide the piece out; the sphere
faces that remain are similar to my geometry (just small
deviations), but I am focusing on simply trying to create one
surface on one face.<br>
</font><br>
<div class="moz-cite-prefix">On 9/22/2015 9:36 AM, Sebastien
Jourdain wrote:<br>
</div>
<blockquote
cite="mid:CABObKxdOvuXgGbz9hMbPCqrZpHSbkLjcb8sjm50tj0Xh6UhkQA@mail.gmail.com"
type="cite">
<div dir="ltr">I wasn't sure at first based on your comment, but I
don't think vtkPointDataToCellData is meant to create Cells.
<div>And if you don't create any cell, then you won't be able to
see anything.</div>
<div>You can create a single polyverts with all the points ids.</div>
<div><br>
</div>
<div>vtkCellArray verts = new vtkCellArray();</div>
<div>verts.InsertNextCell( points.GetNumberOfPoints() );</div>
<div>for(int i=0; i < points.GetNumberOfPoints(); i++) {</div>
<div> verts.InsertNextPoint(i);</div>
<div>}</div>
<div><br>
</div>
<div>polyDataWithCells.SetVerts(verts)<br>
</div>
<div><br>
</div>
<div>The code above, should create the expected cells. Just be
aware that it was written in a mail with uncertainty regarding
the method names and class names.</div>
<div>But that should be enough to get you started with an
appropriate IDE.</div>
<div><br>
</div>
<div>Seb</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Sep 22, 2015 at 6:35 AM,
Gerrick Bivins <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:Gerrick.Bivins@halliburton.com"
target="_blank">Gerrick.Bivins@halliburton.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="white" link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The
vtp file seems invalid. It looks like the cells
aren’t defined.</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Even
if the polydata is just points, I think you still
have to define the</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">“Verts”
cell array of the polydata.</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><img
src="cid:part2.00090406.02090201@jslengineeringsoftware.com"
height="781" width="1429"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Gerrick</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<div>
<div style="border:none;border-top:solid #b5c4df
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
vtkusers [mailto:<a moz-do-not-send="true"
href="mailto:vtkusers-bounces@vtk.org"
target="_blank">vtkusers-bounces@vtk.org</a>]
<b>On Behalf Of </b>James Labiak<br>
<b>Sent:</b> Monday, September 21, 2015 8:05 PM<br>
<b>To:</b> Sebastien Jourdain<br>
<b>Cc:</b> vtkusers<br>
<b>Subject:</b> [EXTERNAL] Re: [vtkusers] Java
vtkPointToCellData</span></p>
</div>
</div>
<div>
<div class="h5">
<p class="MsoNormal"> </p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span
style="font-size:10.0pt">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>
<br>
</span></p>
<div>
<p class="MsoNormal">On 9/21/2015 10:38 AM,
Sebastien Jourdain wrote:</p>
</div>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">Try that </p>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">vtkPointDataToCellData
polyDataCreateCells = new
vtkPointDataToCellData();<br>
polyDataCreateCells.SetInputData(polyData);<br>
polyDataCreateCells.PassPointDataOn();<br>
polyDataCreateCells.Update(); // <====
For the execution of the filter</p>
</div>
<div>
<p class="MsoNormal"><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</p>
</div>
</div>
<div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">On Mon, Sep 21, 2015 at
8:20 AM, James Labiak <<a
moz-do-not-send="true"
href="mailto:jim@jslengineeringsoftware.com"
target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:jim@jslengineeringsoftware.com">jim@jslengineeringsoftware.com</a></a>>
wrote:</p>
<div>
<p class="MsoNormal"><span
style="font-size:10.0pt">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</span></p>
</div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com"
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"
target="_blank">
http://www.kitware.com/opensource/opensource.html</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"
target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a
moz-do-not-send="true"
href="http://markmail.org/search/?q=vtkusers"
target="_blank">
<a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a></a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://public.kitware.com/mailman/listinfo/vtkusers"
target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a></p>
</div>
<p class="MsoNormal"> </p>
</div>
</blockquote>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
<hr>This e-mail, including any attached files, may contain
confidential and privileged information for the sole use
of the intended recipient. Any review, use, distribution,
or disclosure by others is strictly prohibited. If you are
not the intended recipient (or authorized to receive
information for the intended recipient), please contact
the sender by reply e-mail and delete all copies of this
message.<br>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
James Labiak
JSL Engineering and Software
Mobile: 231-638-3725
email: <a class="moz-txt-link-abbreviated" href="mailto:jim@jslengineeringsoftware.com">jim@jslengineeringsoftware.com</a></pre>
</body>
</html>