I'm trying to display a 2d image (resliced output from vtkImagePlaneWidget) onto a separate renderer. I'm able to display the actor, but the image isn't centered, and the zoom isn't correct.<br><br>Here is the code that creates the image actor and displays it:<br>
<br> vtkImageMapToColors* colorMapY = vtkImageMapToColors::New();<br> colorMapY->PassAlphaToOutputOff();<br> colorMapY->SetActiveComponent(0);<br> colorMapY->SetOutputFormatToLuminance();<br> colorMapY->SetInput(planeWidgetY->GetResliceOutput());<br>
colorMapY->SetLookupTable(planeWidgetY->GetLookupTable());<br> vtkImageActor* imageActorY = vtkImageActor::New();<br> imageActorY->SetScaleSetInput(colorMapY->GetOutput());<br><br> ren3->AddActor(imageActorY);<br>
ren3->SetBackground( 0.2, 0.2, 0.2);<br> ren3->SetViewport(0.7, 0.33, 1.0, 0.67);<br> ren3->GetActiveCamera()->ParallelProjectionOn();<br> ren3->GetActiveCamera()->Zoom(0.005);<br><br>For some reason if I use the default zoom, the image is zoomed so far in that I see individual pixels, so I use a zoom of 0.005. With a tiny zoom, I can see the image, but again, its not centered. I can't seem to find out the size of the displayed image so that I can center it.<br>
<br>I've tried the vtkImageViewer and it displays correctly, but it makes the application incredibly slow. How can I center and correctly zoom into the 2d image?<br>