I want to select points and add a connecting line through the points on the axial slice. Adding an mouse interaction to the modified code from VTK/ImageProcessing/Python/ImageInteractorReslice.py causes the axial slice not be &quot;static&quot; anymore. Meaning if I hold down the left mouse button and drag my mouse around the mouse pad, I am able to visualize the remaining volume. I would like to prevent this from happening. Is there are workaround to this? (my code below)<br>

<br>class Interaction: public vtkInteractorStyleTrackballCamera<br>{<br>  public:<br>    static Interaction* New();<br>    vtkTypeMacro(Interaction, vtkInteractorStyleTrackballCamera);<br>    <br>    void Initiliaze();   <br>

 <br>    virtual void OnLeftButtonDown()<br>    {<br>        cout &lt;&lt; &quot;Picking pixel: &quot; &lt;&lt; this-&gt;Interactor-&gt;GetEventPosition()[0] &lt;&lt; &quot; &quot; &lt;&lt; this-&gt;Interactor-&gt;GetEventPosition()[1] &lt;&lt; std::endl;<br>

        this-&gt;Interactor-&gt;GetPicker()-&gt;Pick(this-&gt;Interactor-&gt;GetEventPosition()[0], <br>                            this-&gt;Interactor-&gt;GetEventPosition()[1], <br>                            0,  // always zero.<br>

                            this-&gt;Interactor-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer());<br>        double picked[3];<br>        this-&gt;Interactor-&gt;GetPicker()-&gt;GetPickPosition(picked);<br>

        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; picked[2] &lt;&lt; std::endl;<br><br>        AddSelectedPoint(picked);<br><br>
        // code to display the picked values and  locations<br>
        vtkSmartPointer&lt;vtkRegularPolygonSource&gt; circle = vtkSmartPointer&lt;vtkRegularPolygonSource&gt;::New();<br>        circle-&gt;SetNumberOfSides(50);<br>        circle-&gt;SetRadius(1);<br>        circle-&gt;SetCenter(picked[0], picked[1], picked[2]);<br>

        circle-&gt;Update();<br><br>        vtkSmartPointer&lt;vtkPolyDataMapper&gt; mapper = vtkSmartPointer&lt;vtkPolyDataMapper&gt;::New();<br>        mapper-&gt;SetInputConnection(circle-&gt;GetOutputPort());<br>        mapper-&gt;Modified();<br>

<br>        vtkSmartPointer&lt;vtkActor&gt; actor = vtkSmartPointer&lt;vtkActor&gt;::New();<br>        vtkSmartPointer&lt;vtkProperty&gt; circleProperty = vtkSmartPointer&lt;vtkProperty&gt;::New();<br>        circleProperty-&gt;SetColor(1, 1, 0);<br>

        //circleProperty-&gt;SetOpacity(0.0);<br>        circleProperty-&gt;EdgeVisibilityOn();<br>        circleProperty-&gt;SetEdgeColor(1, 0, 0);<br>        actor-&gt;SetMapper(mapper);<br>        actor-&gt;SetProperty(circleProperty);      <br>

        this-&gt;Interactor-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer()-&gt;AddActor(actor);<br>        this-&gt;Interactor-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer()-&gt;Render();<br>

<br>        // Forward events<br>        vtkInteractorStyleTrackballCamera::OnLeftButtonDown();<br>     };<br>   <br> <br>  private:<br>      void AddSelectedPoint(double point[]);    <br><br><br><br>};<br><br>main.cpp<br>

<br>  vtkSmartPointer&lt;Interaction&gt; mouseStyle =  vtkSmartPointer&lt;Interaction&gt;::New();<br>  mouseStyle-&gt;Initiliaze();<br>  mouseStyle-&gt;SetDefaultRenderer(renderer);<br>    <br>  iren-&gt;SetInteractorStyle( mouseStyle );<br>

<br>Thanks for any help!<br><br>Sahithya<br><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 2, 2012 at 6:03 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">Hi Sahithya,<br>
<br>
The following example comes with the VTK source code:<br>
<br>
VTK/ImageProcessing/Python/ImageInteractorReslice.py<br>
<br>
Note that you cannot use SetSlicePlane() together with<br>
SliceFacesCameraOn() and SliceAtFocalPointOn(),<br>
because when the latter two methods are used, the slice<br>
plane will be automatically set from the camera parameters<br>
and any value you set with SetSlicePlane() will be ignored.<br>
<span class="HOEnZb"><font color="#888888"><br>
 - David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
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; wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; I am new to VTK and visualization in general. I am trying to extract a 2D<br>
&gt; slice from a 3D volume. The classes I use are as follows:<br>
&gt;<br>
&gt; vtkImageReader - reads the stack of 2D CT images<br>
&gt; vtkVolumeTextureMapper2D - Maps the volume<br>
&gt;<br>
&gt; in order to get a slice defined by a vtkPlane with origin and normal<br>
&gt; corresponding to the slice of interest, I use:<br>
&gt;<br>
&gt;     mapper = vtkImageResliceMapper::New();<br>
&gt;     mapper-&gt;SetInputConnection(<br>
&gt; reader-&gt;GetOuputPort());<br>
&gt;     mapper-&gt;SetSlicePlane(plane);<br>
&gt;<br>
&gt;     slice = vtkImageSlice::New();<br>
&gt;     slice-&gt;SetMapper(mapper);<br>
&gt;<br>
&gt;     renderer-&gt;AddViewProp(slice);<br>
&gt;<br>
&gt; I understand that the vtkImageSlice is a 3D prop and I tried using<br>
&gt; suggestions to change the position and focal point of the camera. However,<br>
&gt; this is still displayed in a 3D space. I need to display this as a 2D slice<br>
&gt; with a correct view (for oblique slices as well) and prevent the user from<br>
&gt; rotating the slice.<br>
&gt;<br>
&gt; Any help would be greatly appreciated!<br>
&gt;<br>
&gt; Sahithya<br>
</div></div></blockquote></div><br></div>