No subject


Thu May 27 11:52:52 EDT 2010


imageViewer.SetSlice(value);
After some more digging, it turns out that the Render method is actually the
method taking the most time to execute.

2.  I have 3 vtkImagePlaneWidget's with and I want to show a vtkPolyData
with them in the same window.  This question is similar to the first in that
if I show a vtkPolyData that is a series of 2D contours then the speed is
fine, however the render speed is extremely slow if I show a 3D surface.  I
noticed that the amount of decimation that I do to the surface with
vtkDecimatePro does not seem to affect the render speed.

3.  An unrelated question.  I have a vtkContourWidget that I wish to use
live wire with.  I have followed the tutorial
on vtkDijkstraImageContourLineInterpolator and am able to successfully
create the contour widget with live wire interpolation. However, when I
first initialize the contour with the following code it is very slow

    // For now, we're just initializing the data with
    // the point that was clicked

    vtkPoints points = new vtkPoints();

    // The initial data MUST be at least a "line"
    // by giving the same point twice we are effictively creating a zero
    // length line
    points.InsertNextPoint(lastContourControlPoint);
    points.InsertNextPoint(lastContourControlPoint);
    vtkPolyData initialData = new vtkPolyData();
    initialData.SetPoints(points);
    contourWidget.Initialize(initialData, 0);
The line that is slow is the last line.  The weird part is that if I do not
use live wire, and just use the default Bezier curve interpolation the
initialization is instant.

In summary, I've been working on these three issues for a few days and can't
seem to make any progress in any of them.  Does anyone have any suggestions
on how to speed things up?

Thanks

--0016e650980e604c7204940778f1
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I have three questions regarding speed in VTK with Java<div>1. =A0I have th=
ree vtkImageViewer2&#39;s showing three different cuts through a 3D volume.=
 =A0I wish to display cuts through a vtkPolyData over 2 of them and have th=
ose cuts update as the user moves through the data. =A0When the vtkPolyData=
 is a stack of 2D contours, the speed is totally fine. =A0However, when I t=
ake that stack of 2D contours and create a 3D mesh out of it by using a Lin=
earExtruder then ImageStencil then MarchingCubes then Decimation (I do this=
 only once, not on every update). =A0The render time is much slower. =A0Her=
e is a snippet of code showing how I go from a 3D mesh to the appropriate 2=
D cut for display.</div>
<div><br></div><div>=A0=A0 =A0double[] center =3D imageViewer.GetImageActor=
().GetCenter();</div><div>=A0=A0 =A0vtkPolyData organData =3D ENV.getInstan=
ce().getDataManager().getOrganMesh(organ);</div><div><div>=A0=A0 =A0if (org=
anData =3D=3D null)</div>
<div>=A0=A0 =A0 =A0 =A0continue;</div><div><br></div><div>=A0=A0 =A0vtkPlan=
e cutPlane =3D new vtkPlane();</div><div>=A0=A0 =A0cutPlane.SetOrigin(cente=
r);</div><div>=A0=A0 =A0switch (orientation) {</div><div>=A0=A0 =A0 =A0 =A0=
case ORIENTATION_XY:</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0cutPlane.SetNormal=
(0, 0, 1);</div>
<div>=A0=A0 =A0 =A0 =A0 =A0 =A0break;</div><div>=A0=A0 =A0 =A0 =A0case ORIE=
NTATION_XZ:</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0cutPlane.SetNormal(0, 1, 0)=
;</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0break;</div><div>=A0=A0 =A0 =A0 =A0ca=
se ORIENTATION_YZ:</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0cutPlane.SetNormal(1=
, 0, 0);</div>
<div>=A0=A0 =A0 =A0 =A0 =A0 =A0break;</div><div>=A0=A0 =A0}</div><div><br><=
/div><div>=A0=A0 =A0vtkCutter cutter =3D new vtkCutter();</div><div>=A0=A0 =
=A0cutter.SetCutFunction(cutPlane);</div><div>=A0=A0 =A0cutter.SetInput(org=
anData);</div><div><br></div><div>=A0=A0 =A0vtkPolyDataMapper mapper =3D ne=
w vtkPolyDataMapper();</div>
<div>=A0=A0 =A0mapper.SetInputConnection(cutter.GetOutputPort());</div><div=
>=A0=A0 =A0mapper.ScalarVisibilityOff();</div><div>=A0=A0 =A0mapper.Update(=
);</div><div><br></div><div>=A0=A0 =A0vtkActor actor =3D new vtkActor();</d=
iv><div>=A0=A0 =A0actor.SetMapper(mapper);</div>
<div>=A0=A0 =A0actor.GetProperty().SetColor(ENV.getInstance().getDataManage=
r().getLineColor(organ));</div><div>=A0=A0 =A0actor.GetProperty().SetRepres=
entationToWireframe();</div><div><br></div><div>=A0=A0 =A0imageViewer.GetRe=
nderer().AddActor(actor);</div>
</div><div><br></div><div>From my analysis, the slowdown does not occur her=
e, but rather in the line=A0</div><div>imageViewer.SetSlice(value);</div><d=
iv>After some more digging, it turns out that the Render method is actually=
 the method taking the most time to execute.</div>
<div><br></div><div>2. =A0I have 3 vtkImagePlaneWidget&#39;s with and I wan=
t to show a vtkPolyData with them in the same window. =A0This question is s=
imilar to the first in that if I show a vtkPolyData that is a series of 2D =
contours then the speed is fine, however the render speed is extremely slow=
 if I show a 3D surface. =A0I noticed that the amount of decimation that I =
do to the surface with vtkDecimatePro does not seem to affect the render sp=
eed.</div>
<div><br></div><div>3. =A0An unrelated question. =A0I have a vtkContourWidg=
et that I wish to use live wire with. =A0I have followed the tutorial on=A0=
vtkDijkstraImageContourLineInterpolator and am able to successfully create =
the contour widget with live wire interpolation. However, when I first init=
ialize the contour with the following code it is very slow</div>
<div><br></div><div><div>=A0=A0 =A0// For now, we&#39;re just initializing =
the data with</div><div>=A0=A0 =A0// the point that was clicked</div><div><=
br></div><div>=A0=A0 =A0vtkPoints points =3D new vtkPoints();</div><div>=A0=
=A0 =A0 =A0 =A0</div><div>
=A0=A0 =A0// The initial data MUST be at least a &quot;line&quot;</div><div=
>=A0=A0 =A0// by giving the same point twice we are effictively creating a =
zero</div><div>=A0=A0 =A0// length line</div><div>=A0=A0 =A0points.InsertNe=
xtPoint(lastContourControlPoint);</div>
<div>=A0=A0 =A0points.InsertNextPoint(lastContourControlPoint);</div><div>=
=A0=A0 =A0vtkPolyData initialData =3D new vtkPolyData();</div><div>=A0=A0 =
=A0initialData.SetPoints(points);</div><div>=A0=A0 =A0contourWidget.Initial=
ize(initialData, 0);</div>
</div><div>The line that is slow is the last line. =A0The weird part is tha=
t if I do not use live wire, and just use the default Bezier curve interpol=
ation the initialization is instant.</div><div><br></div><div>In summary, I=
&#39;ve been working on these three issues for a few days and can&#39;t see=
m to make any progress in any of them. =A0Does anyone have any suggestions =
on how to speed things up?</div>
<div><br></div><div>Thanks</div>

--0016e650980e604c7204940778f1--


More information about the vtkusers mailing list