[vtkusers] vtkImageActor disappearing

Nithiananthan, Sajendra Sajendra.Nithiananthan at rmp.uhn.on.ca
Fri Jun 8 11:23:02 EDT 2007


Hello,

I hate to respond to my own post, but minutes later I realised I could solve
the problem by changing the last bit to:

proc ChangeSlice {value} {
    puts $value
    imageActor SetDisplayExtent  $value $value 0 63 0 92
    ren1 ResetCameraClippingRange
    renWin Render
}


My apologies!

-----Original Message-----
From: vtkusers-bounces+sajendra.nithiananthan=rmp.uhn.on.ca at vtk.org
[mailto:vtkusers-bounces+sajendra.nithiananthan=rmp.uhn.on.ca at vtk.org]On
Behalf Of Nithiananthan, Sajendra
Sent: Friday, June 08, 2007 11:07 AM
To: 'vtkusers at vtk.org'
Subject: [vtkusers] vtkImageActor disappearing


Hello,

I am having a problem using vtkImageActor to display a single orthogonal
slice of a volume using "SetDisplayExtent" and then at runtime changing the
DisplayExtent.  When it is changed a few slices, the image actor disappears,
it will re-appear if I zoom by manually interacting with the window.  I
first saw this in C++ / FLTK applications, but confirmed that it happens in
a simple TCL script as well.  I can avoid this problem by using
vtkImageReslice but that seems like overkill.  I am using VTK version 5.0.2.
Thank you and please see sample script below.

-Sajendra N.

Sample TCL script:


package require vtk
package require vtkinteraction

vtkVolume16Reader v16
  v16 SetDataDimensions 64 64
  v16 SetDataByteOrderToLittleEndian
  v16 SetImageRange 1 93
  v16 SetDataSpacing 3.2 3.2 1.5
  v16 SetFilePrefix "$VTK_DATA_ROOT/Data/headsq/quarter"
  v16 Update

  set range [[v16 GetOutput] GetScalarRange]
  set min [lindex $range 0]
  set max [lindex $range 1]
  set diff [expr $max - $min]
  set slope [expr 255.0/$diff]
  set inter [expr -$slope*$min]
  set shift [expr $inter/$slope]

vtkImageShiftScale shifter
  shifter SetShift $shift
  shifter SetScale $slope
  shifter SetOutputScalarTypeToUnsignedChar
  shifter SetInputConnection [v16 GetOutputPort]
  shifter ReleaseDataFlagOff
  shifter Update


vtkImageActor imageActor
  imageActor SetInput [shifter GetOutput]
  imageActor VisibilityOn
  imageActor SetDisplayExtent  31 31 0 63 0 92
  imageActor InterpolateOff


vtkRenderer ren1
   ren1 SetBackground 0.5 0.5 0.5

vtkRenderWindow renWin
  renWin AddRenderer ren1
  renWin SetSize 640 480


vtkInteractorStyleImage interactor
vtkRenderWindowInteractor iren
  iren SetInteractorStyle interactor
  iren SetRenderWindow renWin

ren1 AddViewProp imageActor

iren AddObserver UserEvent {wm deiconify .vtkInteract}
renWin Render

[ren1 GetActiveCamera] SetViewUp 0 1 0
[ren1 GetActiveCamera] Azimuth 270
[ren1 GetActiveCamera] Roll 270
[ren1 GetActiveCamera] Dolly 1.7
ren1 ResetCameraClippingRange

renWin Render

# Prevent the tk window from showing up then start the event loop.
#wm withdraw .

frame .f
label .f.l -text "Slice"
scale .f.s -from 0 -to 63 -orient horizontal -command ChangeSlice
.f.s set 31

pack .f.l .f.s
pack .f


proc ChangeSlice {value} {
    puts $value
    imageActor SetDisplayExtent  $value $value 0 63 0 92
    renWin Render
}

This e-mail may contain confidential and/or privileged information for the
sole use of the intended recipient. Any review or distribution by anyone
other than the person for whom it was originally intended is strictly
prohibited. If you have received this e-mail in error, please contact the
sender and delete all copies. Opinions, conclusions or other information
contained in this e-mail may not be that of the organization.
_______________________________________________
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

This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this e-mail may not be that of the organization.



More information about the vtkusers mailing list