[Insight-users] Multiple vtk3DSImporter importers in a render window

Dora Szasz dora.szasz at yahoo.com
Sat May 12 07:05:59 EDT 2012


Hello itk users,



How can I integrate in a render window multiple vtk3DS importers?
I have tried the following code in Tcl, but I have received the following error: "Object named importer could not find requested method: GetOutputPort", so the importer is not behaving like a reader.

How can I do this? 


Thank you a lot,
Dora Szasz 

package require vtk
package require vtkinteraction

# Create the importer and read a file
vtk3DSImporter importer
  importer ComputeNormalsOn
  importer SetFileName "204_c_01_v14a_body_3.3ds"
  importer Read

vtk3DSImporter importer2
  importer2 ComputeNormalsOff
  importer2 SetFileName "216_03_v6f_corp-ns3.3ds"
  importer2 Read
  
vtkPolyDataNormals normals
  normals SetInputConnection [importer GetOutputPort]
  normals FlipNormalsOn
vtkPolyDataMapper importerMapper
  importerMapper SetInputConnection [normals GetOutputPort]
vtkActor importerActor
importerActor SetMapper importerMapper
importerActor SetOrigin 2 1 3
importerActor SetPosition 2.25 0 0
[importerActor GetProperty] SetColor 1 0 1
vtkPolyDataNormals normals2
  normals2 SetInputConnection [importer2 GetOutputPort]
  normals2 FlipNormalsOn
vtkPolyDataMapper importer2Mapper
  importer2Mapper2 SetInputConnection [normals2 GetOutputPort]
vtkActor importer2Actor
importer2Actor SetMapper importer2Mapper
importer2Actor SetPosition 0 0 0.25
[importer2Actor GetProperty] SetColor 0 1 0
vtkRenderer ren1
vtkRendererWindow renWin
renWin AddRenderer ren1
vtkRendererWindowInteractor iren
iren SetRenderWindow renWin
ren1 AddActor importerActor
ren1 AddActor importer2Actor
ren1 SetBackground 0.1 0.2 0.4
renWin SetSize 200 200

# Set up the camera to get a particular view of the scene
vtkCamera camera
    camera SetClippingRange 21.9464 30.0179
    camera SetFocalPoint 3.49221 2.28844 -0.970866
    camera SetPosition 3.49221 2.28844 24.5216
    camera SetViewAngle 30
    camera SetViewUp 0 1 0
ren1 SetActiveCamera camera

# Set the user method (bound to key 'u')
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
renWin Render

# Withdraw the default tk window
wm withdraw .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120512/e60200dc/attachment.htm>


More information about the Insight-users mailing list