[vtkusers] How extract a 2D slice from a volume using vtkImageReslice??

adexe adexe at ctm.ulpgc.es
Thu Sep 1 04:14:31 EDT 2005


Hi, I'm trying to extract a 2D slice from a volume.



I want to extract one slice from volume and view it ...but that viewer 
shows nothing at all.

my code:

/vtkImageReader reader
    reader SetDataByteOrderToLittleEndian
    reader SetDataScalarTypeToUnsignedShort
    reader SetFilePattern "%s.%03d"
    reader SetFilePrefix "/mnt/home/adexe/exeda/data/Images/I"
    reader SetDataExtent 0 255 0 255 1 160
    reader Update

set dims [[reader GetOutput] GetDimensions]
set d1 [lindex $dims 0]
set d2 [lindex $dims 1]


set slice 70

vtkExtractVOI voi
  voi SetInput [reader GetOutput]
  voi SetVOI 0 $d1 0 $d2 $slice $slice
  voi SetSampleRate 1 1 1
  voi Update

vtkImageViewer viewer
    viewer SetInput [voi GetOutput]
    viewer SetColorLevel 500
    viewer SetColorWindow 1000
    viewer Render

set render_widget [vtkTkImageViewerWidget $viewer_frame.r1 -width 255 
-height 255 -iv viewer]

::vtk::bind_tk_imageviewer_widget $render_widget   



pack $viewer_frame  -fill x
pack $render_widget  -side left -expand f




Thanks in advance
/



More information about the vtkusers mailing list