I&#39;m using im-&gt;SetSlicePlane() with a vtkPlane. That eliminated the volume visualization. However, I am still able to rotate the slice while holding the left mouse button down and dragging. <br><br>Sahithya<br><div class="gmail_extra">

<br><br><div class="gmail_quote">On Fri, Nov 9, 2012 at 5:24 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Then what happens if you comment out the im.SliceAtFocalPointOn()<br>
line in the code?  Then the camera will control the slice orientation,<br>
but not the slice, which would instead be controlled by calling<br>
im.GetSlicePlane()-&gt;SetOrigin(x,y,z) where (x,y,z) is a point on<br>
the slice that you want to display.<br>
<span class="HOEnZb"><font color="#888888"><br>
 - David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Fri, Nov 9, 2012 at 2:53 PM, Sahithya Wintrich &lt;<a href="mailto:s.prakash@csuohio.edu">s.prakash@csuohio.edu</a>&gt; wrote:<br>
&gt; I want to select points and add a connecting line through the points on the<br>
&gt; axial slice. Adding an mouse interaction to the modified code from<br>
&gt; VTK/ImageProcessing/Python/ImageInteractorReslice.py causes the axial slice<br>
&gt; not be &quot;static&quot; anymore. Meaning if I hold down the left mouse button and<br>
&gt; drag my mouse around the mouse pad, I am able to visualize the remaining<br>
&gt; volume. I would like to prevent this from happening. Is there are workaround<br>
&gt; to this? (my code below)<br>
&gt;<br>
&gt; class Interaction: public vtkInteractorStyleTrackballCamera<br>
&gt; {<br>
&gt;   public:<br>
&gt;     static Interaction* New();<br>
&gt;     vtkTypeMacro(Interaction, vtkInteractorStyleTrackballCamera);<br>
&gt;<br>
&gt;     void Initiliaze();<br>
&gt;<br>
&gt;     virtual void OnLeftButtonDown()<br>
&gt;     {<br>
&gt;         cout &lt;&lt; &quot;Picking pixel: &quot; &lt;&lt; this-&gt;Interactor-&gt;GetEventPosition()[0]<br>
&gt; &lt;&lt; &quot; &quot; &lt;&lt; this-&gt;Interactor-&gt;GetEventPosition()[1] &lt;&lt; std::endl;<br>
&gt;<br>
&gt; this-&gt;Interactor-&gt;GetPicker()-&gt;Pick(this-&gt;Interactor-&gt;GetEventPosition()[0],<br>
&gt;                             this-&gt;Interactor-&gt;GetEventPosition()[1],<br>
&gt;                             0,  // always zero.<br>
&gt;<br>
&gt; this-&gt;Interactor-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer());<br>
&gt;         double picked[3];<br>
&gt;         this-&gt;Interactor-&gt;GetPicker()-&gt;GetPickPosition(picked);<br>
&gt;         cout &lt;&lt; &quot;Picked value: &quot; &lt;&lt; picked[0] &lt;&lt; &quot; &quot; &lt;&lt; picked[1] &lt;&lt; &quot; &quot; &lt;&lt;<br>
&gt; picked[2] &lt;&lt; std::endl;<br>
&gt;<br>
&gt;         AddSelectedPoint(picked);<br>
&gt;<br>
&gt;         // code to display the picked values and  locations<br>
&gt;         vtkSmartPointer&lt;vtkRegularPolygonSource&gt; circle =<br>
&gt; vtkSmartPointer&lt;vtkRegularPolygonSource&gt;::New();<br>
&gt;         circle-&gt;SetNumberOfSides(50);<br>
&gt;         circle-&gt;SetRadius(1);<br>
&gt;         circle-&gt;SetCenter(picked[0], picked[1], picked[2]);<br>
&gt;         circle-&gt;Update();<br>
&gt;<br>
&gt;         vtkSmartPointer&lt;vtkPolyDataMapper&gt; mapper =<br>
&gt; vtkSmartPointer&lt;vtkPolyDataMapper&gt;::New();<br>
&gt;         mapper-&gt;SetInputConnection(circle-&gt;GetOutputPort());<br>
&gt;         mapper-&gt;Modified();<br>
&gt;<br>
&gt;         vtkSmartPointer&lt;vtkActor&gt; actor = vtkSmartPointer&lt;vtkActor&gt;::New();<br>
&gt;         vtkSmartPointer&lt;vtkProperty&gt; circleProperty =<br>
&gt; vtkSmartPointer&lt;vtkProperty&gt;::New();<br>
&gt;         circleProperty-&gt;SetColor(1, 1, 0);<br>
&gt;         //circleProperty-&gt;SetOpacity(0.0);<br>
&gt;         circleProperty-&gt;EdgeVisibilityOn();<br>
&gt;         circleProperty-&gt;SetEdgeColor(1, 0, 0);<br>
&gt;         actor-&gt;SetMapper(mapper);<br>
&gt;         actor-&gt;SetProperty(circleProperty);<br>
&gt;<br>
&gt; this-&gt;Interactor-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer()-&gt;AddActor(actor);<br>
&gt;<br>
&gt; this-&gt;Interactor-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer()-&gt;Render();<br>
&gt;<br>
&gt;         // Forward events<br>
&gt;         vtkInteractorStyleTrackballCamera::OnLeftButtonDown();<br>
&gt;      };<br>
&gt;<br>
&gt;<br>
&gt;   private:<br>
&gt;       void AddSelectedPoint(double point[]);<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; };<br>
&gt;<br>
&gt; main.cpp<br>
&gt;<br>
&gt;   vtkSmartPointer&lt;Interaction&gt; mouseStyle =<br>
&gt; vtkSmartPointer&lt;Interaction&gt;::New();<br>
&gt;   mouseStyle-&gt;Initiliaze();<br>
&gt;   mouseStyle-&gt;SetDefaultRenderer(renderer);<br>
&gt;<br>
&gt;   iren-&gt;SetInteractorStyle( mouseStyle );<br>
&gt;<br>
&gt; Thanks for any help!<br>
&gt;<br>
&gt; Sahithya<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Nov 2, 2012 at 6:03 PM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi Sahithya,<br>
&gt;&gt;<br>
&gt;&gt; The following example comes with the VTK source code:<br>
&gt;&gt;<br>
&gt;&gt; VTK/ImageProcessing/Python/ImageInteractorReslice.py<br>
&gt;&gt;<br>
&gt;&gt; Note that you cannot use SetSlicePlane() together with<br>
&gt;&gt; SliceFacesCameraOn() and SliceAtFocalPointOn(),<br>
&gt;&gt; because when the latter two methods are used, the slice<br>
&gt;&gt; plane will be automatically set from the camera parameters<br>
&gt;&gt; and any value you set with SetSlicePlane() will be ignored.<br>
&gt;&gt;<br>
&gt;&gt;  - David<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Fri, Nov 2, 2012 at 3:39 PM, Sahithya Wintrich &lt;<a href="mailto:s.prakash@csuohio.edu">s.prakash@csuohio.edu</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Hello,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I am new to VTK and visualization in general. I am trying to extract a<br>
&gt;&gt; &gt; 2D<br>
&gt;&gt; &gt; slice from a 3D volume. The classes I use are as follows:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; vtkImageReader - reads the stack of 2D CT images<br>
&gt;&gt; &gt; vtkVolumeTextureMapper2D - Maps the volume<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; in order to get a slice defined by a vtkPlane with origin and normal<br>
&gt;&gt; &gt; corresponding to the slice of interest, I use:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     mapper = vtkImageResliceMapper::New();<br>
&gt;&gt; &gt;     mapper-&gt;SetInputConnection(<br>
&gt;&gt; &gt; reader-&gt;GetOuputPort());<br>
&gt;&gt; &gt;     mapper-&gt;SetSlicePlane(plane);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     slice = vtkImageSlice::New();<br>
&gt;&gt; &gt;     slice-&gt;SetMapper(mapper);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     renderer-&gt;AddViewProp(slice);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I understand that the vtkImageSlice is a 3D prop and I tried using<br>
&gt;&gt; &gt; suggestions to change the position and focal point of the camera.<br>
&gt;&gt; &gt; However,<br>
&gt;&gt; &gt; this is still displayed in a 3D space. I need to display this as a 2D<br>
&gt;&gt; &gt; slice<br>
&gt;&gt; &gt; with a correct view (for oblique slices as well) and prevent the user<br>
&gt;&gt; &gt; from<br>
&gt;&gt; &gt; rotating the slice.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Any help would be greatly appreciated!<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Sahithya<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>