Fw: [vtkusers] Problem with Texture of vtkImagePlaneWidget

Glauco glauco.silva at cenpra.gov.br
Thu May 25 09:23:18 EDT 2006



Hi Deam,
my english is not so good, but i will try to explain

I´m trying to use vtkImagePlaneWidget to take oblique images as below:

#####
volmap = vtkOpenGLVolumeRayCastMapper()
volmap.SetInput(imagedata)

volume = vtkVolume()
volume.SetMapper(volmap)

renVolume = vtkRenderer()
renVolume.AddVolume(volume)

renwin = vtkRenderWindow()
renwin.AddRenderer(renVolume)

paneVolume = wxVTKRenderWindowInteractor(frame,-1, size = (512,512),rw = renwin, stereo = 1)
...
iact = paneVolume._Iren

planeWidgetX = vtkImagePlaneWidget()
planeWidgetX.SetInput(imagedata) 
...
planeWidgetX.SetInteractor(iact)
####

But if I set VisibilityOff in planeWidget... when I set VisibityOn again, the volume raycast does not appear in front of planewidget. The planewidget get in the "first plane".

So i tried to put a planeSource to receive the texture of planewidget. 

i´m having problem with the two alternatives ( planewidget and planesource ). 
I need the interaction of planewidget and i need to take oblique images with this one.

-----Original Message-----

Hi Glauco, 

I'm not sure what your objective is,
but if what you are trying to do is to resample
your raw image data and then view one of
the orthogonal image planes (ie, sagittal, coronal,
axial), use a vtkImageResample on the raw
input followed by a vtkImageActor for viewing.
vtkImagePlaneWidget is designed for image
input, followed by interactive reslicing in
ANY orientation.  It seems to me that you are
trying to bypass the functionality of the widget
when you really do not have to do this.

Dean

 -----Original Message-----

I´m trying to paste a Texture of vtkImagePlaneWidget to vtkActor. But the texture seems to be not interpolated like it is in vtkImagePlaneWidget. What´s happening?
I tryed paste to vtkImagePlaneWidget a imageData and a reslice.GetOutput(). How can i get successful interpolation ?

extent of ImageData = (0,255,0,255,1,107)
spacing of ImageData = (0.95,0.95,1.5)

Part of my code:
    
    sp = min(spacing)

    extentInrterpolate = list(extent)
    extentInrterpolate[1] = int(extent[1]*(spacing[0]/sp))
    extentInrterpolate[3] = int(extent[3]*(spacing[1]/sp))
    extentInrterpolate[5] = int(extent[5]*(spacing[2]/sp))
    extentInrterpolate = tuple(extentInrterpolate)

    reslice = vtkImageReslice()
    reslice.SetInput(imageData)
    reslice.InterpolateOn()
    reslice.SetInterpolationModeToLinear()
    reslice.SetOutputSpacing(sp,sp,sp)
    reslice.SetOutputExtent(self.extent)
    
    planeWidgetX = vtk.vtkImagePlaneWidget()
    planeWidgetX.DisplayTextOn()
    planeWidgetX.SetInput(self.reslice.GetOutput()) # or imageData
    planeWidgetX.SetPlaneOrientationToXAxes()
    planeWidgetX.SetSliceIndex(0)
    planeWidgetX.SetPicker(picker)
    planeWidgetX.SetKeyPressActivationValue("x")
    planeWidgetX.TextureInterpolateOn()
    planeWidgetX.RestrictPlaneToVolumeOff()
    planeWidgetX.TextureVisibilityOff()
   
    prop1 = planeWidgetX.GetPlaneProperty()
    prop1.SetColor(1, 0, 0)
    
    planeSourceX = vtk.vtkPlaneSource()
    planeSourceX.SetOrigin(planeWidgetX.GetOrigin())
    planeSourceX.SetPoint1(planeWidgetX.GetPoint1())
    planeSourceX.SetPoint2(planeWidgetX.GetPoint2())
    planeSourceX.SetNormal(planeWidgetX.GetNormal())
    
    planeMapperX = vtk.vtkPolyDataMapper()
    planeMapperX.SetInput(self.planeSourceX.GetOutput())
    
    planeActorX = vtk.vtkActor()
    planeActorX.SetMapper(planeMapperX)
    planeActorX.VisibilityOff()
    planeActorX.SetTexture(planeWidgetX.GetTexture())
    planeActorX.SetProperty(planeWidgetX.GetTexturePlaneProperty())
    
    renVolume = vtk.vtkRenderer()
    renVolume.SetBackground(0,0,0) #0.2,0.4,0.6)
    renVolume.InteractiveOn()
    renVolume.AddActor(outlineActor)
    renVolume.AddActor(self.planeActorX)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060525/350fd843/attachment.htm>


More information about the vtkusers mailing list