<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font size="-1">Hi Gerrick,<br>
Yes, this is the problem; my cells are not being created by the
vtkPointDataToCellData filter. I'm trying to figure out why that
filter is not creating the cells from the point data that I supply
it. <br>
<br>
For the .vtp file, I was just trying to simplify the code sample.
For reference, to create it, I created vtkPoints with a sequential
index number + x,y,z coordinate values. Note that the index number
has no obvious relation to the ordering of points (ID's) that
would create a cell. However, it seems to me like this should be a
common scenario in the field. I also create a vtkFloatArray
scalars array called colorsScalars. Then, I do this:<br>
<br>
// Create a new, empty polyData<br>
polyData = new vtkPolyData();<br>
<br>
// populate the polyData with the points<br>
polyData.SetPoints(points);<br>
<br>
// populate the polyData with the scalars<br>
polyData.GetPointData().SetScalars(this.colorsScalars);<br>
<br>
// Write the polyData to an XML-based ".vtp" format<br>
// This gives an input file for a simpler test class<br>
vtkXMLPolyDataWriter xmlWriter = new
vtkXMLPolyDataWriter();<br>
xmlWriter.SetInputData(polyData);<br>
xmlWriter.SetFileName("C:\\vtk123\\test_data.vtp");<br>
xmlWriter.Write();<br>
<br>
Regards,<br>
Jim<br>
</font><br>
<div class="moz-cite-prefix">On 9/22/2015 8:35 AM, Gerrick Bivins
wrote:<br>
</div>
<blockquote
cite="mid:B0794D08412B1444B729850159888A961417C916@NP1EXMB026.corp.halliburton.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
color:black;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";
color:black;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<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.<o:p></o:p></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<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">“Verts”
cell array of the polydata.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><img id="Picture_x0020_1"
src="cid:part1.09090309.09050100@jslengineeringsoftware.com"
height="781" width="1429"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Gerrick<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></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 [<a class="moz-txt-link-freetext" href="mailto:vtkusers-bounces@vtk.org">mailto: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<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></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><o:p></o:p></p>
<div>
<p class="MsoNormal">On 9/21/2015 10:38 AM, Sebastien Jourdain
wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">Try that <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></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<o:p></o:p></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<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></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">jim@jslengineeringsoftware.com</a>>
wrote:<o:p></o:p></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><o:p></o:p></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">
<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">
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">
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"
target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</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>
</blockquote>
<br>
</body>
</html>