[vtkusers] Using vtkMarchingCubes3D with vtkContourWidget

Jonathan Morra jonmorra at gmail.com
Thu Nov 4 15:23:47 EDT 2010


I was wondering if you had any other ideas?

On Tue, Nov 2, 2010 at 9:37 PM, Jonathan Morra <jonmorra at gmail.com> wrote:

> Thanks for your help, but your suggestion isn't working for me.  Here is a
> snippet of my code, could you please let me know what I'm doing wrong.
>
> Thanks
>
>     vtkPlane cutPlane = new vtkPlane();
>     switch (orientation) {
>         case OrthoPanel.ORIENTATION_XY:
>             cutPlane.SetNormal(0, 0, 1);
>             break;
>         case OrthoPanel.ORIENTATION_XZ:
>             cutPlane.SetNormal(0, 1, 0);
>             break;
>         case OrthoPanel.ORIENTATION_YZ:
>             cutPlane.SetNormal(1, 0, 0);
>             break;
>     }
>     vtkCutter cutter = new vtkCutter();
>
>     vtkImageData imageData = imageViewer.GetInput();
>     double[] bounds = imageData.GetBounds();
>     double spacing = imageData.GetSpacing();
>
>     cutter.SetInput(organ);
>     for (double cutLoc = bounds[0]; cutLoc <=
> bounds[1]; cutLoc+=spacing[0]) {
>         double[] cutOrigin = new double[3];
>         cutOrigin[orientation] = cutLoc;
>         cutPlane.SetOrigin(cutOrigin);
>         cutter.SetCutFunction(cutPlane);
>         cutter.Update();
>
>         if (cutter.GetOutput().GetNumberOfPoints() == 0)
>             continue;
>
>         vtkStripper stripper = new vtkStripper();
>         stripper.SetInputConnection(cutter.GetOutputPort());
>         stripper.Update();
>         vtkPolyData stripData = stripper.GetOutput();
>     }
>
> On Tue, Nov 2, 2010 at 8:42 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
>
>> Run vtkStripper on the output of vtkCutter. It will order the
>> polylines properly.
>>
>> On Tue, Nov 2, 2010 at 9:59 PM, Jonathan Morra <jonmorra at gmail.com>
>> wrote:
>> > I have a 3D vtkPolyData mesh that I wish to convert into 2D
>> > vtkContourWidgets.  The poly data was generated with vtkMarchingCubes3D.
>>  My
>> > process is to run vtkCutter on each slice of the poly data and use that
>> as
>> > seed data to create my contour widgets.  However, when I create my
>> contour
>> > widgets the points are all out of order.  I found the following post
>> that
>> > seems to be stating what I want to do
>> >
>> http://vtk.1045678.n5.nabble.com/question-about-vtkContourWidget-vtkContourRepresentation-td1255118.html#a3247766
>> > however, this example is written in C++ and I'm working in Java, and
>> there
>> > doesn't appear to be any vtkCellArray.GetNextCell() method in Java's
>> VTK.
>> > 1.  Is this the solution to my problem?
>> > 2.  If so can someone please translate this code into Java, and if this
>> > isn't the solution I'm looking for, can someone suggest one?
>> > Thanks
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the VTK FAQ at:
>> > http://www.vtk.org/Wiki/VTK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.vtk.org/mailman/listinfo/vtkusers
>> >
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101104/8c1f0ac8/attachment.htm>


More information about the vtkusers mailing list