[vtkusers] (no subject)

永强 谭 yqtan at realss.com
Thu Jan 13 02:48:34 EST 2005


Hi, vtk users,

If you have received this message several times, that's because I have
received several bounces from vtk-bounces.

I have trouble drawing a line on an image. I used vtkImageReslice to extract
vtkImageData and then got vtkImageActor from it. The image displayed exactly
as what i had expected. 
Now I want a line to be displayed on the image, but I couldn't make it. If I
didn't show the image, the line is visible:
  ren AddProp imageSagittal; # comment this line will make the lineActor
visible
  ren AddActor lineActor

Any insight on this problem will be greately appriciated. The complete code 
in tcl is here:

package require vtk
package require vtkinteraction

set xspace 3.2
set yspace 3.2
set zspace 1.5

vtkVolume16Reader reader
  reader SetDataDimensions 64 64  
  reader SetDataByteOrderToLittleEndian  
  reader SetFilePrefix "$VTK_DATA_ROOT/headsq/quarter"   
  reader SetImageRange 1 93
  reader SetDataSpacing $xspace $yspace $zspace
  reader SetDataOrigin [expr -0.5 * $xspace * 63] [expr -0.5 * $yspace * 63]
[expr -0.5 * $zspace * 92] 
  reader Update 

vtkTransform transformSagittal
  transformSagittal RotateX 0
  transformSagittal RotateY -90
  transformSagittal RotateZ 0

vtkImageReslice resliceSagittal
  resliceSagittal SetInput [reader GetOutput]
  [resliceSagittal GetInput] SetUpdateExtentToWholeExtent
  resliceSagittal SetOutputSpacing 1 1 $xspace
  resliceSagittal SetResliceTransform transformSagittal
  resliceSagittal SetOutputExtent 0 511 0 511 0 0
  resliceSagittal SetResliceAxesOrigin 0.0 0.0 0.0
  resliceSagittal SetOutputDimensionality 2
  resliceSagittal InterpolateOn
  resliceSagittal Update

vtkImageMapToWindowLevelColors sagColors
  sagColors SetInput [resliceSagittal GetOutput]
  sagColors SetWindow 2000
  sagColors SetLevel 1000

vtkImageActor imageSagittal
  imageSagittal SetInput [sagColors GetOutput]
  
vtkRenderer ren

vtkRenderWindow renWin
  renWin AddRenderer ren
  renWin SetSize 512 512

vtkRenderWindowInteractor iren
  iren SetRenderWindow renWin

vtkInteractorStyleImage styleImage
  iren SetInteractorStyle styleImage

vtkLineSource lineSource
  lineSource SetResolution 20
  lineSource SetPoint1 0 255 0
  lineSource SetPoint2 512 255 0

vtkPolyDataMapper lineMapper
  lineMapper SetInput [lineSource GetOutput]

vtkActor lineActor
  lineActor SetMapper lineMapper

  ren AddProp imageSagittal; # comment this line will make the lineActor
visible
  ren AddActor lineActor

iren Initialize





More information about the vtkusers mailing list