Top Level Namespace

Defined Under Namespace

Modules: Vtk Classes: GtkGLExtVTKRenderWindowInteractor, GtkVTKRenderWindow, GtkVTKRenderWindowBase, VtkTkImageViewerWidget

Constant Summary collapse

VTK_LARGE_FLOAT =

Some constants used throughout code

1.0e+38
VTK_LARGE_INTEGER =

2^31 - 1

2147483647
VTK_VOID =

These types are returned by GetDataType to indicate pixel type.

0
VTK_BIT =
1
VTK_CHAR =
2
VTK_UNSIGNED_CHAR =
3
VTK_SHORT =
4
VTK_UNSIGNED_SHORT =
5
VTK_INT =
6
VTK_UNSIGNED_INT =
7
VTK_LONG =
8
VTK_UNSIGNED_LONG =
9
VTK_FLOAT =
10
VTK_DOUBLE =
11
VTK_ID_TYPE =
12
VTK_STRING =

These types are not currently supported by GetDataType, but are for completeness.

13
VTK_OPAQUE =
14
VTK_BIT_MIN =

Some constant required for correct template performance

0
VTK_BIT_MAX =
1
VTK_CHAR_MIN =
-128
VTK_CHAR_MAX =
127
VTK_UNSIGNED_CHAR_MIN =
0
VTK_UNSIGNED_CHAR_MAX =
255
VTK_SHORT_MIN =
-32768
VTK_SHORT_MAX =
32767
VTK_UNSIGNED_SHORT_MIN =
0
VTK_UNSIGNED_SHORT_MAX =
65535
VTK_INT_MIN =
(-VTK_LARGE_INTEGER-1)
VTK_INT_MAX =
VTK_LARGE_INTEGER
VTK_LONG_MIN =

VTK_UNSIGNED_INT_MAX = 4294967295

(-VTK_LARGE_INTEGER-1)
VTK_LONG_MAX =
VTK_LARGE_INTEGER
VTK_FLOAT_MIN =

VTK_UNSIGNED_LONG_MAX = 4294967295

-VTK_LARGE_FLOAT
VTK_FLOAT_MAX =
VTK_LARGE_FLOAT
VTK_DOUBLE_MIN =
-1.0e+99
VTK_DOUBLE_MAX =
1.0e+99
VTK_POLY_DATA =

These types are returned to distinguish dataset types

0
VTK_STRUCTURED_POINTS =
1
VTK_STRUCTURED_GRID =
2
VTK_RECTILINEAR_GRID =
3
VTK_UNSTRUCTURED_GRID =
4
VTK_PIECEWISE_FUNCTION =
5
VTK_IMAGE_DATA =
6
VTK_DATA_OBJECT =
7
VTK_DATA_SET =
8
VTK_POINT_SET =
9
VTK_OK =

These types define error codes for vtk functions

1
VTK_ERROR =
2
VTK_ARIAL =

These types define different text properties

0
VTK_COURIER =
1
VTK_TIMES =
2
VTK_TEXT_LEFT =
0
VTK_TEXT_CENTERED =
1
VTK_TEXT_RIGHT =
2
VTK_TEXT_BOTTOM =
0
VTK_TEXT_TOP =
2
VTK_TEXT_GLOBAL_ANTIALIASING_SOME =
0
VTK_TEXT_GLOBAL_ANTIALIASING_NONE =
1
VTK_TEXT_GLOBAL_ANTIALIASING_ALL =
2
VTK_LUMINANCE =
1
VTK_LUMINANCE_ALPHA =
2
VTK_RGB =
3
VTK_RGBA =
4
VTK_COLOR_MODE_DEFAULT =
0
VTK_COLOR_MODE_MAP_SCALARS =
1
VTK_NEAREST_INTERPOLATION =

Constants for InterpolationType

0
VTK_LINEAR_INTERPOLATION =
1
VTK_MAX_VRCOMP =

For volume rendering

4

Instance Method Summary collapse

Instance Method Details

#mainObject



564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
# File 'lib/VTK/gtk/GtkVTKRenderWindow.rb', line 564

def main

  Gtk.init
  Gtk::GL.init

  # The main window
  window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
  window.set_title("A GtkVTKRenderWindow Demo!")
  window.signal_connect("destroy"){ Gtk.main_quit }
  window.signal_connect("delete_event"){ Gtk.main_quit }
  window.set_border_width(10)

  # A VBox into which widgets are packed.
  vbox = Gtk::VBox.new(false, 3)
  window.add(vbox)
  vbox.show

  # The GtkVTKRenderWindow
  gvtk = GtkVTKRenderWindow.new
  #gvtk.SetDesiredUpdateRate(1000)
  gvtk.set_usize(400, 400)
  vbox.pack_start(gvtk)
  gvtk.show

  # The VTK stuff.
  cone = Vtk::ConeSource.new
  cone.SetResolution(80)
  coneMapper = Vtk::PolyDataMapper.new
  coneMapper.SetInput(cone.GetOutput)
  #coneActor = Vtk::LODActor.new
  coneActor = Vtk::Actor.new
  coneActor.SetMapper(coneMapper)    
  coneActor.GetProperty.SetColor(0.5, 0.5, 1.0)
  ren = Vtk::Renderer.new
  gvtk.GetRenderWindow.AddRenderer(ren)
  ren.AddActor(coneActor)

  # A simple quit button
  quit = Gtk::Button.new("Quit!")
  quit.signal_connect("clicked"){ Gtk.main_quit }
  vbox.pack_start(quit)
  quit.show

  # show the main window && start event processing.
  window.show
  Gtk.main
end

#vtkImageScalarTypeNameMacro(type) ⇒ Object



119
120
121
# File 'lib/VTK/util/vtkConstants.rb', line 119

def vtkImageScalarTypeNameMacro(type)
  return __vtkTypeNameDict[type]
end

#vtkRenderWidgetConeExampleObject




453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/VTK/tk/vtkTkRenderWidget.rb', line 453

def vtkRenderWidgetConeExample
=begin
    Like it says, just a simple example
=end
    # create root window
    root = TkRoot.new

    # create vtkTkRenderWidget
    pane = Vtk::TkRenderWidget.new(root,'width'=>300,'height'=>300)

    ren = Vtk::Renderer.new
    pane.GetRenderWindow.AddRenderer(ren)

    cone = Vtk::ConeSource.new
    cone.SetResolution(8)

    coneMapper = Vtk::PolyDataMapper.new
    coneMapper.SetInput(cone.GetOutput)

    coneActor = Vtk::Actor.new
    coneActor.SetMapper(coneMapper)

    ren.AddActor(coneActor)

    # pack the pane into the tk root
    pane.pack

    # start the tk mainloop
    Tk.mainloop
end

#vtkRenderWindowInteractorConeExampleObject




357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/VTK/tk/vtkTkRenderWindowInteractor.rb', line 357

def vtkRenderWindowInteractorConeExample
=begin
    Like it says, just a simple example
=end
  # create root window
  root = TkRoot.new

  # create vtkTkRenderWidget
  pane = Vtk::TkRenderWindowInteractor.new(root, 'width'=>300, 'height'=>300)
  pane.Initialize

  pane.AddObserver("ExitEvent", Proc.new{|o,e,q| exit })

  ren = Vtk::Renderer.new
  pane.GetRenderWindow.AddRenderer(ren)

  cone = Vtk::ConeSource.new
  cone.SetResolution(8)

  coneMapper = Vtk::PolyDataMapper.new
  coneMapper.SetInput(cone.GetOutput)

  coneActor = Vtk::Actor.new
  coneActor.SetMapper(coneMapper)

  ren.AddActor(coneActor)

  # pack the pane into the tk root
  pane.pack('fill'=>'both', 'expand'=>1)
  pane.Start

  # start the tk mainloop
  root.mainloop
end