I don't have a vtkPlane. I have just one vtkImageViewer2 and a list of vtkContourWidgets. I defined by own mechanism in Java identify when a slice needs to be changed (catching keyboard/mouse events and using a JSlider). When one of these events occurs I use the SetSlice(int i) method of vtkImageViewer2 to set the slice. Then I call vtkContourWidget.Off() for all of my contours, finally I call vtkContourWidget.On() for just the ones on the slice I'm interested in. You appear to be using a vtkBoundedPlanePointPlacer. While I experimented a lot with this point placer, I ultimately couldn't get it to do what I wanted. That's why I went to the vtkImageActorPointPlacer. The thing that I noticed when using this point placer was that every contour appears on every slice. This lead me to the solution I have now which is manually disabling/enabling contours as a function of image slice being viewed.<br>
<br><div class="gmail_quote">On Tue, Oct 19, 2010 at 10:41 AM, shengwen guo <span dir="ltr"><<a href="mailto:shengwen.guo@gmail.com">shengwen.guo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thank for your help.<div>Could you tell me what's the relationship between vtkContourWidget and vtkPlane? I have define two arrays, vtkContourWidget array and vtkPlane array for all slices. When I change the slice, a ContourWidget is set inactive and another ContourWidget is set active, how can it find the corresponding plane?</div>
<div> I define and initialize two arrays as following:</div><div><div> for(int i = 0 ; i < SliceCount ; i++) </div><div><span style="white-space:pre-wrap">        </span>{</div><div><span style="white-space:pre-wrap">                </span>ContourWidgetArray[i] = vtkContourWidget::New();<span style="white-space:pre-wrap">        </span></div>
<div><span style="white-space:pre-wrap">                </span>PlaneArray[i] = vtkPlane::New(); </div><div><span style="white-space:pre-wrap">        </span>}</div></div><div><div> for(int i = 0 ; i < SliceCount ; i++) </div>
<div><span style="white-space:pre-wrap">        </span> {<span style="white-space:pre-wrap">                </span> </div><div> placer->AddBoundingPlane(PlaneArray[i]);</div><div><span style="white-space:pre-wrap">        </span> }</div>
</div><div><br></div><div> But I don;t know how to find the corresponding plane and contourwidget.</div><div><br></div><div> Shengwen </div><div><div></div><div class="h5"><div><br><div class="gmail_quote">On Tue, Oct 19, 2010 at 2:43 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">
1. This will get the poly data from the contour<div><div>vtkPolyData polyData =</div><div> ((vtkOrientedGlyphContourRepresentation)contour.GetRepresentation()).</div><div> GetContourRepresentationAsPolyData();</div>
<div>2. Here's the code I use to turn on/off contour widgets</div><div><div>public void turnOffEditingForAllExcept(int slice) {</div><div> for (int i=0; i<contours.length; i++) {</div><div> for (vtkContourWidget widget : contours[i]) {</div>
<div> if (slice == i)</div><div> widget.On();</div><div> else</div><div> widget.Off();</div><div> }</div><div> }</div><div> }</div>
</div>
<div>After this I just render the scene again and it works.</div><div><div></div><div><br><div class="gmail_quote">On Mon, Oct 18, 2010 at 11:06 AM, shengwen guo <span dir="ltr"><<a href="mailto:shengwen.guo@gmail.com" target="_blank">shengwen.guo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank for your sample code. I'll try this smart way later. I'm working on it using a vtkContourWidget array and I have two questions:<div>
(1) How can I get the points or polydata from the current contourwidget?</div>
<div>(2) After slice is changed, I will use a new contourwidget or set the corresponding contourwidget active. How can I refresh the window to display new contour using the initial contour, such as two "zero" points in your code?</div>
<div>I'm sorry that I bother you again.</div><div><br></div><div> Shengwen<div><div></div><div><br></div></div></div></blockquote></div></div></div></div></blockquote></div><br><br>
</div>
</div></div></blockquote></div><br>