I'm using im->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"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></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()->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 <<a href="mailto:s.prakash@csuohio.edu">s.prakash@csuohio.edu</a>> wrote:<br>
> I want to select points and add a connecting line through the points on the<br>
> axial slice. Adding an mouse interaction to the modified code from<br>
> VTK/ImageProcessing/Python/ImageInteractorReslice.py causes the axial slice<br>
> not be "static" anymore. Meaning if I hold down the left mouse button and<br>
> drag my mouse around the mouse pad, I am able to visualize the remaining<br>
> volume. I would like to prevent this from happening. Is there are workaround<br>
> 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 << "Picking pixel: " << this->Interactor->GetEventPosition()[0]<br>
> << " " << this->Interactor->GetEventPosition()[1] << std::endl;<br>
><br>
> this->Interactor->GetPicker()->Pick(this->Interactor->GetEventPosition()[0],<br>
> this->Interactor->GetEventPosition()[1],<br>
> 0, // always zero.<br>
><br>
> this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer());<br>
> double picked[3];<br>
> this->Interactor->GetPicker()->GetPickPosition(picked);<br>
> cout << "Picked value: " << picked[0] << " " << picked[1] << " " <<<br>
> picked[2] << std::endl;<br>
><br>
> AddSelectedPoint(picked);<br>
><br>
> // code to display the picked values and locations<br>
> vtkSmartPointer<vtkRegularPolygonSource> circle =<br>
> vtkSmartPointer<vtkRegularPolygonSource>::New();<br>
> circle->SetNumberOfSides(50);<br>
> circle->SetRadius(1);<br>
> circle->SetCenter(picked[0], picked[1], picked[2]);<br>
> circle->Update();<br>
><br>
> vtkSmartPointer<vtkPolyDataMapper> mapper =<br>
> vtkSmartPointer<vtkPolyDataMapper>::New();<br>
> mapper->SetInputConnection(circle->GetOutputPort());<br>
> mapper->Modified();<br>
><br>
> vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();<br>
> vtkSmartPointer<vtkProperty> circleProperty =<br>
> vtkSmartPointer<vtkProperty>::New();<br>
> circleProperty->SetColor(1, 1, 0);<br>
> //circleProperty->SetOpacity(0.0);<br>
> circleProperty->EdgeVisibilityOn();<br>
> circleProperty->SetEdgeColor(1, 0, 0);<br>
> actor->SetMapper(mapper);<br>
> actor->SetProperty(circleProperty);<br>
><br>
> this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(actor);<br>
><br>
> this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->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<Interaction> mouseStyle =<br>
> vtkSmartPointer<Interaction>::New();<br>
> mouseStyle->Initiliaze();<br>
> mouseStyle->SetDefaultRenderer(renderer);<br>
><br>
> iren->SetInteractorStyle( mouseStyle );<br>
><br>
> Thanks for any help!<br>
><br>
> Sahithya<br>
><br>
><br>
><br>
> On Fri, Nov 2, 2012 at 6:03 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>
>><br>
>> 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>
>><br>
>> - David<br>
>><br>
>><br>
>> On Fri, Nov 2, 2012 at 3:39 PM, Sahithya Wintrich <<a href="mailto:s.prakash@csuohio.edu">s.prakash@csuohio.edu</a>><br>
>> wrote:<br>
>> > Hello,<br>
>> ><br>
>> > I am new to VTK and visualization in general. I am trying to extract a<br>
>> > 2D<br>
>> > slice from a 3D volume. The classes I use are as follows:<br>
>> ><br>
>> > vtkImageReader - reads the stack of 2D CT images<br>
>> > vtkVolumeTextureMapper2D - Maps the volume<br>
>> ><br>
>> > in order to get a slice defined by a vtkPlane with origin and normal<br>
>> > corresponding to the slice of interest, I use:<br>
>> ><br>
>> > mapper = vtkImageResliceMapper::New();<br>
>> > mapper->SetInputConnection(<br>
>> > reader->GetOuputPort());<br>
>> > mapper->SetSlicePlane(plane);<br>
>> ><br>
>> > slice = vtkImageSlice::New();<br>
>> > slice->SetMapper(mapper);<br>
>> ><br>
>> > renderer->AddViewProp(slice);<br>
>> ><br>
>> > I understand that the vtkImageSlice is a 3D prop and I tried using<br>
>> > suggestions to change the position and focal point of the camera.<br>
>> > However,<br>
>> > this is still displayed in a 3D space. I need to display this as a 2D<br>
>> > slice<br>
>> > with a correct view (for oblique slices as well) and prevent the user<br>
>> > from<br>
>> > rotating the slice.<br>
>> ><br>
>> > Any help would be greatly appreciated!<br>
>> ><br>
>> > Sahithya<br>
><br>
><br>
</div></div></blockquote></div><br></div>