[vtkusers] Problems with vtkImageCacheFilter

Pepe Sanchez ps070 at yahoo.com
Wed Jan 30 15:46:04 EST 2002


Hi VTK Users!

I am developing a display for time sequenced medical
images (2D) and I need speed for display them at good
rate (>30 fps). I tried to use vtkImageCacheFilter to
"store" processed frames, but the filter output is
always the last image inserted.

Can anyone help me? Thanks

PD: Testing_vtkImageCacheFilter.tcl

------------------------------------------------------
package require vtk
package require vtkinteraction
package require vtktesting

# Image pipeline

vtkImageReader reader
reader SetDataByteOrderToLittleEndian
reader SetDataExtent 0 255 0 255 1 93
reader SetFilePrefix "$VTK_DATA/fullHead/headsq"
reader SetDataMask 0x7fff

# A smoothing to test speed (processed frames)
vtkImageGaussianSmooth smooth
smooth SetInput [reader GetOutput]
smooth SetDimensionality 3
smooth SetStandardDeviations 1 1 5

# The cache
vtkImageCacheFilter cache
cache SetInput [smooth GetOutput]
#CacheSize is 10 (default)
#cache SetCacheSize 6

# Create a text mapper and actor to display the frame
number
vtkTextMapper textMapper
    textMapper SetFontFamilyToArial
    textMapper SetFontSize 12
    textMapper BoldOn
    vtkActor2D textActor

    textActor SetMapper textMapper
    [textActor GetProperty] SetColor 1 1 1
    textActor SetPosition 5 5

vtkImageViewer viewer
#viewer DebugOn
viewer SetInput [cache GetOutput]
viewer SetColorWindow 2000
viewer SetColorLevel 1000

[viewer GetRenderer] AddActor2D textActor
for {set i 20} {$i <= 25} {incr i} {
  viewer SetZSlice $i
  textMapper SetInput "Frame: [viewer GetZSlice]"
  viewer Render
}
for {set i 25} {$i >= 20} {incr i -1} {
  viewer SetZSlice $i
  textMapper SetInput "Frame: [viewer GetZSlice]"
  viewer Render
}
textActor VisibilityOff

vtkRenderWindowInteractor iren
  iren SetRenderWindow [viewer GetRenderWindow]

iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren AddObserver ExitEvent {exit}

wm withdraw .



__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com



More information about the vtkusers mailing list