[vtkusers] problems with vtkExtractVOI (?)

Chr. Rossmanith cr at neuro.ma.uni-heidelberg.de
Thu Jun 21 11:01:02 EDT 2001


Hi,

some days ago I had problems displaying a testimage with stripes in
shades of red. Meanwhile this works with help from this list and it
should be no surprise that I'm now interested in real data...

I have an image volume (unsigned short) stored as structured points in
vtk format. If I replace the tiff reader from the testimage example with
an structured points reader and adjust the lookup table the first slice
of the volume is displayed as expected.

The next idea is to select a different slice than the first using the
VOI extractor. Now everything is black :-(    And I have absolutely no
idea, why. All slices have the same value range, so I think that the
same lookup table should be fine for the volume and a single slice.
Maybe vtkExtractVOI changes something and causes the trouble...

Below you find my TCL script.


Thank you for your help,

Christina Rossmanith


-------------------------------- snip
-------------------------------------------
source vtkInt.tcl

vtkStructuredPointsReader reader
  reader SetFileName /opt2/tmp/gahn/perf.vtk
  reader Update

#
# determine dimensions of the input volume
#
set dims [[reader GetOutput] GetDimensions]
set d1 [lindex $dims 0]
set d2 [lindex $dims 1]

#
# determine min and max of the input volume
#
set range [[reader GetOutput] GetScalarRange]
set min [lindex $range 0]
set max [lindex $range 1]

#
# extract one of the slices in the input volume
#
set slice 5
vtkExtractVOI voi
  voi SetInput [reader GetOutput]
  voi SetVOI 0 $d1 0 $d2 $slice $slice
  voi Update


#
# rendering stuff
#
vtkRenderer ren1
vtkRenderWindow renWin
  renWin AddRenderer ren1
vtkRenderWindowInteractor iren
  iren SetRenderWindow renWin

#
# set up lookup table
#
set alpha  0.7
vtkLookupTable    lut
   lut   SetNumberOfColors [expr $max + 1]
   lut   SetTableRange $min $max
   lut   Build

   for {set i $min} {$i < 1200} {incr i} {
       lut  SetTableValue $i 0 0 0 1
   }
   for {set i 1200} {$i < 1400} {incr i} {
       set tval [expr [expr $i - 1200.0]/200.0]
       lut  SetTableValue $i $tval 0 0 $alpha
   }
   for {set i 1400} {$i <= $max} {incr i} {
       lut  SetTableValue $i 0 0 0 1
   }


vtkImageMapToColors colmap
#    colmap SetInput [reader GetOutput]                              <-
this does work
    colmap SetInput [voi
GetOutput]                                       <- this does not work
    colmap SetLookupTable lut

vtkImageActor myActor
    myActor SetInput [colmap GetOutput]

ren1 AddActor myActor
    renWin SetSize 500 500

renWin Render

wm withdraw .






More information about the vtkusers mailing list