I just wanted to let everyone know that I've solved this issue. I ended up totally redoing my internal storage to use binary volumes. This allowed me to run vtkMarchingSquares on the slice I was interested in, and use that for contour initialization, and it works perfectly.<br>
<br><div class="gmail_quote">On Tue, Nov 16, 2010 at 4:25 PM, Jonathan Morra <span dir="ltr"><<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I have been working on this some more and realized that I've overlooked a major issue. When I cut a mesh in a different plane I might not get only 1 contour. This has lead me to do the following in the hopes of returning N vtkPoints, and creating a new contour with each. Unfortunately this still doesn't work. It would appear that some of the cells from strippedData need to be connected and some do not, however, I'm still not sure how to determine which ones should be connected and which ones should be different contours.<div>
<br></div><div>The frustrating thing for me is that I know the code to do this is buried somewhere in VTK because when I render the output of vtkCutter, it looks totally reasonable, but I just can't seem to flush out the logic.</div>
<div><br></div><div>Any ideas?<br><div><br></div><div><div class="im"><div> vtkStripper stripper = new vtkStripper();</div><div> stripper.SetInput(unorderedData);</div><div> stripper.Update();</div><div>
vtkPolyData strippedData = stripper.GetOutput();</div>
<div> </div></div><div> HashSet<vtkPoints> pointsSet = new HashSet<vtkPoints>();</div><div class="im"><div> // Here, we're trying to mimic the suggestion given here</div><div> // <a href="http://vtk.1045678.n5.nabble.com/question-about-vtkContourWidget-vtkContourRepresentation-td1255118.html#a3247766" target="_blank">http://vtk.1045678.n5.nabble.com/question-about-vtkContourWidget-vtkContourRepresentation-td1255118.html#a3247766</a></div>
<div><br></div><div> for (int i=0; i<strippedData.GetNumberOfCells(); i++) {</div><div> vtkCell cell = strippedData.GetCell(i);</div></div><div> vtkPoints points = new vtkPoints();</div><div>
for (int j=0; j<cell.GetNumberOfPoints(); j++)</div><div class="im">
<div> points.InsertNextPoint(cell.GetPoints().GetPoint(j));</div></div><div> pointsSet.add(points);</div><div> }</div><div> </div><div> return pointsSet;</div><div><div></div>
<div class="h5"><br><div class="gmail_quote">
On Mon, Nov 15, 2010 at 11:08 AM, Jonathan Morra <span dir="ltr"><<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So I've found out some more info. It would appear that I am in fact ordering the points in each cell correctly. The following code will output a part of the total points in order. However, if I uncomment the outer for loop and change strippedData.GetCell(0) to strippedData.GetCell(i) the points are again out of order (like my last message). It would appear that the cells of stripped data have an order that is not 0, 1, 2,...<div>
<br></div><div>Does anyone know if this is correct, or if I'm on the right track?<br><div><br></div><div><div><div> vtkStripper stripper = new vtkStripper();</div><div> stripper.SetInput(unorderedData);</div>
<div> stripper.Update();</div><div> vtkPolyData strippedData = stripper.GetOutput();</div><div> </div><div> vtkPoints points = new vtkPoints();</div><div> // Here, we're trying to mimic the suggestion given here</div>
<div> // <a href="http://vtk.1045678.n5.nabble.com/question-about-vtkContourWidget-vtkContourRepresentation-td1255118.html#a3247766" target="_blank">http://vtk.1045678.n5.nabble.com/question-about-vtkContourWidget-vtkContourRepresentation-td1255118.html#a3247766</a></div>
<div> </div><div> //for (int i=0; i<strippedData.GetNumberOfCells(); i++) {</div></div><div> vtkCell cell = strippedData.GetCell(0);</div><div><div> for (int j=0; j<cell.GetPoints().GetNumberOfPoints()-1; j++) {</div>
<div> points.InsertNextPoint(cell.GetPoints().GetPoint(j));</div><div> }</div><div> //}</div><div> return points;</div><br></div><div><div></div><div><div class="gmail_quote">
On Thu, Nov 11, 2010 at 12:24 PM, Jonathan Morra <span dir="ltr"><<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So after struggling with this for a while, I've come up with the following code, which kinda does the job.<div><br>
</div><div><div> public vtkPoints reorderPoints(vtkPolyData unorderedData) {</div><div> vtkStripper stripper = new vtkStripper();</div>
<div> stripper.SetInput(unorderedData);</div><div> stripper.Update();</div><div> vtkPolyData strippedData = stripper.GetOutput();</div><div> </div><div> vtkPoints points = new vtkPoints();</div>
<div> // Here, we're trying to mimic the suggestion given here</div><div> // <a href="http://vtk.1045678.n5.nabble.com/question-about-vtkContourWidget-vtkContourRepresentation-td1255118.html#a3247766" target="_blank">http://vtk.1045678.n5.nabble.com/question-about-vtkContourWidget-vtkContourRepresentation-td1255118.html#a3247766</a></div>
<div> for (int i=0; i<strippedData.GetNumberOfCells(); i++) {</div><div> vtkCell cell = strippedData.GetCell(i);</div><div> for (int j=0; j<cell.GetPoints().GetNumberOfPoints()-1; j++) {</div>
<div> points.InsertNextPoint(cell.GetPoints().GetPoint(j));</div><div> }</div><div> }</div><div> return points;</div><div> }</div>The points that are returned are in "better" order than having not run this method, but it's still not the correct order. It turns out that I cannot upgrade to the newest version of VTK because we're using GDCM which isn't yet integrated into the newest version of VTK, so I'm stuck with 5.6 for now. However, I did do a test on the head of GIT and I tried to use Karthik's code suggested above, but I still couldn't get that working. I attempted to follow internally what vtkCellArray.GetNextCell() was doing, and that's how I came up with the above function. </div>
<div><br></div><div>Can someone tell me why the above function isn't returning the vtkPoints in the correct order for vtkContourWidget?</div><div><br></div><div>Thanks<div><div></div><div><br><div class="gmail_quote">
On Sat, Nov 6, 2010 at 10:12 PM, Karthik Krishnan <span dir="ltr"><<a href="mailto:karthik.krishnan@kitware.com" target="_blank">karthik.krishnan@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ah.. yes.. This method was added on May 19, 2010. Perhaps you are<br>
using a version of VTK prior to that.<br>
<br>
Please see :<br>
<a href="http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=068a064cea7ba0fc7a4c4f9d2f7dfed6eb093674" target="_blank">http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=068a064cea7ba0fc7a4c4f9d2f7dfed6eb093674</a><br>
<br>
Update your VTK.<br>
<div><div></div><div><br>
<br>
On Sat, Nov 6, 2010 at 10:54 PM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>> wrote:<br>
> I couldn't find GetNextCell() at all in Java. I'm currently using version<br>
> 5.6. Do you have any other suggestions?<br>
><br>
> On Nov 6, 2010 9:05 AM, "Karthik Krishnan" <<a href="mailto:karthik.krishnan@kitware.com" target="_blank">karthik.krishnan@kitware.com</a>><br>
> wrote:<br>
><br>
> Jonathan:<br>
><br>
> Use the other signature of the method GetNextCell. [ int<br>
> GetNextCell(vtkIdList *pts) ]That should be wrapped...<br>
><br>
> The code to re-order the points based on the connectivity information<br>
> would be written in java as :<br>
><br>
> vtkIdList idlist = new vtkIdList();<br>
> unorderedPolyData.GetLines().GetNextCell(idlist);<br>
> npts = idlist.GetNumberOfIds();<br>
> for ( int i = 0; i < ( npts-1 ); i ++)<br>
> {<br>
> points.InsertPoint(i, unorderedPolyData.GetPoints().GetPoint(pts[i]));<br>
> }<br>
><br>
> --<br>
> karthik<br>
><br>
> On Wed, Nov 3, 2010 at 7:29 AM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>> wrote:<br>
>> I have a 3D vtkPolyDat...<br>
><br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitwa...<br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br>