[vtkusers] How to make a projection from 3D data?

LM racetojannah at yahoo.com
Thu Jan 26 07:48:39 EST 2006


  thanks a lot for ur reply..gr. Hugo
  This code will be useful so much for me in another level..
  But actually for now i need to represent only a projection not max intensity..
  mean that i want to get the front, side and top views..
   
  for example.. I am representing a 3D image for a human head.. so i want to view his face and profile in 2D planes..
   
  so do u know a suitable solution
   
  regards
   
  

Hugo Gratama van Andel <h.a.gratamavanandel at amc.uva.nl> wrote:
  Hello LM,

If you mean Maximum Intensity Projection I have some code that might 
help you. It is derived from some example TCL-scripts and it gives you a 
renderwindow in which you can interact with the data and so choose the 
direction of the MIP. Finding code for capturing the 2D output of the 
window should be easy. I used the code below on some CT-images 
(raw-imagedata), you should set all the dimensions yourself.
gr. Hugo

------mip.tcl--------
package require vtk
package require vtkinteraction

# Create the renderer, the render window, and the interactor. The
# renderer draws into the render window, the interactor enables
# keyboard-based interaction with the scene.
vtkRenderer aRenderer
vtkRenderWindow renWin
renWin AddRenderer aRenderer
vtkRenderWindowInteractor iren

vtkInteractorStyleTrackballCamera aTrackBallCamera
iren SetInteractorStyle aTrackBallCamera
iren SetRenderWindow renWin

vtkImageReader reader
reader SetDataByteOrderToLittleEndian
reader SetDataScalarTypeToUnsignedShort
reader SetDataExtent 0 511 0 511 0 373
reader SetDataSpacing 0.29 0.29 0.5
reader SetFileDimensionality 3
reader SetFileName "C:/temp/patient.raw"

# Adding the volume renderer (ray caster)
vtkPiecewiseFunction opacityTransferFunction
opacityTransferFunction AddPoint 1100 0
opacityTransferFunction AddPoint 1500 1.0

vtkColorTransferFunction colorTransferFunction
colorTransferFunction AddRGBPoint 0.0 0.0 0.0 0.0
colorTransferFunction AddRGBPoint 255.0 1.0 1.0 1.0

vtkVolumeProperty volumeProperty
volumeProperty SetColor colorTransferFunction
volumeProperty SetScalarOpacity opacityTransferFunction

vtkVolumeRayCastMIPFunction MIP
vtkVolumeRayCastMapper volumeMapper
volumeMapper SetVolumeRayCastFunction MIP
volumeMapper SetInputConnection [reader GetOutputPort]

vtkVolume volume
volume SetMapper volumeMapper
volume SetProperty volumeProperty
volume VisibilityOn
volume Update

# Bounding box.
vtkOutlineFilter outlineData
outlineData SetInputConnection [reader GetOutputPort]
vtkPolyDataMapper mapOutline
mapOutline SetInputConnection [outlineData GetOutputPort]
vtkActor outline
outline SetMapper mapOutline
[outline GetProperty] SetColor 0 1 0

# Actors are added to the renderer.
aRenderer AddActor outline
aRenderer AddVolume volume

vtkCamera aCamera
aRenderer SetActiveCamera aCamera

# Setting the color and size of the renderwindow,
#initializing the camera position
aCamera SetViewUp 0 0 -1
aCamera SetPosition -2 -2 -2
aCamera SetFocalPoint 0 0 0
aCamera ComputeViewPlaneNormal
aRenderer ResetCamera
aRenderer ResetCameraClippingRange
aRenderer SetBackground 0.2 0.2 0.2
renWin SetSize 640 480

# Set up a callback (using command/observer) to bring up the Tcl
# command GUI when the keypress-u (UserEvent) key is pressed.
iren AddObserver UserEvent {wm deiconify .vtkInteract}

# Here we go!
iren Initialize
#renWin Render
#iren Start
wm withdraw .
---- end mip.tcl-----

LM wrote:
> Hi all..
> Please could any one tell me how to get a *2D projection* from a 3D 
> Image Data..
> As I would like to represent projections in each x-y plane, y-zplane and 
> x-z plane..
> at least i need a class name..
> thanks in advance
> 
> ------------------------------------------------------------------------
> Yahoo! Photos
> Got holiday prints? See all the ways 
> 
> to get quality prints in your hands ASAP.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-- 
Hugo Gratama van Andel

  


		
---------------------------------
Do you Yahoo!?
 With a free 1 GB, there's more in store with Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060126/6f2ba8ac/attachment.htm>


More information about the vtkusers mailing list