[vtkusers] Displaying base and overlay slices with vtkImageViewer2

chasank chasank at gmail.com
Mon Dec 12 08:52:15 EST 2011


Hi all,

I want to show base and overlay slices with a vtkImageViewer2. User should
be able to choose lookup tables for both base and overlay image. Lookup
tables can be different from each other. And user should be able to choose
image (base or overlay) to interact with (for leveling and windowing) in GUI
with a radio button or checkbox. If I try to make it with vtkImageBlend and
vtkImageViewer2 like in the example : 
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/CombineImages
CombineImages.cxx  Interaction affects both images which are blended
together. If I try to make it with Source -> Mapper -> Actor -> Renderer
pipeline like in the example: 
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/Blending2DImagesWithDifferentColorMaps
Colored2DImageFusion.cxx  then the image becomes non interactive for
windowing and leveling. How can I build the proper pipeline for my
requirements. What are your recommendations ? Thanks

My current slice visualization pipeline is below;

imageViewer = vtkImageViewer2()
imageViewer.SetInputConnection(image.GetOutputPort())    
imageViewer.SetSliceOrientationToYZ()
imageViewer.GetWindowLevel().SetLookupTable(lut)      
imageViewer.GetRenderer().AddActor2D(colorBar)    
        
maxSlice = imageViewer.GetSliceMax()   
imageViewer.SetSlice(maxSlice / 2)     

iren = vtkRenderWindowInteractor()
renwin = widget.GetRenderWindow() // widget is QVTKWidget instance
iren.SetRenderWindow(renwin)
    
imageViewer.SetRenderWindow(renwin)
imageViewer.SetupInteractor(widget.GetRenderWindow().GetInteractor())
    
level =  0.5 * ( minIntensity + maxIntensity )
window = maxIntensity - minIntensity    
 
imageViewer.SetColorLevel(level)
imageViewer.SetColorWindow(window)
renderer = imageViewer.GetRenderer()
camera = renderer.GetActiveCamera()
camera.SetViewUp(0, 0, 1)
camera.SetPosition(-1, 0, 0)
camera.SetFocalPoint(0, 0, 0)
camera.ComputeViewPlaneNormal()    

renderer.ResetCamera()
imageViewer.Render()
widget.update()  
widget.show()




--
View this message in context: http://vtk.1045678.n5.nabble.com/Displaying-base-and-overlay-slices-with-vtkImageViewer2-tp5068327p5068327.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list