diff -uNr VTK_org/CMake/cmVTKWrapRuby2Command.c VTK/CMake/cmVTKWrapRuby2Command.c
--- VTK_org/CMake/cmVTKWrapRuby2Command.c	1970-01-01 09:00:00.000000000 +0900
+++ VTK/CMake/cmVTKWrapRuby2Command.c	2009-01-25 13:53:15.000000000 +0900
@@ -0,0 +1,329 @@
+/* this is a CMake loadable command to wrap vtk objects into Ruby */
+
+#include "cmCPluginAPI.h"
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+typedef struct 
+{
+  char *LibraryName;
+  int NumberWrapped;
+  void **SourceFiles;
+  char **HeaderFiles;
+} cmVTKWrapRubyData;
+
+/* this roputine creates the init file */
+static void CreateInitFile(cmLoadedCommandInfo *info,
+                           void *mf, const char *kitName, 
+                           int numClasses, const char **classes) 
+{
+  /* we have to make sure that the name is the correct case */
+  int i;
+  char *tempOutputFile;  
+  char *outFileName = 
+    (char *)malloc(strlen(info->CAPI->GetCurrentOutputDirectory(mf)) + 
+                   strlen(kitName) + 10);
+  FILE *fout;
+  
+  sprintf(outFileName,"%s/%sInit.cxx",
+          info->CAPI->GetCurrentOutputDirectory(mf), kitName);
+  
+  tempOutputFile = (char *)malloc(strlen(outFileName) + 5);
+  sprintf(tempOutputFile,"%s.tmp",outFileName);
+  fout = fopen(tempOutputFile,"w");
+  if (!fout)
+    {
+    return;
+    }
+  
+  fprintf(fout,"// Generated by cmVTKWrapRubyCommand2 in VTK/CMake\n\n");
+  fprintf(fout,"#include \"vtkRuby.h\"\n\n");
+  fprintf(fout,"#include \"vtkSystemIncludes.h\"\n");
+  fprintf(fout,"#include <string.h>\n");
+  fprintf(fout,"// Handle compiler warning messages, etc.\n"
+          "#if defined( _MSC_VER ) && !defined(VTK_DISPLAY_WIN32_WARNINGS)\n"
+          "#pragma warning ( disable : 4706 )\n"
+          "#endif // Windows Warnings \n\n");
+  
+  for (i = 0; i < numClasses; i++)
+    {
+#ifdef _WIN32
+    fprintf(fout,"extern  \"C\" {__declspec( dllexport) void Init_%s(VALUE); }\n",classes[i]);
+#else
+    fprintf(fout,"extern  \"C\" {void Init_%s(VALUE); }\n",classes[i]);
+#endif
+    }
+  
+#ifdef _WIN32
+  fprintf(fout,"extern  \"C\" {__declspec( dllexport) void Init_%s();}\n\n",kitName);
+#else
+  fprintf(fout,"extern  \"C\" {void Init_%s();}\n\n",kitName);
+#endif
+  
+  
+  /* module init function */
+  fprintf(fout,"void Init_%s()\n{\n",kitName);
+  fprintf(fout,"  VALUE mVtk = rb_define_module(\"VTK\");\n");
+  
+  for (i = 0; i < numClasses; i++)
+    {
+    fprintf(fout,"  Init_%s(mVtk);\n", classes[i]);
+    }
+  fprintf(fout,"}\n\n");
+  fclose(fout);
+
+  /* copy the file if different */
+  info->CAPI->CopyFileIfDifferent(tempOutputFile, outFileName);
+  info->CAPI->RemoveFile(tempOutputFile);
+}
+
+/* do almost everything in the initial pass */
+static int InitialPass(void *inf, void *mf, int argc, char *argv[])
+{
+  cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
+  int i;
+  int newArgc;
+  char **newArgv;
+  int numClasses = 0;
+  char **classes = 0;
+  int numWrapped = 0;
+  cmVTKWrapRubyData *cdata = 
+    (cmVTKWrapRubyData *)malloc(sizeof(cmVTKWrapRubyData));
+  const char *cdir = info->CAPI->GetCurrentDirectory(mf);
+  const char *def = 0;
+  int sourceListSize = 0;
+  char *sourceListValue = 0;
+  char *newName;
+  void *cfile = 0;
+
+  if(argc < 3 )
+    {
+    info->CAPI->SetError(info, "called with incorrect number of arguments");
+    return 0;
+    }
+  
+  info->CAPI->ExpandSourceListArguments(mf, argc, argv, 
+                                        &newArgc, &newArgv, 2);
+  
+  /* Now check and see if the value has been stored in the cache */
+  /* already, if so use that value and don't look for the program */
+  if(!info->CAPI->IsOn(mf,"VTK_WRAP_RUBY"))
+    {
+    info->CAPI->FreeArguments(newArgc, newArgv);
+    return 1;
+    }
+
+  /* keep the library name */
+  classes = (char **)malloc(sizeof(char *)*newArgc);
+  cdata->LibraryName = strdup(newArgv[0]);
+  cdata->SourceFiles = (void **)malloc(sizeof(void *)*newArgc);
+  cdata->HeaderFiles = (char **)malloc(sizeof(char *)*newArgc);
+
+  /* was the list already populated */
+  def = info->CAPI->GetDefinition(mf, newArgv[1]);
+
+  /* Calculate size of source list.  */
+  /* Start with list of source files.  */
+  sourceListSize = info->CAPI->GetTotalArgumentSize(newArgc,newArgv);
+  /* Add enough to extend the name of each class. */
+  sourceListSize += newArgc*strlen("Ruby.cxx");
+  /* Add enough to include the def and init file.  */
+  sourceListSize += def?strlen(def):0;
+  sourceListSize += strlen(";Init.cxx");
+
+  /* Allocate and initialize the source list.  */
+  sourceListValue = (char *)malloc(sourceListSize);
+  if (def)
+    {
+    sprintf(sourceListValue,"%s;%sInit.cxx",def,newArgv[0]);
+    }
+  else
+    {
+      /* Don't include the Init.cxx file in the library on OSX */
+      /* It is linked into a MODULE separate from the rest of the dylib */
+#if defined(__APPLE__)
+    sprintf(sourceListValue,"");
+#else
+    sprintf(sourceListValue,"%sInit.cxx",newArgv[0]);
+#endif
+    }
+
+  /* get the classes for this lib */
+  for(i = 2; i < newArgc; ++i)
+    {   
+    void *curr = info->CAPI->GetSource(mf,newArgv[i]);
+    
+    /* if we should wrap the class */
+    if (!curr || 
+        !info->CAPI->SourceFileGetPropertyAsBool(curr,"WRAP_EXCLUDE"))
+      {
+      void *file = info->CAPI->CreateSourceFile();
+      char *srcName;
+      char *hname;
+      char *pathName;
+      srcName = info->CAPI->GetFilenameWithoutExtension(newArgv[i]);
+      pathName = info->CAPI->GetFilenamePath(newArgv[i]);
+      if (curr)
+        {
+        int abst = info->CAPI->SourceFileGetPropertyAsBool(curr,"ABSTRACT");
+        info->CAPI->SourceFileSetProperty(file,"ABSTRACT",
+                                          (abst ? "1" : "0"));
+        }
+      classes[numClasses] = strdup(srcName);
+      numClasses++;
+      newName = (char *)malloc(strlen(srcName)+7);
+      sprintf(newName,"%sRuby",srcName);
+      info->CAPI->SourceFileSetName2(file, newName, 
+                                     info->CAPI->GetCurrentOutputDirectory(mf),
+                                     "cxx",0);
+
+      if (strlen(pathName) > 1)
+        {
+        hname = (char *)malloc(strlen(pathName) + strlen(srcName) + 4);
+        sprintf(hname,"%s/%s.h",pathName,srcName);
+        }
+      else
+        {
+        hname = (char *)malloc(strlen(cdir) + strlen(srcName) + 4);
+        sprintf(hname,"%s/%s.h",cdir,srcName);
+        }
+      /* add starting depends */
+      info->CAPI->SourceFileAddDepend(file,hname);
+      info->CAPI->AddSource(mf,file);
+      cdata->SourceFiles[numWrapped] = file;
+      cdata->HeaderFiles[numWrapped] = hname;
+      numWrapped++;
+      if(sourceListValue[0])
+        {
+        /* This is not the first value, add a separator. */
+        strcat(sourceListValue,";");
+        }
+      strcat(sourceListValue,newName);
+      strcat(sourceListValue,".cxx");        
+      free(newName);
+      info->CAPI->Free(srcName);
+      info->CAPI->Free(pathName);
+      }
+    }
+  
+  /* add the init file */
+  cfile = info->CAPI->CreateSourceFile();
+  info->CAPI->SourceFileSetProperty(cfile,"ABSTRACT","0");
+  newName = (char *)malloc(strlen(newArgv[0]) + 5);
+  sprintf(newName,"%sInit",newArgv[0]);
+  CreateInitFile(info,mf,newArgv[0],numClasses,classes);
+  info->CAPI->SourceFileSetName2(cfile, newName, 
+                                 info->CAPI->GetCurrentOutputDirectory(mf),
+                                 "cxx",0);
+  free(newName);
+  info->CAPI->AddSource(mf,cfile);
+
+  cdata->NumberWrapped = numWrapped;
+  info->CAPI->SetClientData(info,cdata);
+
+  info->CAPI->AddDefinition(mf, newArgv[1], sourceListValue);
+  info->CAPI->FreeArguments(newArgc, newArgv);
+  free(sourceListValue);
+  return 1;
+}
+  
+  
+static void FinalPass(void *inf, void *mf) 
+{
+  cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
+  /* get our client data from initial pass */
+  cmVTKWrapRubyData *cdata = 
+    (cmVTKWrapRubyData *)info->CAPI->GetClientData(info);
+  
+  /* first we add the rules for all the .h to Ruby.cxx files */
+  const char *wruby = "${VTK_WRAP_RUBY_EXE}";
+  const char *hints = info->CAPI->GetDefinition(mf,"VTK_WRAP_HINTS");
+  const char *args[4];
+  const char *depends[2];
+  int i;
+  int numDepends, numArgs;
+  const char *cdir = info->CAPI->GetCurrentDirectory(mf);
+  
+  /* If the first pass terminated early, we have nothing to do.  */
+  if(!cdata)
+    {
+    return;
+    }
+  
+  /* wrap all the .h files */
+  depends[0] = wruby;
+  numDepends = 1;
+  if (hints)
+    {
+    depends[1] = hints;
+    numDepends++;
+    }
+  for(i = 0; i < cdata->NumberWrapped; i++)
+    {
+    char *res;
+    const char *srcName = info->CAPI->SourceFileGetSourceName(cdata->SourceFiles[i]);
+    args[0] = cdata->HeaderFiles[i];
+    numArgs = 1;
+    if (hints)
+      {
+      args[1] = hints;
+      numArgs++;
+      }
+    args[numArgs] = 
+      (info->CAPI->SourceFileGetPropertyAsBool(cdata->SourceFiles[i],"ABSTRACT") ?"0" :"1");
+    numArgs++;
+    res = (char *)malloc(strlen(info->CAPI->GetCurrentOutputDirectory(mf)) + 
+                         strlen(srcName) + 6);
+    sprintf(res,"%s/%s.cxx",info->CAPI->GetCurrentOutputDirectory(mf),srcName);
+    args[numArgs] = res;
+    numArgs++;
+    info->CAPI->AddCustomCommand(mf, args[0],
+                       wruby, numArgs, args, numDepends, depends, 
+                       1, &res, cdata->LibraryName);
+    free(res);
+    }
+}
+
+static void Destructor(void *inf) 
+{
+  int i;
+  cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
+  /* get our client data from initial pass */
+  cmVTKWrapRubyData *cdata = 
+    (cmVTKWrapRubyData *)info->CAPI->GetClientData(info);
+  if (cdata)
+    {
+    for (i = 0; i < cdata->NumberWrapped; ++i)
+      {              
+      info->CAPI->DestroySourceFile(cdata->SourceFiles[i]);
+      free(cdata->HeaderFiles[i]);
+      }
+    free(cdata->SourceFiles);
+    free(cdata->HeaderFiles);
+    free(cdata->LibraryName);
+    free(cdata);
+    }
+}
+
+static const char* GetTerseDocumentation() 
+{
+  return "Create Ruby Wrappers.";
+}
+
+static const char* GetFullDocumentation()
+{
+  return
+    "VTK_WRAP_RUBY(resultingLibraryName SourceListName SourceLists ...)";
+}
+
+void CM_PLUGIN_EXPORT VTK_WRAP_RUBY2Init(cmLoadedCommandInfo *info)
+{
+  info->InitialPass = InitialPass;
+  info->FinalPass = FinalPass;
+  info->Destructor = Destructor;
+  info->m_Inherited = 0;
+  info->GetTerseDocumentation = GetTerseDocumentation;
+  info->GetFullDocumentation = GetFullDocumentation;  
+  info->Name = "VTK_WRAP_RUBY2";
+}
diff -uNr VTK_org/CMake/KitCommonBlock.cmake VTK/CMake/KitCommonBlock.cmake
--- VTK_org/CMake/KitCommonBlock.cmake	2005-08-25 08:38:58.000000000 +0900
+++ VTK/CMake/KitCommonBlock.cmake	2009-01-25 13:53:15.000000000 +0900
@@ -71,6 +71,46 @@
   TARGET_LINK_LIBRARIES(vtk${KIT}Python vtk${KIT}PythonD)
 ENDIF (VTK_WRAP_PYTHON)
 
+# if we are wrapping into Ruby then add the library and extra
+# source files
+#
+IF (VTK_WRAP_RUBY)
+  # Create custom commands to generate the ruby wrappers for this kit.
+  VTK_WRAP_RUBY3(vtk${KIT}Ruby KitRuby_SRCS "${Kit_SRCS}")
+
+  # Create a shared library containing the ruby wrappers.  Executables
+  # can link to this but it is not directly loaded dynamically as a
+  # module.
+  ADD_LIBRARY(vtk${KIT}RubyD ${KitRuby_SRCS} ${Kit_RUBY_EXTRA_SRCS})
+  TARGET_LINK_LIBRARIES(vtk${KIT}RubyD vtk${KIT} ${KIT_RUBY_LIBS})
+  IF(NOT VTK_INSTALL_NO_LIBRARIES)
+    INSTALL_TARGETS(${VTK_INSTALL_LIB_DIR} vtk${KIT}RubyD)
+  ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
+  SET(KIT_LIBRARY_TARGETS ${KIT_LIBRARY_TARGETS} vtk${KIT}RubyD)
+
+  # On some UNIX platforms the ruby library is static and therefore
+  # should not be linked into the shared library.  Instead the symbols
+  # are exported from the ruby executable so that they can be used by
+  # shared libraries that are linked or loaded.  On Windows and OSX we
+  # want to link to the ruby libray to resolve its symbols
+  # immediately.
+  IF(WIN32 OR APPLE)
+    TARGET_LINK_LIBRARIES (vtk${KIT}RubyD ${VTK_RUBY_LIBRARIES})
+  ENDIF(WIN32 OR APPLE)
+
+  # Add dependencies that may have been generated by VTK_WRAP_RUBY3 to
+  # the ruby wrapper library.  This is needed for the
+  # pre-custom-command hack in Visual Studio 6.
+  IF(KIT_RUBY_DEPS)
+    ADD_DEPENDENCIES(vtk${KIT}Ruby ${KIT_RUBY_DEPS})
+  ENDIF(KIT_RUBY_DEPS)
+
+  # Create a ruby module that can be loaded dynamically.  It links to
+  # the shared library containing the wrappers for this kit.
+  ADD_LIBRARY(vtk${KIT}Ruby MODULE vtk${KIT}RubyInit.cxx)
+  TARGET_LINK_LIBRARIES(vtk${KIT}Ruby vtk${KIT}RubyD)
+ENDIF (VTK_WRAP_RUBY)
+
 # if we are wrapping into Java then add the library and extra
 # source files
 #
@@ -104,7 +144,8 @@
   LocalUserOptionsMacro( "${Kit_SRCS}"       "${Kit_EXTRA_SRCS}"
                          "${KitTCL_SRCS}"    "${Kit_TCL_EXTRA_SRCS}"
                          "${KitJava_SRCS}"   "${Kit_JAVA_EXTRA_SRCS}"
-                         "${KitPython_SRCS}" "${Kit_PYTHON_EXTRA_SRCS}")
+                         "${KitPython_SRCS}" "${Kit_PYTHON_EXTRA_SRCS}"
+                         "${KitRuby_SRCS}" "${Kit_RUBY_EXTRA_SRCS}")
 ENDIF(LOCALUSERMACRODEFINED)
 
 
diff -uNr VTK_org/CMake/vtkWrapRuby.cmake VTK/CMake/vtkWrapRuby.cmake
--- VTK_org/CMake/vtkWrapRuby.cmake	1970-01-01 09:00:00.000000000 +0900
+++ VTK/CMake/vtkWrapRuby.cmake	2009-01-25 13:53:15.000000000 +0900
@@ -0,0 +1,142 @@
+#
+# a cmake implementation of the Wrap Ruby command
+#
+
+MACRO(VTK_WRAP_RUBY3 TARGET SRC_LIST_NAME SOURCES)
+  IF(NOT VTK_WRAP_RUBY_INIT_EXE)
+    MESSAGE(SEND_ERROR "VTK_WRAP_RUBY_INIT_EXE not specified when calling VTK_WRAP_RUBY3")
+  ENDIF(NOT VTK_WRAP_RUBY_INIT_EXE)
+  IF(NOT VTK_WRAP_RUBY_EXE)
+    MESSAGE(SEND_ERROR "VTK_WRAP_RUBY_EXE not specified when calling VTK_WRAP_RUBY3")
+  ENDIF(NOT VTK_WRAP_RUBY_EXE)
+  # for new cmake use the new custom commands
+  IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
+
+    # Initialize the custom target counter.
+    IF(VTK_WRAP_RUBY_NEED_CUSTOM_TARGETS)
+      SET(VTK_WRAP_RUBY_CUSTOM_COUNT "")
+      SET(VTK_WRAP_RUBY_CUSTOM_NAME ${TARGET})
+      SET(VTK_WRAP_RUBY_CUSTOM_LIST)
+    ENDIF(VTK_WRAP_RUBY_NEED_CUSTOM_TARGETS)
+
+    # start writing the input file for the init file
+    SET(VTK_WRAPPER_INIT_DATA "${TARGET}")
+    
+    # For each class
+    FOREACH(FILE ${SOURCES})
+      # should we wrap the file?
+      GET_SOURCE_FILE_PROPERTY(TMP_WRAP_EXCLUDE ${FILE} WRAP_EXCLUDE)
+      
+      # if we should wrap it
+      IF (NOT TMP_WRAP_EXCLUDE)
+        
+        # what is the filename without the extension
+        GET_FILENAME_COMPONENT(TMP_FILENAME ${FILE} NAME_WE)
+        
+        # the input file might be full path so handle that
+        GET_FILENAME_COMPONENT(TMP_FILEPATH ${FILE} PATH)
+        
+        # compute the input filename
+        IF (TMP_FILEPATH)
+          SET(TMP_INPUT ${TMP_FILEPATH}/${TMP_FILENAME}.h) 
+        ELSE (TMP_FILEPATH)
+          SET(TMP_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${TMP_FILENAME}.h)
+        ENDIF (TMP_FILEPATH)
+        
+        # is it abstract?
+        GET_SOURCE_FILE_PROPERTY(TMP_ABSTRACT ${FILE} ABSTRACT)
+        IF (TMP_ABSTRACT)
+          SET(TMP_CONCRETE 0)
+        ELSE (TMP_ABSTRACT)
+          SET(TMP_CONCRETE 1)
+        ENDIF (TMP_ABSTRACT)
+
+        # add the info to the init file
+        SET(VTK_WRAPPER_INIT_DATA
+          "${VTK_WRAPPER_INIT_DATA}\n${TMP_FILENAME}")
+        
+        # new source file is nameRuby.cxx, add to resulting list
+        SET(${SRC_LIST_NAME} ${${SRC_LIST_NAME}} 
+          ${TMP_FILENAME}Ruby.cxx)
+
+        # add custom command to output
+        ADD_CUSTOM_COMMAND(
+          OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Ruby.cxx
+          DEPENDS ${VTK_WRAP_RUBY_EXE} ${VTK_WRAP_HINTS} ${TMP_INPUT}
+          COMMAND ${VTK_WRAP_RUBY_EXE}
+          ARGS ${TMP_INPUT} ${VTK_WRAP_HINTS} ${TMP_CONCRETE} 
+          ${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Ruby.cxx
+          COMMENT "Ruby Wrappings"
+          )
+
+        # Add this output to a custom target if needed.
+        IF(VTK_WRAP_RUBY_NEED_CUSTOM_TARGETS)
+          SET(VTK_WRAP_RUBY_CUSTOM_LIST ${VTK_WRAP_RUBY_CUSTOM_LIST}
+            ${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Ruby.cxx)
+          SET(VTK_WRAP_RUBY_CUSTOM_COUNT ${VTK_WRAP_RUBY_CUSTOM_COUNT}x)
+          IF(VTK_WRAP_RUBY_CUSTOM_COUNT MATCHES "^${VTK_WRAP_RUBY_CUSTOM_LIMIT}$")
+            SET(VTK_WRAP_RUBY_CUSTOM_NAME ${VTK_WRAP_RUBY_CUSTOM_NAME}Hack)
+            ADD_CUSTOM_TARGET(${VTK_WRAP_RUBY_CUSTOM_NAME} DEPENDS ${VTK_WRAP_RUBY_CUSTOM_LIST})
+            SET(KIT_RUBY_DEPS ${VTK_WRAP_RUBY_CUSTOM_NAME})
+            SET(VTK_WRAP_RUBY_CUSTOM_LIST)
+            SET(VTK_WRAP_RUBY_CUSTOM_COUNT)
+          ENDIF(VTK_WRAP_RUBY_CUSTOM_COUNT MATCHES "^${VTK_WRAP_RUBY_CUSTOM_LIMIT}$")
+        ENDIF(VTK_WRAP_RUBY_NEED_CUSTOM_TARGETS)
+      ENDIF (NOT TMP_WRAP_EXCLUDE)
+    ENDFOREACH(FILE)
+    
+    # finish the data file for the init file        
+    SET(dir ${CMAKE_CURRENT_SOURCE_DIR})
+    IF(VTK_WRAP_RUBY3_INIT_DIR)
+      SET(dir ${VTK_WRAP_RUBY3_INIT_DIR})
+    ELSE(VTK_WRAP_RUBY3_INIT_DIR)
+      IF(VTK_INSTALL_PREFIX)
+        SET(dir "${VTK_CMAKE_DIR}")
+      ELSE(VTK_INSTALL_PREFIX)
+        SET(dir "${VTK_SOURCE_DIR}/Wrappint")
+      ENDIF(VTK_INSTALL_PREFIX)
+    ENDIF(VTK_WRAP_RUBY3_INIT_DIR)
+    CONFIGURE_FILE(
+      ${dir}/vtkWrapperInit.data.in 
+      ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data
+      COPY_ONLY
+      IMMEDIATE
+      )
+    
+    ADD_CUSTOM_COMMAND(
+      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.cxx
+      DEPENDS ${VTK_WRAP_RUBY_INIT_EXE}
+      ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data
+      COMMAND ${VTK_WRAP_RUBY_INIT_EXE}
+      ARGS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data
+      ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.cxx
+      COMMENT "Ruby Wrapping Init"
+      )
+    
+    # Create the Init File
+    SET(${SRC_LIST_NAME} ${${SRC_LIST_NAME}} ${TARGET}Init.cxx)
+
+  ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
+    #otherwise use old loaded command
+    VTK_WRAP_RUBY2(${TARGET} 
+      SOURCES ${SRC_LIST} ${SOURCES}
+      )
+  ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)  
+ENDMACRO(VTK_WRAP_RUBY3)
+
+# VS 6 does not like needing to run a huge number of custom commands
+# when building a single target.  Generate some extra custom targets
+# that run the custom commands before the main target is built.  This
+# is a hack to work-around the limitation.  The test to enable it is
+# done here since it does not need to be done for every macro
+# invocation.
+IF(CMAKE_GENERATOR MATCHES "^Visual Studio 6$")
+  SET(VTK_WRAP_RUBY_NEED_CUSTOM_TARGETS 1)
+  SET(VTK_WRAP_RUBY_CUSTOM_LIMIT x)
+  # Limit the number of custom commands in each target
+  # to 2^7.
+  FOREACH(t 1 2 3 4 5 6 7)
+    SET(VTK_WRAP_RUBY_CUSTOM_LIMIT
+      ${VTK_WRAP_RUBY_CUSTOM_LIMIT}${VTK_WRAP_RUBY_CUSTOM_LIMIT})
+  ENDFOREACH(t)
+ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 6$")
diff -uNr VTK_org/CMakeLists.txt VTK/CMakeLists.txt
--- VTK_org/CMakeLists.txt	2007-07-06 04:50:45.000000000 +0900
+++ VTK/CMakeLists.txt	2009-01-25 13:53:19.000000000 +0900
@@ -607,6 +607,7 @@
 # Determine the set of language wrappers that should be built.
 OPTION(VTK_WRAP_TCL "Wrap VTK classes into the TCL language." OFF)
 OPTION(VTK_WRAP_PYTHON "Wrap VTK classes into the Python language." OFF)
+OPTION(VTK_WRAP_RUBY "Wrap VTK classes into the Ruby language." OFF)
 OPTION(VTK_WRAP_JAVA "Wrap VTK classes into the Java language." OFF)
 
 # Python requires shared libraries.
@@ -617,6 +618,14 @@
   ENDIF(NOT BUILD_SHARED_LIBS)
 ENDIF(VTK_WRAP_PYTHON)
 
+# Ruby requires shared libraries.
+IF(VTK_WRAP_RUBY)
+  IF(NOT BUILD_SHARED_LIBS)
+    MESSAGE(SEND_ERROR "VTK_WRAP_RUBY requires BUILD_SHARED_LIBS to be ON.")
+    SET(VTK_WRAP_RUBY 0)
+  ENDIF(NOT BUILD_SHARED_LIBS)
+ENDIF(VTK_WRAP_RUBY)
+
 # Java requires shared libraries on Windows.
 IF(VTK_WRAP_JAVA)
   IF(WIN32)
@@ -634,6 +643,9 @@
 IF(VTK_WRAP_PYTHON)
   SET(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON)
 ENDIF(VTK_WRAP_PYTHON)
+IF(VTK_WRAP_RUBY)
+  SET(VTK_LANGUAGES ${VTK_LANGUAGES} RUBY)
+ENDIF(VTK_WRAP_RUBY)
 IF(VTK_WRAP_JAVA)
   SET(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA)
 ENDIF(VTK_WRAP_JAVA)
@@ -887,6 +899,9 @@
 IF(VTK_WRAP_PYTHON)
   SUBDIRS(Wrapping/Python)
 ENDIF(VTK_WRAP_PYTHON)
+IF(VTK_WRAP_RUBY)
+  SUBDIRS(Wrapping/Ruby)
+ENDIF(VTK_WRAP_RUBY)
 IF(VTK_WRAP_JAVA)
   SUBDIRS(Wrapping/Java)
 ENDIF(VTK_WRAP_JAVA)
@@ -968,13 +983,13 @@
                      "VTK_USE_RENDERING" ON)
 
 SET(VTK_CAN_USE_TK)
-IF(VTK_WRAP_PYTHON OR VTK_WRAP_TCL)
+IF(VTK_WRAP_PYTHON OR VTK_WRAP_RUBY OR VTK_WRAP_TCL)
   IF(NOT VTK_USE_COCOA)
     IF(NOT VTK_DISABLE_TK_INIT)
       SET(VTK_CAN_USE_TK 1)
     ENDIF(NOT VTK_DISABLE_TK_INIT)
   ENDIF(NOT VTK_USE_COCOA)
-ENDIF(VTK_WRAP_PYTHON OR VTK_WRAP_TCL)
+ENDIF(VTK_WRAP_PYTHON OR VTK_WRAP_RUBY OR VTK_WRAP_TCL)
 VTK_DEPENDENT_OPTION(VTK_USE_TK "Build VTK with Tk support" ON
                      "VTK_CAN_USE_TK" OFF)
 
@@ -1228,6 +1243,49 @@
 ENDIF(VTK_WRAP_PYTHON)
 
 #-----------------------------------------------------------------------------
+# Configure Ruby wrapping support.
+IF(VTK_WRAP_RUBY)
+  SET(VTK_WRAP_RUBY3_INIT_DIR "${VTK_SOURCE_DIR}/Wrapping")
+  INCLUDE("${VTK_SOURCE_DIR}/CMake/vtkWrapRuby.cmake")
+  INCLUDE(${CMAKE_ROOT}/Modules/FindRuby.cmake)
+  FIND_LIBRARY(RUBY_LIBRARY
+    NAMES ruby1.8 ruby1.6 ruby
+    PATHS ${RUBY_POSSIBLE_LIB_PATHS}
+    )
+
+  # Wrapping executables.
+  UTILITY_SOURCE(VTK_WRAP_RUBY_EXE vtkWrapRuby Wrapping vtkWrapRuby.c)
+  UTILITY_SOURCE(VTK_WRAP_RUBY_INIT_EXE vtkWrapRubyInit 
+                   Wrapping vtkWrapRubyInit.c)
+  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping)
+  MARK_AS_ADVANCED(VTK_WRAP_RUBY_EXE VTK_WRAP_RUBY_INIT_EXE VTK_WRAP_HINTS)
+
+  # Use separate debug/optimized libraries if they are different.
+  IF(RUBY_DEBUG_LIBRARY)
+    STRING(COMPARE EQUAL "${RUBY_DEBUG_LIBRARY}" "${RUBYLIBRARY}"
+      VTK_RUBY_LIBRARIES_MATCH)
+    IF(VTK_RUBY_LIBRARIES_MATCH)
+      SET(VTK_RUBY_LIBRARIES ${RUBY_LIBRARY})
+    ELSE(VTK_RUBY_LIBRARIES_MATCH)
+      SET(VTK_RUBY_LIBRARIES
+        optimized ${RUBY_LIBRARY}
+        debug ${RUBY_DEBUG_LIBRARY})
+    ENDIF(VTK_RUBY_LIBRARIES_MATCH)
+    SET(VTK_WINDOWS_RUBY_DEBUGGABLE 0)
+    IF(WIN32)
+      IF(RUBY_DEBUG_LIBRARY MATCHES "_d")
+        SET(VTK_WINDOWS_RUBY_DEBUGGABLE 1)
+      ENDIF(RUBY_DEBUG_LIBRARY MATCHES "_d")
+    ENDIF(WIN32)
+  ELSE(RUBY_DEBUG_LIBRARY)
+    SET(VTK_RUBY_LIBRARIES ${RUBY_LIBRARY})
+  ENDIF(RUBY_DEBUG_LIBRARY)
+
+  # Include any extra libraries for python.
+  SET(VTK_RUBY_LIBRARIES ${VTK_RUBY_LIBRARIES} ${RUBY_EXTRA_LIBS})
+ENDIF(VTK_WRAP_RUBY)
+
+#-----------------------------------------------------------------------------
 # Configure Java wrapping support.
 IF(VTK_WRAP_JAVA)
   SET(VTK_WRAP_JAVA3_INIT_DIR "${VTK_SOURCE_DIR}/Wrapping")
@@ -1251,7 +1309,7 @@
 
 #-----------------------------------------------------------------------------
 # Configure the Tk library for vtkRendering.
-IF(VTK_WRAP_TCL OR VTK_WRAP_PYTHON)
+IF(VTK_WRAP_TCL OR VTK_WRAP_PYTHON OR VTK_WRAP_RUBY)
   IF(VTK_USE_RENDERING OR VTK_WRAP_TCL)
     SET(VTK_INCLUDE_NEED_TCL 1)
   ENDIF(VTK_USE_RENDERING OR VTK_WRAP_TCL)
@@ -1260,14 +1318,14 @@
       SET(VTK_INCLUDE_NEED_TK 1)
     ENDIF(VTK_USE_TK)
   ENDIF(VTK_USE_RENDERING)
-ENDIF(VTK_WRAP_TCL OR VTK_WRAP_PYTHON)
+ENDIF(VTK_WRAP_TCL OR VTK_WRAP_PYTHON OR VTK_WRAP_RUBY)
 
 IF(VTK_USE_TK)
   INCLUDE(${VTK_SOURCE_DIR}/Wrapping/Tcl/vtkDetermineTkResources.cmake)
 ENDIF(VTK_USE_TK)
 
 IF(VTK_INCLUDE_NEED_TK)
-  # Need Tk headers and libraries for python TK widgets
+  # Need Tk headers and libraries for python and ruby TK widgets
   IF(NOT VTK_WRAP_TCL)
     VTK_INCLUDE_TCL_TK_MODULES()
   ENDIF(NOT VTK_WRAP_TCL)
@@ -1343,6 +1401,26 @@
   MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
 ENDIF(VTK_NEED_PYTHON_EXECUTABLE)
 
+# Ruby executable is used by some tests whether VTK_WRAP_RUBY is
+# on or not.  do not add a VTK_WRAP_RUBY to this if.
+SET(VTK_NEED_RUBY_EXECUTABLE 0)
+IF(BUILD_TESTING)
+  SET(VTK_NEED_RUBY_EXECUTABLE 1)
+ENDIF(BUILD_TESTING)
+
+# If VTK_WRAP_RUBY is on, then we need ruby executable to compile
+# scripts.
+IF(VTK_WRAP_RUBY)
+  SET(VTK_NEED_RUBY_EXECUTABLE 1)
+ENDIF(VTK_WRAP_RUBY)
+
+IF(VTK_NEED_RUBY_EXECUTABLE)
+  FIND_PROGRAM(RUBY_EXECUTABLE
+    NAMES ruby1.8 ruby1.6 ruby
+)
+  MARK_AS_ADVANCED(RUBY_EXECUTABLE)
+ENDIF(VTK_NEED_RUBY_EXECUTABLE)
+
 #-----------------------------------------------------------------------------
 # Configure the default VTK_DATA_ROOT for the location of VTKData.
 FIND_PATH(VTK_DATA_ROOT VTKData.readme
@@ -1434,7 +1512,7 @@
     ${VTK_SOURCE_DIR}/CMake/vtkMakeInstantiator.h.in
     ${VTK_SOURCE_DIR}/CMake/vtkMakeInstantiator.cxx.in)
   IF (VTK_NEED_LOADED_COMMANDS)
-    FOREACH(cmd VTK_WRAP_TCL2 VTK_WRAP_PYTHON2 VTK_WRAP_JAVA2
+    FOREACH(cmd VTK_WRAP_TCL2 VTK_WRAP_PYTHON2 VTK_WRAP_RUBY2 VTK_WRAP_JAVA2
         VTK_GENERATE_JAVA_DEPENDENCIES)
       IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.0)
         # CMake 2.2 and above will set CMAKE_LOADED_COMMAND_<command-name>
diff -uNr VTK_org/Common/CMakeLists.txt VTK/Common/CMakeLists.txt
--- VTK_org/Common/CMakeLists.txt	2006-02-14 08:42:00.000000000 +0900
+++ VTK/Common/CMakeLists.txt	2009-01-25 13:53:15.000000000 +0900
@@ -2,6 +2,7 @@
 SET(UKIT COMMON)
 SET(KIT_TCL_LIBS ${VTK_TCL_LIBRARIES})
 SET(KIT_PYTHON_LIBS)
+SET(KIT_RUBY_LIBS)
 SET(KIT_JAVA_LIBS)
 SET(KIT_LIBS vtksys)
 
@@ -261,9 +262,11 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS vtkTclUtil.cxx)
 SET(Kit_PYTHON_EXTRA_SRCS vtkPythonUtil.cxx)
+SET(Kit_RUBY_EXTRA_SRCS vtkRubyUtil.cxx)
 SET(Kit_JAVA_EXTRA_SRCS vtkJavaUtil.cxx)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 IF (WIN32)
@@ -318,6 +321,22 @@
       ENDIF(NOT VTK_USE_COCOA)
     ENDIF (TK_LIBRARY)
   ENDIF(VTK_WRAP_PYTHON)
+  IF(VTK_WRAP_RUBY)
+    INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h
+      vtkRubyUtil
+      )
+    INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} FILES
+      vtkRuby.h
+      )
+    IF (TK_LIBRARY)
+      IF(NOT VTK_USE_COCOA)
+        INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h
+          vtkTcl
+          vtkTk
+          )
+      ENDIF(NOT VTK_USE_COCOA)
+    ENDIF (TK_LIBRARY)
+  ENDIF(VTK_WRAP_RUBY)
   IF(VTK_WRAP_JAVA)
     INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h
       vtkJavaUtil
diff -uNr VTK_org/Common/vtkRuby.h VTK/Common/vtkRuby.h
--- VTK_org/Common/vtkRuby.h	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Common/vtkRuby.h	2009-01-25 13:53:15.000000000 +0900
@@ -0,0 +1,33 @@
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile: vtkRuby.h,v $
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+#ifndef __vtkRuby_h
+#define __vtkRuby_h
+
+#undef _POSIX_THREADS
+
+#include "vtkToolkits.h"
+
+#include "ruby.h"
+
+#ifndef NUM2ULL
+#define NUM2ULL(val) ((unsigned LONG_LONG)NUM2LL(val))
+#endif
+
+#undef write
+#undef read
+#undef open
+#undef close
+
+#endif
diff -uNr VTK_org/Common/vtkRubyUtil.cxx VTK/Common/vtkRubyUtil.cxx
--- VTK_org/Common/vtkRubyUtil.cxx	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Common/vtkRubyUtil.cxx	2009-01-25 13:53:15.000000000 +0900
@@ -0,0 +1,565 @@
+// This include allows VTK to build on some platforms with broken Ruby
+// header files.
+#include "vtkRubyUtil.h"
+
+#include "vtkSystemIncludes.h"
+
+#include "vtkObject.h"
+#include "vtkObjectFactory.h"
+#include "vtkSmartPointerBase.h"
+#include "vtkTimeStamp.h"
+#include "vtkWindows.h"
+
+#include <vtkstd/map>
+#include <vtkstd/string>
+
+#if defined ( _MSC_VER )
+#  define vtkConvertPtrToLong(x) ((long)(PtrToUlong(x)))
+#else
+#  define vtkConvertPtrToLong(x) ((long)(x))
+#endif
+
+
+//#define VTKRUBYDEBUG
+
+//--------------------------------------------------------------------
+class vtkRubyDeleteCommand : public vtkCommand
+{
+public:
+  static vtkRubyDeleteCommand *New(rbVTKObject *obj) {
+    return new vtkRubyDeleteCommand(obj); };
+
+  void Execute(vtkObject *caller, unsigned long, void *);
+
+private:
+  vtkRubyDeleteCommand(rbVTKObject *obj) : Self(obj) {};
+
+  rbVTKObject *Self;
+};
+
+void vtkRubyDeleteCommand::Execute(vtkObject *caller,
+                                     unsigned long vtkNotUsed(id),
+                                     void *vtkNotUsed(data))
+{
+  rbVTKObject *obj = this->Self;
+  if (obj->vtk_ptr != caller)
+    {
+    vtkGenericWarningMacro("Ruby vs. VTK mismatch for " << caller);
+    return;
+    }
+  obj->vtk_ptr = NULL;
+  obj->mark = Qnil;
+}
+
+//--------------------------------------------------------------------
+static void rb_VTKObject_RuDelete(rbVTKObject *self)
+{
+  self->vtk_ptr->Delete();
+  // the rest of the delection is handled when the VTK-level object
+  // is destroyed
+  //redef;
+}
+
+//--------------------------------------------------------------------
+VALUE rb_VTKClass(const char* name)
+{
+  char *rb_class_name;
+  VALUE klass;
+
+  /*
+  rb_class_name = ALLOC_N(char,strlen(name)+6);
+  strcpy(rb_class_name, "Vtk::");
+  strcat(rb_class_name, name);
+  rb_class_name[5] = 'V';
+  */
+  name = name+3;
+  rb_class_name = ALLOC_N(char,strlen(name)+6);
+  strcpy(rb_class_name, "Vtk::");
+  strcat(rb_class_name, name);
+  klass = rb_eval_string(rb_class_name);
+  free(rb_class_name);
+  return klass;
+}
+
+//--------------------------------------------------------------------
+VALUE rb_vtk_define_class_under(VALUE module, const char* name, VALUE super)
+{
+  /*
+  char *rb_class_name;
+  VALUE klass;
+
+  rb_class_name = ALLOC_N(char,strlen(name)+1);
+  strcpy(rb_class_name, name);
+  rb_class_name[0] = 'V';
+  klass = rb_define_class_under(module, rb_class_name, super);
+  free(rb_class_name);
+  return klass;
+  */
+
+  return rb_define_class_under(module, name+3, super);
+}
+
+//--------------------------------------------------------------------
+#ifdef __cplusplus
+extern "C" {
+#endif
+void rb_VTKObject_Mark(void *self)
+{
+  rbVTKObject *obj;
+  int i;
+
+  obj = (rbVTKObject *) self;
+  if (rb_class_of(obj->mark)==rb_cArray)
+    {
+    rb_gc_mark(obj->mark);
+    for (i=0;i<RARRAY(obj->mark)->len;i++)
+      rb_gc_mark(RARRAY(obj->mark)->ptr[i]);
+    }
+}
+void rb_VTKObject_Free(void *self)
+{
+  rbVTKObject *obj = (rbVTKObject *) self;
+  vtkRubyUnRegister(obj);
+  free(obj);
+}
+#ifdef __cplusplus
+}
+#endif
+
+
+VALUE rb_VTKObject_New(VALUE klass, vtkObjectBase *ptr)
+{
+  rbVTKObject *obj;
+
+  if (!ptr)
+    rb_raise(rb_eArgError,
+                    "this is an abstract class and cannot be instantiated");
+  ptr->Register(NULL);
+  ptr->Delete();
+  obj = ALLOC(rbVTKObject);
+  obj->vtk_ptr = ptr;
+  obj->ref_count = 1;
+  obj->mark = rb_ary_new();
+  return Data_Wrap_Struct(klass,rb_VTKObject_Mark,rb_VTKObject_Free,obj);
+}
+
+void rb_VTKObject_PushMark(VALUE self, VALUE other)
+{
+  rbVTKObject *obj;
+  if (rb_obj_is_kind_of(self,rb_vtkObjectBaseClass()))
+    {
+    Data_Get_Struct(self,rbVTKObject,obj);
+    if (rb_class_of(obj->mark)==rb_cArray)
+      {
+      rb_ary_push(obj->mark, other);
+      }
+    }
+}
+
+VALUE rb_VTKSpecialObject_New(VALUE klass, void *ptr)
+{
+  rbVTKSpecialObject *obj;
+
+  obj = ALLOC(rbVTKSpecialObject);
+  obj->ptr = ptr;
+  obj->ref_count = 1;
+  obj->mark = rb_ary_new();
+
+  return Data_Wrap_Struct(klass,rb_VTKObject_Mark,rb_VTKObject_Free,obj);
+}
+
+//--------------------------------------------------------------------
+VALUE vtkRubyGetObjectFromPointer(vtkObjectBase *ptr)
+{
+  return vtkRubyGetObjectFromPointer(ptr, rb_VTKClass(ptr->GetClassName()));
+}
+
+VALUE vtkRubyGetObjectFromPointer(vtkObjectBase *ptr, VALUE klass)
+{
+  rbVTKObject *obj;
+
+  if (ptr)
+    ptr->Register(NULL);
+  else
+    return Qnil;
+
+  obj = ALLOC(rbVTKObject);
+  obj->vtk_ptr = ptr;
+  obj->ref_count = 1;
+  obj->mark = rb_ary_new();
+
+  return Data_Wrap_Struct(klass,rb_VTKObject_Mark,rb_VTKObject_Free,obj);
+
+}
+
+//--------------------------------------------------------------------
+vtkObjectBase *vtkRubyGetPointerFromObject(VALUE robj)
+{ 
+  rbVTKObject *obj;
+  vtkObjectBase *ptr;
+
+  // convert Qnil to NULL every time
+  if (robj == Qnil)
+    {
+      return NULL;
+    }
+
+  // check to ensure it is a vtk object
+  if (rb_obj_is_kind_of(robj,rb_vtkObjectBaseClass()))
+    {
+      Data_Get_Struct(robj,rbVTKObject,obj);
+      ptr = obj->vtk_ptr;
+    }
+  else
+   {
+#ifdef VTKRUBYDEBUG
+    vtkGenericWarningMacro("Object " << robj << " is not a VTK object!!");
+#endif  
+    rb_raise(rb_eRuntimeError,"method requires a VTK object");
+    }
+  
+#ifdef VTKRUBYDEBUG
+  vtkGenericWarningMacro("Checking into obj " << obj << " ptr = " << ptr);
+#endif  
+
+#ifdef VTKRUBYDEBUG
+    vtkGenericWarningMacro("Got obj= " << obj << " ptr= " << ptr << " " << result_type);
+#endif  
+    return ptr;
+}
+
+//--------------------------------------------------------------------
+VALUE vtkRubyGetObjectFromObject(VALUE arg, const char *type, VALUE klass)
+{
+  char *ptrText = STR2CSTR(arg);
+
+  vtkObjectBase *ptr;
+  char typeCheck[256];  // typeCheck is currently not used
+  int i = sscanf(ptrText,"_%lx_%s",(long *)&ptr,typeCheck);
+
+  if (i <= 0)
+    {
+    i = sscanf(ptrText,"Addr=0x%lx",(long *)&ptr);
+    }
+  if (i <= 0)
+    {
+    i = sscanf(ptrText,"%lx",(long *)&ptr);
+    }
+  if (i <= 0)
+    {
+    rb_raise(rb_eArgError,"could not extract hexidecimal address from argument string");
+    return Qnil;
+    }
+
+  if (!ptr->IsA(type))
+    {
+    char error_string[256];
+    sprintf(error_string,"method requires a %s address, a %s address was provided.",
+          type,((vtkObjectBase *)ptr)->GetClassName());
+    rb_raise(rb_eArgError,error_string);
+    return Qnil;
+    }
+
+  return vtkRubyGetObjectFromPointer(ptr, klass);
+}
+
+//--------------------------------------------------------------------
+void vtkRubyUnRegister(VALUE self)
+{
+  rbVTKObject *obj;
+  if (rb_obj_is_kind_of(self,rb_vtkObjectBaseClass()))
+    {
+    Data_Get_Struct(self,rbVTKObject,obj);
+    vtkRubyUnRegister(obj);
+    }
+}
+void vtkRubyUnRegister(rbVTKObject *obj)
+{
+  if (obj->ref_count)
+    {
+    obj->vtk_ptr->UnRegister(NULL);
+    obj->ref_count = 0;
+    }
+}
+
+//--------------------------------------------------------------------
+// mangle a void pointer into a  SWIG-type string
+char *vtkRubyManglePointer(void *ptr, const char *type)
+{
+  static char ptrText[128];
+  sprintf(ptrText,"_%*.*lx_%s",2*(int)sizeof(void *),2*(int)sizeof(void *),
+	  vtkConvertPtrToLong(ptr),type);
+  return ptrText;
+}
+
+//--------------------------------------------------------------------
+// unmangle a void pointer from a SWIG-style string
+void *vtkRubyUnmanglePointer(char *ptrText, int *len, const char *type)
+{
+  int i;
+  void *ptr;
+  char typeCheck[128];
+  if (*len < 128)
+    {
+    i = sscanf(ptrText,"_%lx_%s",(long *)&ptr,typeCheck);
+    if (strcmp(type,typeCheck) == 0)
+      { // sucessfully unmangle
+      *len = 0;
+      return ptr;
+      }
+    else if (i == 2)
+      { // mangled pointer of wrong type
+      *len = -1;
+      return NULL;
+      }
+    }
+  // couldn't unmangle: return string as void pointer if it didn't look
+  // like a SWIG mangled pointer
+  return (void *)ptrText;
+}
+
+//--------------------------------------------------------------------
+// These functions check an array that was sent to a method to see if
+// any of the values were changed by the method.
+// If a value was changed, then the corresponding value in the ruby
+// list is modified.
+
+template<class T>
+static inline
+int vtkRubyCheckFloatArray(VALUE *args, int i, T *a, int n)
+{
+  int changed = 0;
+
+  VALUE seq = args[i];
+  for (i = 0; i < n; i++)
+    {
+    VALUE oldobj = rb_ary_entry(seq, i);
+    T oldval = (T)NUM2DBL(oldobj);
+    changed |= (a[i] != oldval);
+    }
+
+  if (changed)
+    {
+    for (i = 0; i < n; i++)
+      {
+      VALUE newobj = rb_float_new(a[i]);
+      rb_ary_store(seq, i, newobj);
+      }
+    }
+
+  return 0;
+}
+
+template<class T>
+static inline
+int vtkRubyCheckIntArray(VALUE *args, int i, T *a, int n)
+{
+  int changed = 0;
+
+  VALUE seq = args[i];
+  for (i = 0; i < n; i++)
+    {
+    VALUE oldobj = rb_ary_entry(seq, i);
+    T oldval = (T)NUM2LONG(oldobj);
+    changed |= (a[i] != oldval);
+    }
+
+  if (changed)
+    {
+    for (i = 0; i < n; i++)
+      {
+      VALUE newobj = LONG2NUM(a[i]);
+      rb_ary_store(seq, i, newobj);
+      }
+    }
+
+  return 0;
+}
+
+#if defined(VTK_TYPE_USE_LONG_LONG) || defined(VTK_TYPE_USE___INT64)
+template<class T>
+static inline
+int vtkRubyCheckLongArray(VALUE *args, int i, T *a, int n)
+{
+  int changed = 0;
+
+  VALUE seq = args[i];
+  for (i = 0; i < n; i++)
+    {
+    VALUE oldobj = rb_ary_entry(seq, i);
+    T oldval;
+#ifdef PY_LONG_LONG
+    oldval = NUM2LL(oldobj);
+#else
+    oldval = NUM2LONG(oldobj);
+#endif
+    changed |= (a[i] != oldval);
+    }
+
+  if (changed)
+    {
+    for (i = 0; i < n; i++)
+      {
+#if defined(VTK_TYPE_USE_LONG_LONG)
+# if defined(PY_LONG_LONG) && (VTK_SIZEOF_LONG != VTK_SIZEOF_LONG_LONG)
+      VALUE newobj = LL2NUM(a[i]);
+# else
+      VALUE newobj = LONG2NUM((long)a[i]);
+# endif
+#else
+# if defined(PY_LONG_LONG) && (VTK_SIZEOF_LONG != VTK_SIZEOF___INT64)
+      VALUE newobj = LL2NUM(a[i]);
+# else
+      VALUE newobj = LONG2NUM((long)a[i]);
+# endif
+#endif
+      rb_ary_store(seq, i, newobj);
+      }
+    }
+
+  return 0;
+}
+#endif
+
+int vtkRubyCheckArray(VALUE *args, int i, char *a, int n)
+{
+  return vtkRubyCheckIntArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, signed char *a, int n)
+{
+  return vtkRubyCheckIntArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, unsigned char *a, int n)
+{
+  return vtkRubyCheckIntArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, short *a, int n)
+{
+  return vtkRubyCheckIntArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, unsigned short *a, int n)
+{
+  return vtkRubyCheckIntArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, int *a, int n)
+{
+  return vtkRubyCheckIntArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, unsigned int *a, int n)
+{
+  return vtkRubyCheckIntArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, long *a, int n)
+{
+  return vtkRubyCheckIntArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, unsigned long *a, int n)
+{
+  return vtkRubyCheckIntArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, float *a, int n)
+{
+  return vtkRubyCheckFloatArray(args, i, a, n);
+}
+
+int vtkRubyCheckArray(VALUE *args, int i, double *a, int n)
+{
+  return vtkRubyCheckFloatArray(args, i, a, n);
+}
+
+#if defined(VTK_TYPE_USE_LONG_LONG)
+int vtkRubyCheckArray(VALUE *args, int i, long long *a, int n)
+{
+  return vtkRubyCheckLongArray(args, i, a, n);
+}
+int vtkRubyCheckArray(VALUE *args, int i, unsigned long long *a, int n)
+{
+  return vtkRubyCheckLongArray(args, i, a, n);
+}
+#endif
+
+#if defined(VTK_TYPE_USE___INT64)
+int vtkRubyCheckArray(VALUE *args, int i, __int64 *a, int n)
+{
+  return vtkRubyCheckLongArray(args, i, a, n);
+}
+int vtkRubyCheckArray(VALUE *args, int i, unsigned __int64 *a, int n)
+{
+  return vtkRubyCheckLongArray(args, i, a, n);
+}
+#endif
+
+
+//--------------------------------------------------------------------
+void vtkRubyVoidFunc(void *arg)
+{
+  VALUE result;
+  VALUE func = (VALUE)arg;
+
+  result = rb_funcall(func,rb_intern("call"),0);
+
+}
+
+//--------------------------------------------------------------------
+void vtkRubyVoidFuncArgDelete(void *arg)
+{
+}
+
+
+//--------------------------------------------------------------------
+vtkRubyCommand::vtkRubyCommand()
+{ 
+  this->obj = Qnil;
+}
+
+vtkRubyCommand::~vtkRubyCommand()
+{ 
+  this->obj = Qnil;
+}
+
+void vtkRubyCommand::SetObject(VALUE o)
+{ 
+  this->obj = o; 
+}
+
+void vtkRubyCommand::Execute(vtkObject *ptr, unsigned long eventtype,
+                               void *CallData)
+{
+  VALUE obj2;
+  const char *eventname;
+  VALUE argv[3];
+
+  if (ptr && ptr->GetReferenceCount() > 0)
+    {
+    obj2 = vtkRubyGetObjectFromPointer(ptr);
+    rb_funcall(obj2, rb_intern("UnRegister"), 1, Qnil);
+    }
+  else
+    {
+    obj2 = Qnil;
+    }
+
+    eventname = this->GetStringFromEventId(eventtype);
+
+
+    argv[0] = obj2;
+    argv[1] = rb_str_new2(eventname);
+    if (CallData==NULL){
+      argv[2] = Qnil;}
+    else
+      argv[2] = rb_str_new2((char*)CallData);
+    rb_funcall2(this->obj, rb_intern("call"), 3, argv);
+}
+//--------------------------------------------------------------------
+
+
+
diff -uNr VTK_org/Common/vtkRubyUtil.h VTK/Common/vtkRubyUtil.h
--- VTK_org/Common/vtkRubyUtil.h	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Common/vtkRubyUtil.h	2009-01-25 13:53:15.000000000 +0900
@@ -0,0 +1,153 @@
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile: vtkRubyUtil.h,v $
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+#ifndef __vtkRubyUtil_h
+#define __vtkRubyUtil_h
+
+#include "vtkRuby.h"
+#include "vtkCommand.h"
+
+#if defined(WIN32)
+# if defined(vtkCommonRubyD_EXPORTS)
+#  define VTK_RUBY_EXPORT __declspec(dllexport)
+# else
+#  define VTK_RUBY_EXPORT __declspec(dllimport)
+# endif
+#else
+# define VTK_RUBY_EXPORT
+#endif
+
+// This is the VTK/Ruby 'class,' it contains the method list and a pointer
+// to the superclass
+typedef vtkObjectBase *(*vtknewfunc)();
+
+typedef struct {
+  vtkObjectBase *vtk_ptr;
+  int ref_count;
+  VALUE mark;
+} rbVTKObject;
+
+// This for objects not derived from vtkObjectBase
+typedef struct {
+  void *ptr;
+  int ref_count;
+  VALUE mark;
+} rbVTKSpecialObject;
+
+
+extern VTK_RUBY_EXPORT
+VALUE rb_VTKClass(const char*);
+
+extern VTK_RUBY_EXPORT
+VALUE rb_vtkObjectBaseClass(void);
+
+extern VTK_RUBY_EXPORT
+VALUE rb_vtk_define_class_under(VALUE module, const char* name, VALUE super);
+
+// Standard methods for all vtk/ruby objects
+extern VTK_RUBY_EXPORT
+VALUE rb_VTKObject_New(VALUE vtkclass, vtkObjectBase *ptr);
+
+extern VTK_RUBY_EXPORT
+void rb_VTKObject_PushMark(VALUE self, VALUE other);
+
+
+
+// Extract the vtkObjectBase from a rbVTKObject.  If the VALUE is not a 
+// rbVTKObject, or is not a rbVTKObject of the specified type, the ruby
+// error indicator will be set.
+// Special behaviour: Qnil is converted to NULL without no error.
+extern VTK_RUBY_EXPORT
+vtkObjectBase *vtkRubyGetPointerFromObject(VALUE obj);
+
+// Convert a vtkObjectBase to a rbVTKObject.  This will first check to see if
+// the rbVTKObject already exists, and create a new rbVTKObject if necessary.
+// This function also passes ownership of the reference to the VALUE.
+// Special behaviour: NULL is converted to Qnil.
+extern VTK_RUBY_EXPORT
+VALUE vtkRubyGetObjectFromPointer(vtkObjectBase *ptr);
+extern VTK_RUBY_EXPORT
+VALUE vtkRubyGetObjectFromPointer(vtkObjectBase *ptr, VALUE klass);
+extern VTK_RUBY_EXPORT
+VALUE vtkRubyGetObjectFromObject(VALUE arg, const char *type, VALUE klass);
+
+extern VTK_RUBY_EXPORT
+void vtkRubyUnRegister(rbVTKObject *obj);
+extern VTK_RUBY_EXPORT
+void vtkRubyUnRegister(VALUE self);
+
+extern VTK_RUBY_EXPORT
+char *vtkRubyManglePointer(void *ptr, const char *type);
+extern VTK_RUBY_EXPORT
+void *vtkRubyUnmanglePointer(char *ptrText, int *len, const char *type);
+
+
+// check array arguments sent through the wrappers to see if the underlying
+// C++ method changed the values, and attempt to modify the original ruby
+// sequence (list or tuple) if so.
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, char *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, signed char *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, unsigned char *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, short *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, unsigned short *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, int *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, unsigned int *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, long *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, unsigned long *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, float *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, double *a, int n);
+#if defined(VTK_TYPE_USE_LONG_LONG)
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, long long *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, unsigned long long *a, int n);
+#endif
+#if defined(VTK_TYPE_USE___INT64)
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, __int64 *a, int n);
+extern VTK_RUBY_EXPORT
+int vtkRubyCheckArray(VALUE *args, int i, unsigned __int64 *a, int n);
+#endif
+
+// For use by SetXXMethod() , SetXXMethodArgDelete()
+extern VTK_RUBY_EXPORT void vtkRubyVoidFunc(void *);
+extern VTK_RUBY_EXPORT void vtkRubyVoidFuncArgDelete(void *);
+
+// To allow Ruby to use the vtkCommand features
+class vtkRubyCommand : public vtkCommand
+{
+public:
+  static vtkRubyCommand *New() { return new vtkRubyCommand; };
+
+  void SetObject(VALUE o);
+  void Execute(vtkObject *ptr, unsigned long eventtype, void *CallData);
+ 
+  VALUE obj;
+protected:
+  vtkRubyCommand();
+  ~vtkRubyCommand(); 
+};
+
+#endif
diff -uNr VTK_org/Examples/Annotation/Ruby/annotatePick.rb VTK/Examples/Annotation/Ruby/annotatePick.rb
--- VTK_org/Examples/Annotation/Ruby/annotatePick.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Annotation/Ruby/annotatePick.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,85 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates cell picking using vtkCellPicker.  It
+# displays the results of picking using a vtkTextMapper.
+
+require 'vtk'
+
+# create a sphere source, mapper, && actor
+sphere = Vtk::SphereSource.new
+sphereMapper = Vtk::PolyDataMapper.new
+sphereMapper.SetInputConnection(sphere.GetOutputPort)
+Vtk::PolyDataMapper.GlobalImmediateModeRenderingOn
+sphereActor = Vtk::LODActor.new
+sphereActor.SetMapper(sphereMapper)
+
+# create the spikes by glyphing the sphere with a cone.  Create the
+# mapper && actor for the glyphs.
+cone = Vtk::ConeSource.new
+glyph = Vtk::Glyph3D.new
+glyph.SetInputConnection(sphere.GetOutputPort)
+glyph.SetSource(cone.GetOutput)
+glyph.SetVectorModeToUseNormal
+glyph.SetScaleModeToScaleByVector
+glyph.SetScaleFactor(0.25)
+spikeMapper = Vtk::PolyDataMapper.new
+spikeMapper.SetInputConnection(glyph.GetOutputPort)
+spikeActor = Vtk::LODActor.new
+spikeActor.SetMapper(spikeMapper)
+
+# Create a text mapper && actor to display the results of picking.
+textMapper = Vtk::TextMapper.new
+tprop = textMapper.GetTextProperty
+tprop.SetFontFamilyToArial
+tprop.SetFontSize(10)
+tprop.BoldOn
+tprop.ShadowOn
+tprop.SetColor(1, 0, 0)
+textActor = Vtk::Actor2D.new
+textActor.VisibilityOff
+textActor.SetMapper(textMapper)
+
+# Create a cell picker.
+picker = Vtk::CellPicker.new
+
+# Create a Ruby function to create the text for the text mapper used
+# to display the results of picking.
+annotatePick = Proc.new{|object, event|
+    if picker.GetCellId < 0
+        textActor.VisibilityOff
+    else        selPt = picker.GetSelectionPoint
+        pickPos = picker.GetPickPosition
+        textMapper.SetInput("(%.6f, %.6f, %.6f)"%pickPos)
+        textActor.SetPosition(selPt[0..1])
+        textActor.VisibilityOn
+    end
+}
+
+# Now at the end of the pick event call the above function.
+picker.AddObserver("EndPickEvent", annotatePick)
+
+# Create the Renderer, RenderWindow, etc. && set the Picker.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+iren.SetPicker(picker)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor2D(textActor)
+ren.AddActor(sphereActor)
+ren.AddActor(spikeActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(300, 300)
+
+# Get the camera && zoom in closer to the image.
+ren.ResetCamera
+cam1 = ren.GetActiveCamera
+cam1.Zoom(1.4)
+
+iren.Initialize
+# Initially pick the cell at this location.
+picker.Pick(85, 126, 0, ren)
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Annotation/Ruby/cubeAxes.rb VTK/Examples/Annotation/Ruby/cubeAxes.rb
--- VTK_org/Examples/Annotation/Ruby/cubeAxes.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Annotation/Ruby/cubeAxes.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,120 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of vtkCubeAxesActor2D to indicate
+# the position in space that the camera is currently viewing.  The
+# vtkCubeAxesActor2D draws axes on the bounding box of the data set
+# && labels the axes with x-y-z coordinates.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create a vtkBYUReader && read in a data set.
+fohe = Vtk::BYUReader.new
+fohe.SetGeometryFileName(VTK_DATA_ROOT + "/Data/teapot.g")
+
+# Create a vtkPolyDataNormals filter to calculate the normals of the
+# data set.
+normals = Vtk::PolyDataNormals.new
+normals.SetInputConnection(fohe.GetOutputPort)
+# Set up the associated mapper && actor.
+foheMapper = Vtk::PolyDataMapper.new
+foheMapper.SetInputConnection(normals.GetOutputPort)
+foheActor = Vtk::LODActor.new
+foheActor.SetMapper(foheMapper)
+
+# Create a vtkOutlineFilter to draw the bounding box of the data set.
+# Also create the associated mapper && actor.
+outline = Vtk::OutlineFilter.new
+outline.SetInputConnection(normals.GetOutputPort)
+mapOutline = Vtk::PolyDataMapper.new
+mapOutline.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(mapOutline)
+outlineActor.GetProperty.SetColor(0, 0, 0)
+
+# Create a vtkCamera, && set the camera parameters.
+camera = Vtk::Camera.new
+camera.SetClippingRange(1.60187, 20.0842)
+camera.SetFocalPoint(0.21406, 1.5, 0)
+camera.SetPosition(8.3761, 4.94858, 4.12505)
+camera.SetViewUp(0.180325, 0.549245, -0.815974)
+
+# Create a vtkLight, && set the light parameters.
+light = Vtk::Light.new
+light.SetFocalPoint(0.21406, 1.5, 0)
+light.SetPosition(8.3761, 4.94858, 4.12505)
+
+# Create the Renderers.  Assign them the appropriate viewport
+# coordinates, active camera, && light.
+ren = Vtk::Renderer.new
+ren.SetViewport(0, 0, 0.5, 1.0)
+ren.SetActiveCamera(camera)
+ren.AddLight(light)
+ren2 = Vtk::Renderer.new
+ren2.SetViewport(0.5, 0, 1.0, 1.0)
+ren2.SetActiveCamera(camera)
+ren2.AddLight(light)
+
+# Create the RenderWindow && RenderWindowInteractor.
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+renWin.AddRenderer(ren2)
+renWin.SetWindowName("VTK - Cube Axes")
+renWin.SetSize(600, 300)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, && set the background.
+ren.AddViewProp(foheActor)
+ren.AddViewProp(outlineActor)
+ren2.AddViewProp(foheActor)
+ren2.AddViewProp(outlineActor)
+
+ren.SetBackground(0.1, 0.2, 0.4)
+ren2.SetBackground(0.1, 0.2, 0.4)
+
+# Create a text property for both cube axes
+tprop = Vtk::TextProperty.new
+tprop.SetColor(1, 1, 1)
+tprop.ShadowOn
+
+# Create a vtkCubeAxesActor2D.  Use the outer edges of the bounding box to
+# draw the axes.  Add the actor to the renderer.
+axes = Vtk::CubeAxesActor2D.new
+axes.SetInput(normals.GetOutput)
+axes.SetCamera(ren.GetActiveCamera)
+axes.SetLabelFormat("%6.4g")
+axes.SetFlyModeToOuterEdges
+axes.SetFontFactor(0.8)
+axes.SetAxisTitleTextProperty(tprop)
+axes.SetAxisLabelTextProperty(tprop)
+ren.AddViewProp(axes)
+
+# Create a vtkCubeAxesActor2D.  Use the closest vertex to the camera to
+# determine where to draw the axes.  Add the actor to the renderer.
+axes2 = Vtk::CubeAxesActor2D.new
+axes2.SetViewProp(foheActor)
+axes2.SetCamera(ren2.GetActiveCamera)
+axes2.SetLabelFormat("%6.4g")
+axes2.SetFlyModeToClosestTriad
+axes2.SetFontFactor(0.8)
+axes2.ScalingOff
+axes2.SetAxisTitleTextProperty(tprop)
+axes2.SetAxisLabelTextProperty(tprop)
+ren2.AddViewProp(axes2)
+
+# Set up a check for aborting rendering.
+CheckAbort = Proc.new{|obj, event|
+    # obj will be the object generating the event.  In this case it
+    # is renWin.    
+    if obj.GetEventPending != 0
+        obj.SetAbortRender(1)
+    end
+}
+
+renWin.AddObserver("AbortCheckEvent", CheckAbort)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Annotation/Ruby/DispAllFonts.rb VTK/Examples/Annotation/Ruby/DispAllFonts.rb
--- VTK_org/Examples/Annotation/Ruby/DispAllFonts.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Annotation/Ruby/DispAllFonts.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,142 @@
+#!/usr/bin/env ruby
+
+# This example displays all possible combinations of font families &&
+# styles.  This example also shows how to create a simple Tkinter
+# based GUI for VTK-Ruby.
+
+require 'vtk'
+require 'vtk/tk'
+
+# We set the font size constraints, default text && colors
+current_font_size = 16
+min_font_size = 3
+max_font_size = 50
+
+default_text = "ABCDEFGHIJKLMnopqrstuvwxyz(0123456789, !@#%-=_+.:,./<>?"
+
+# set default_text "The quick red fox"
+
+text_color = [246/255.0, 255/255.0, 11/255.0]
+bg_color = [56/255.0, 56/255.0, 154/255.0]
+
+# We create the render window which will show up on the screen
+# We put our renderer into the render window using AddRenderer. 
+# Do  !set the size of the window here.
+renWin = Vtk::RenderWindow.new
+ren = Vtk::Renderer.new
+ren.SetBackground(bg_color)
+renWin.AddRenderer(ren)
+
+# We create text actors for each font family && several combinations
+# of bold, italic && shadowed style.
+text_actors = []
+for family in ["Arial", "Courier", "Times"]
+    for colors in [[0, 0, 0], [0, 0, 1], [1, 0, 0], [0, 1, 0], [1, 1, 0]]
+        bold, italic, shadow = colors
+        mapper = Vtk::TextMapper.new
+        attribs = []
+        if bold
+            attribs.push("b")
+        end
+        if italic
+            attribs.push("i")
+        end
+        if shadow
+            attribs.push("s")
+        end
+
+        face_name = family
+        if attribs.length
+            face_name = face_name + "(" + attribs.join(",") + ")"
+        end
+
+        mapper.SetInput(face_name + ": " + default_text)        
+        tprop = mapper.GetTextProperty
+        eval("tprop.SetFontFamilyTo%s"%family)
+        tprop.SetColor(text_color)
+        tprop.SetBold(bold)
+        tprop.SetItalic(italic)
+        tprop.SetShadow(shadow)
+
+        actor = Vtk::Actor2D.new
+        actor.SetMapper(mapper)
+        text_actors.push(actor)
+        ren.AddActor(actor)
+    end
+end
+
+
+# Now setup the Tk GUI.
+
+# Create the root window.
+root = TkRoot.new
+
+# vtkTkRenderWindowInteractor is a Tk widget that we can render into.
+# It has a GetRenderWindow method that returns a vtkRenderWindow.
+# This can then be used to create a vtkRenderer && etc. We can also
+# specify a vtkRenderWindow to be used when creating the widget by
+# using the rw keyword argument, which is what we do here by using
+# renWin. It also takes width && height options that can be used to
+# specify the widget size, hence the render window size.
+vtkw = Vtk::TkRenderWindowInteractor.new(root, 'rw'=>renWin, 'width'=>800)
+
+
+# Once the VTK widget has been created it can be inserted into a whole
+# Tk GUI as well as any other standard Tk widgets.
+
+# This function is called by the slider-widget handler whenever the
+# slider value changes (either through user interaction ||
+# programmatically). It receives the slider value as parameter. We
+# update the corresponding VTK objects by calling the SetFontSize
+# method using this parameter && we render the scene to update the
+# pipeline.
+set_font_size = Proc.new{|sz|
+  size = sz.to_i
+  i = 0
+  for actor in text_actors
+    i += 1
+    actor.GetMapper.GetTextProperty.SetFontSize(size)
+    actor.SetDisplayPosition(10, i*(size+5))
+  end
+
+  renWin.SetSize(800, 20+i*(size+5))
+  renWin.Render
+}
+
+# We create a size slider controlling the font size.  The orientation
+# of this widget is horizontal (orient option). We label it using the
+# label option. Finally, we bind the scale to Ruby code by assigning
+# the command option to the name of a Ruby function.  Whenever the
+# slider value changes this function will be called, enabling us to
+# propagate this GUI setting to the corresponding VTK object.
+size_slider = TkScale.new(root,
+                          'from'=>min_font_size, 'to'=>max_font_size,
+                          'res'=>1, 'orient'=>'horizontal',
+                          'label'=>"Font size:",
+                          'command'=>set_font_size)
+size_slider.set(current_font_size)
+
+# Finally we pack the VTK widget && the sliders on top of each other 
+# (side='top') inside the main root widget.
+vtkw.Initialize
+size_slider.pack('side'=>"top", 'fill'=>"both")
+vtkw.pack('side'=>"top", 'fill'=>'both', 'expand'=>1)
+
+
+# Define a quit method that exits cleanly.
+quit = Proc.new{
+  exit
+}
+
+# We handle the WM_DELETE_WINDOW protocal request. This request is
+# triggered when the widget is closed using the standard window
+# manager icons || buttons. In this case the quit function will be
+# called && it will free up any objects we created then exit the
+# application.
+root.protocol("WM_DELETE_WINDOW", quit)
+
+renWin.Render
+vtkw.Start
+
+# start the Tkinter event loop.
+root.mainloop
diff -uNr VTK_org/Examples/Annotation/Ruby/labeledMesh.rb VTK/Examples/Annotation/Ruby/labeledMesh.rb
--- VTK_org/Examples/Annotation/Ruby/labeledMesh.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Annotation/Ruby/labeledMesh.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,152 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of vtkLabeledDataMapper.  This
+# class is used for displaying numerical data from an underlying data
+# set.  In the case of this example, the underlying data are the point
+# && cell ids.
+
+require 'vtk'
+
+# Create a selection window.  We will display the point && cell ids
+# that lie within this window.
+xmin = 200
+@xLength = 100
+xmax = xmin + @xLength
+ymin = 200
+@yLength = 100
+ymax = ymin + @yLength
+
+@pts = Vtk::Points.new
+@pts.InsertPoint(0, xmin, ymin, 0)
+@pts.InsertPoint(1, xmax, ymin, 0)
+@pts.InsertPoint(2, xmax, ymax, 0)
+@pts.InsertPoint(3, xmin, ymax, 0)
+rect = Vtk::CellArray.new
+rect.InsertNextCell(5)
+rect.InsertCellPoint(0)
+rect.InsertCellPoint(1)
+rect.InsertCellPoint(2)
+rect.InsertCellPoint(3)
+rect.InsertCellPoint(0)
+selectRect = Vtk::PolyData.new
+selectRect.SetPoints(@pts)
+selectRect.SetLines(rect)
+rectMapper = Vtk::PolyDataMapper2D.new
+rectMapper.SetInput(selectRect)
+rectActor = Vtk::Actor2D.new
+rectActor.SetMapper(rectMapper)
+
+# Create a sphere && its associated mapper && actor.
+sphere = Vtk::SphereSource.new
+sphereMapper = Vtk::PolyDataMapper.new
+sphereMapper.SetInputConnection(sphere.GetOutputPort)
+sphereMapper.GlobalImmediateModeRenderingOn
+sphereActor = Vtk::Actor.new
+sphereActor.SetMapper(sphereMapper)
+
+# Generate data arrays containing point && cell ids
+ids = Vtk::IdFilter.new
+ids.SetInputConnection(sphere.GetOutputPort)
+ids.PointIdsOn
+ids.CellIdsOn
+ids.FieldDataOn
+
+# Create the renderer here because vtkSelectVisiblePoints needs it.
+ren = Vtk::Renderer.new
+
+# Create labels for points
+@visPts = Vtk::SelectVisiblePoints.new
+@visPts.SetInputConnection(ids.GetOutputPort)
+@visPts.SetRenderer(ren)
+@visPts.SelectionWindowOn
+@visPts.SetSelection(xmin, xmin + @xLength, ymin, ymin + @yLength)
+
+# Create the mapper to display the point ids.  Specify the format to
+# use for the labels.  Also create the associated actor.
+ldm = Vtk::LabeledDataMapper.new
+ldm.SetInputConnection(@visPts.GetOutputPort)
+ldm.SetLabelFormat("%g")
+ldm.SetLabelModeToLabelFieldData
+pointLabels = Vtk::Actor2D.new
+pointLabels.SetMapper(ldm)
+
+# Create labels for cells
+cc = Vtk::CellCenters.new
+cc.SetInputConnection(ids.GetOutputPort)
+@visCells = Vtk::SelectVisiblePoints.new
+@visCells.SetInputConnection(cc.GetOutputPort)
+@visCells.SetRenderer(ren)
+@visCells.SelectionWindowOn
+@visCells.SetSelection(xmin, xmin + @xLength, ymin, ymin + @yLength)
+
+# Create the mapper to display the cell ids.  Specify the format to
+# use for the labels.  Also create the associated actor.
+cellMapper = Vtk::LabeledDataMapper.new
+cellMapper.SetInputConnection(@visCells.GetOutputPort)
+cellMapper.SetLabelFormat("%g")
+cellMapper.SetLabelModeToLabelFieldData
+cellMapper.GetLabelTextProperty.SetColor(0, 1, 0)
+cellLabels = Vtk::Actor2D.new
+cellLabels.SetMapper(cellMapper)
+
+# Create the RenderWindow && RenderWindowInteractor
+@renWin = Vtk::RenderWindow.new
+@renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(@renWin)
+
+# Add the actors to the renderer; set the background && size;
+# render
+ren.AddActor(sphereActor)
+ren.AddActor2D(rectActor)
+ren.AddActor2D(pointLabels)
+ren.AddActor2D(cellLabels)
+
+ren.SetBackground(1, 1, 1)
+@renWin.SetSize(500, 500)
+
+# Create a function to move the selection window across the data set.
+def moveWindow
+    for y in 4...12
+        for x in 4...12
+            PlaceWindow(x*25, y*25) 
+        end
+    end
+end
+
+
+# Create a function to draw the selection window at each location it
+# is moved to.
+def PlaceWindow(xmin, ymin)
+
+    xmax = xmin + @xLength
+    ymax = ymin + @yLength
+
+    @visPts.SetSelection(xmin, xmax, ymin, ymax)
+    @visCells.SetSelection(xmin, xmax, ymin, ymax)
+
+    @pts.InsertPoint(0, xmin, ymin, 0)
+    @pts.InsertPoint(1, xmax, ymin, 0)
+    @pts.InsertPoint(2, xmax, ymax, 0)
+    @pts.InsertPoint(3, xmin, ymax, 0)
+    # Call Modified because InsertPoints does  !modify vtkPoints
+    # (for performance reasons)
+    @pts.Modified
+    @renWin.Render
+end
+
+
+# Initialize the interactor.
+iren.Initialize
+@renWin.Render
+
+# Move the selection window across the data set.
+moveWindow
+
+# Put the selection window in the center of the render window.
+# This works because the xmin = ymin = 200, xLength = yLength = 100, &&
+# the render window size is 500 x 500.
+PlaceWindow(xmin, ymin)
+
+# Now start normal interaction.
+iren.Start
diff -uNr VTK_org/Examples/Annotation/Ruby/multiLineText.rb VTK/Examples/Annotation/Ruby/multiLineText.rb
--- VTK_org/Examples/Annotation/Ruby/multiLineText.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Annotation/Ruby/multiLineText.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,188 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of multiline 2D text using
+# vtkTextMappers.  It shows several justifications as well as
+# single-line && multiple-line text inputs.
+
+require 'vtk'
+
+font_size = 14
+
+# Create the text mappers && the associated Actor2Ds.
+
+# The font && text properties (except justification) are the same for
+# each single line mapper. Let's create a common text property object
+singleLineTextProp = Vtk::TextProperty.new
+singleLineTextProp.SetFontSize(font_size)
+singleLineTextProp.SetFontFamilyToArial
+singleLineTextProp.BoldOff
+singleLineTextProp.ItalicOff
+singleLineTextProp.ShadowOff
+
+# The font && text properties (except justification) are the same for
+# each multi line mapper. Let's create a common text property object
+multiLineTextProp = Vtk::TextProperty.new
+multiLineTextProp.ShallowCopy(singleLineTextProp)
+multiLineTextProp.BoldOn
+multiLineTextProp.ItalicOn
+multiLineTextProp.ShadowOn
+multiLineTextProp.SetLineSpacing(0.8)
+
+# The text is on a single line && bottom-justified.
+singleLineTextB = Vtk::TextMapper.new
+singleLineTextB.SetInput("Single line (bottom)")
+tprop = singleLineTextB.GetTextProperty
+tprop.ShallowCopy(singleLineTextProp)
+tprop.SetVerticalJustificationToBottom
+tprop.SetColor(1, 0, 0)
+singleLineTextActorB = Vtk::Actor2D.new
+singleLineTextActorB.SetMapper(singleLineTextB)
+singleLineTextActorB.GetPositionCoordinate.SetCoordinateSystemToNormalizedDisplay
+singleLineTextActorB.GetPositionCoordinate.SetValue(0.05, 0.85)
+
+# The text is on a single line && center-justified (vertical
+# justification).
+singleLineTextC = Vtk::TextMapper.new
+singleLineTextC.SetInput("Single line (centered)")
+tprop = singleLineTextC.GetTextProperty
+tprop.ShallowCopy(singleLineTextProp)
+tprop.SetVerticalJustificationToCentered
+tprop.SetColor(0, 1, 0)
+singleLineTextActorC = Vtk::Actor2D.new
+singleLineTextActorC.SetMapper(singleLineTextC)
+singleLineTextActorC.GetPositionCoordinate.SetCoordinateSystemToNormalizedDisplay
+singleLineTextActorC.GetPositionCoordinate.SetValue(0.05, 0.75)
+
+# The text is on a single line && top-justified.
+singleLineTextT = Vtk::TextMapper.new
+singleLineTextT.SetInput("Single line (top)")
+tprop = singleLineTextT.GetTextProperty
+tprop.ShallowCopy(singleLineTextProp)
+tprop.SetVerticalJustificationToTop
+tprop.SetColor(0, 0, 1)
+singleLineTextActorT = Vtk::Actor2D.new
+singleLineTextActorT.SetMapper(singleLineTextT)
+singleLineTextActorT.GetPositionCoordinate.SetCoordinateSystemToNormalizedDisplay
+singleLineTextActorT.GetPositionCoordinate.SetValue(0.05, 0.65)
+
+# The text is on multiple lines && left- && top-justified.
+textMapperL = Vtk::TextMapper.new
+textMapperL.SetInput("This is\nmulti-line\ntext output\n(left-top)")
+tprop = textMapperL.GetTextProperty
+tprop.ShallowCopy(multiLineTextProp)
+tprop.SetJustificationToLeft
+tprop.SetVerticalJustificationToTop
+tprop.SetColor(1, 0, 0)
+textActorL = Vtk::Actor2D.new
+textActorL.SetMapper(textMapperL)
+textActorL.GetPositionCoordinate.SetCoordinateSystemToNormalizedDisplay
+textActorL.GetPositionCoordinate.SetValue(0.05, 0.5)
+
+# The text is on multiple lines && center-justified (both horizontal &&
+# vertical).
+textMapperC = Vtk::TextMapper.new
+textMapperC.SetInput("This is\nmulti-line\ntext output\n(centered)")
+tprop = textMapperC.GetTextProperty
+tprop.ShallowCopy(multiLineTextProp)
+tprop.SetJustificationToCentered
+tprop.SetVerticalJustificationToCentered
+tprop.SetColor(0, 1, 0)
+textActorC = Vtk::Actor2D.new
+textActorC.SetMapper(textMapperC)
+textActorC.GetPositionCoordinate.SetCoordinateSystemToNormalizedDisplay
+textActorC.GetPositionCoordinate.SetValue(0.5, 0.5)
+
+# The text is on multiple lines && right- && bottom-justified.
+textMapperR = Vtk::TextMapper.new
+textMapperR.SetInput("This is\nmulti-line\ntext output\n(right-bottom)")
+tprop = textMapperR.GetTextProperty
+tprop.ShallowCopy(multiLineTextProp)
+tprop.SetJustificationToRight
+tprop.SetVerticalJustificationToBottom
+tprop.SetColor(0, 0, 1)
+textActorR = Vtk::Actor2D.new
+textActorR.SetMapper(textMapperR)
+textActorR.GetPositionCoordinate.SetCoordinateSystemToNormalizedDisplay
+textActorR.GetPositionCoordinate.SetValue(0.95, 0.5)
+
+# Draw the grid to demonstrate the placement of the text.
+
+# Set up the necessary points.
+Pts = Vtk::Points.new
+Pts.InsertNextPoint(0.05, 0.0, 0.0)
+Pts.InsertNextPoint(0.05, 1.0, 0.0)
+Pts.InsertNextPoint(0.5, 0.0, 0.0)
+Pts.InsertNextPoint(0.5, 1.0, 0.0)
+Pts.InsertNextPoint(0.95, 0.0, 0.0)
+Pts.InsertNextPoint(0.95, 1.0, 0.0)
+Pts.InsertNextPoint(0.0, 0.5, 0.0)
+Pts.InsertNextPoint(1.0, 0.5, 0.0)
+Pts.InsertNextPoint(0.00, 0.85, 0.0)
+Pts.InsertNextPoint(0.50, 0.85, 0.0)
+Pts.InsertNextPoint(0.00, 0.75, 0.0)
+Pts.InsertNextPoint(0.50, 0.75, 0.0)
+Pts.InsertNextPoint(0.00, 0.65, 0.0)
+Pts.InsertNextPoint(0.50, 0.65, 0.0)
+# Set up the lines that use these points.
+Lines = Vtk::CellArray.new
+Lines.InsertNextCell(2)
+Lines.InsertCellPoint(0)
+Lines.InsertCellPoint(1)
+Lines.InsertNextCell(2)
+Lines.InsertCellPoint(2)
+Lines.InsertCellPoint(3)
+Lines.InsertNextCell(2)
+Lines.InsertCellPoint(4)
+Lines.InsertCellPoint(5)
+Lines.InsertNextCell(2)
+Lines.InsertCellPoint(6)
+Lines.InsertCellPoint(7)
+Lines.InsertNextCell(2)
+Lines.InsertCellPoint(8)
+Lines.InsertCellPoint(9)
+Lines.InsertNextCell(2)
+Lines.InsertCellPoint(10)
+Lines.InsertCellPoint(11)
+Lines.InsertNextCell(2)
+Lines.InsertCellPoint(12)
+Lines.InsertCellPoint(13)
+# Create a grid that uses these points && lines.
+Grid = Vtk::PolyData.new
+Grid.SetPoints(Pts)
+Grid.SetLines(Lines)
+# Set up the coordinate system.
+normCoords = Vtk::Coordinate.new
+normCoords.SetCoordinateSystemToNormalizedViewport
+
+# Set up the mapper && actor (2D) for the grid.
+mapper = Vtk::PolyDataMapper2D.new
+mapper.SetInput(Grid)
+mapper.SetTransformCoordinate(normCoords)
+gridActor = Vtk::Actor2D.new
+gridActor.SetMapper(mapper)
+gridActor.GetProperty.SetColor(0.1, 0.1, 0.1)
+
+# Create the Renderer, RenderWindow, && RenderWindowInteractor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer; set the background && size; zoom in
+# closer to the image; render
+ren.AddActor2D(textActorL)
+ren.AddActor2D(textActorC)
+ren.AddActor2D(textActorR)
+ren.AddActor2D(singleLineTextActorB)
+ren.AddActor2D(singleLineTextActorC)
+ren.AddActor2D(singleLineTextActorT)
+ren.AddActor2D(gridActor)
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(500, 300)
+ren.GetActiveCamera.Zoom(1.5)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Annotation/Ruby/TestTextOldWay.rb VTK/Examples/Annotation/Ruby/TestTextOldWay.rb
--- VTK_org/Examples/Annotation/Ruby/TestTextOldWay.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Annotation/Ruby/TestTextOldWay.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,56 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of 2D text the old way by using a
+# vtkTextMapper && a vtkScaledTextActor.
+
+require 'vtk'
+
+# Create a sphere source, mapper, && actor
+sphere = Vtk::SphereSource.new
+
+sphereMapper = Vtk::PolyDataMapper.new
+sphereMapper.SetInputConnection(sphere.GetOutputPort)
+Vtk::PolyDataMapper.GlobalImmediateModeRenderingOn
+sphereActor = Vtk::LODActor.new
+sphereActor.SetMapper(sphereMapper)
+
+# Create a text mapper.
+textMapper = Vtk::TextMapper.new
+textMapper.SetInput("This is a sphere")
+
+# Set the text, font, justification, && text properties (bold,
+# italics, etc.).
+tprop = textMapper.GetTextProperty
+tprop.SetFontSize(18)
+tprop.SetFontFamilyToArial
+tprop.SetJustificationToCentered
+tprop.BoldOn
+tprop.ItalicOn
+tprop.ShadowOn
+tprop.SetColor(0, 0, 1)
+
+# Create a scaled text actor. Set the position of the text.
+textActor = Vtk::ScaledTextActor.new
+textActor.SetMapper(textMapper)
+textActor.SetDisplayPosition(90, 50)
+
+# Create the Renderer, RenderWindow, RenderWindowInteractor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer; set the background && size; zoom
+# in; && render.
+ren.AddActor2D(textActor)
+ren.AddActor(sphereActor)
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(250, 125)
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.5)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Annotation/Ruby/TestText.rb VTK/Examples/Annotation/Ruby/TestText.rb
--- VTK_org/Examples/Annotation/Ruby/TestText.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Annotation/Ruby/TestText.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,56 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of 2D text.
+
+require 'vtk'
+
+# Create a sphere source, mapper, && actor
+sphere = Vtk::SphereSource.new
+
+sphereMapper = Vtk::PolyDataMapper.new
+sphereMapper.SetInputConnection(sphere.GetOutputPort)
+Vtk::PolyDataMapper.GlobalImmediateModeRenderingOn
+sphereActor = Vtk::LODActor.new
+sphereActor.SetMapper(sphereMapper)
+
+# Create a scaled text actor. 
+# Set the text, font, justification, && properties (bold, italics,
+# etc.).
+textActor = Vtk::TextActor.new
+textActor.ScaledTextOn
+textActor.SetDisplayPosition(90, 50)
+textActor.SetInput("This is a sphere")
+
+# Set coordinates to match the old vtkScaledTextActor default value
+textActor.GetPosition2Coordinate.SetCoordinateSystemToNormalizedViewport
+textActor.GetPosition2Coordinate.SetValue(0.6, 0.1)
+
+tprop = textActor.GetTextProperty
+tprop.SetFontSize(18)
+tprop.SetFontFamilyToArial
+tprop.SetJustificationToCentered
+tprop.BoldOn
+tprop.ItalicOn
+tprop.ShadowOn
+tprop.SetColor(0, 0, 1)
+
+# Create the Renderer, RenderWindow, RenderWindowInteractor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer; set the background && size; zoom
+# in; && render.
+ren.AddActor2D(textActor)
+ren.AddActor(sphereActor)
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(250, 125)
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.5)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Annotation/Ruby/textOrigin.rb VTK/Examples/Annotation/Ruby/textOrigin.rb
--- VTK_org/Examples/Annotation/Ruby/textOrigin.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Annotation/Ruby/textOrigin.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of vtkVectorText && vtkFollower.
+# vtkVectorText is used to create 3D annotation.  vtkFollower is used to
+# position the 3D text && to ensure that the text always faces the
+# renderer's active camera (i.e., the text is always readable).
+
+require 'vtk'
+
+# Create the axes && the associated mapper && actor.
+axes = Vtk::Axes.new
+axes.SetOrigin(0, 0, 0)
+axesMapper = Vtk::PolyDataMapper.new
+axesMapper.SetInputConnection(axes.GetOutputPort)
+axesActor = Vtk::Actor.new
+axesActor.SetMapper(axesMapper)
+
+# Create the 3D text && the associated mapper && follower (a type of
+# actor).  Position the text so it is displayed over the origin of the
+# axes.
+atext = Vtk::VectorText.new
+atext.SetText("Origin")
+textMapper = Vtk::PolyDataMapper.new
+textMapper.SetInputConnection(atext.GetOutputPort)
+textActor = Vtk::Follower.new
+textActor.SetMapper(textMapper)
+textActor.SetScale(0.2, 0.2, 0.2)
+textActor.AddPosition(0, -0.1, 0)
+
+# Create the Renderer, RenderWindow, && RenderWindowInteractor.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer.
+ren.AddActor(axesActor)
+ren.AddActor(textActor)
+
+# Zoom in closer.
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.6)
+
+# Reset the clipping range of the camera; set the camera of the
+# follower; render.
+ren.ResetCameraClippingRange
+textActor.SetCamera(ren.GetActiveCamera)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Annotation/Ruby/xyPlot.rb VTK/Examples/Annotation/Ruby/xyPlot.rb
--- VTK_org/Examples/Annotation/Ruby/xyPlot.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Annotation/Ruby/xyPlot.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,195 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of vtkXYPlotActor to display three
+# probe lines using three different techniques.  In this example, we
+# are loading data using the vtkPLOT3DReader.  We are using the
+# vtkProbeFilter to extract the underlying point data along three
+# probe lines.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create a PLOT3D reader && load the data.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# Create three the line source to use for the probe lines.
+line = Vtk::LineSource.new
+line.SetResolution(30)
+
+# Move the line into place && create the probe filter.  For
+# vtkProbeFilter, the probe line is the input, && the underlying data
+# set is the source.
+transL1 = Vtk::Transform.new
+transL1.Translate(3.7, 0.0, 28.37)
+transL1.Scale(5, 5, 5)
+transL1.RotateY(90)
+tf = Vtk::TransformPolyDataFilter.new
+tf.SetInputConnection(line.GetOutputPort)
+tf.SetTransform(transL1)
+probe = Vtk::ProbeFilter.new
+probe.SetInputConnection(tf.GetOutputPort)
+probe.SetSource(pl3d.GetOutput)
+
+# Move the line again && create another probe filter.
+transL2 = Vtk::Transform.new
+transL2.Translate(9.2, 0.0, 31.20)
+transL2.Scale(5, 5, 5)
+transL2.RotateY(90)
+tf2 = Vtk::TransformPolyDataFilter.new
+tf2.SetInputConnection(line.GetOutputPort)
+tf2.SetTransform(transL2)
+probe2 = Vtk::ProbeFilter.new
+probe2.SetInputConnection(tf2.GetOutputPort)
+probe2.SetSource(pl3d.GetOutput)
+
+# Move the line again && create a third probe filter.
+transL3 = Vtk::Transform.new
+transL3.Translate(13.27, 0.0, 33.40)
+transL3.Scale(4.5, 4.5, 4.5)
+transL3.RotateY(90)
+tf3 = Vtk::TransformPolyDataFilter.new
+tf3.SetInputConnection(line.GetOutputPort)
+tf3.SetTransform(transL3)
+probe3 = Vtk::ProbeFilter.new
+probe3.SetInputConnection(tf3.GetOutputPort)
+probe3.SetSource(pl3d.GetOutput)
+
+# Create a vtkAppendPolyData to merge the output of the three probe
+# filters into one data set.
+appendF = Vtk::AppendPolyData.new
+appendF.AddInput(probe.GetPolyDataOutput)
+appendF.AddInput(probe2.GetPolyDataOutput)
+appendF.AddInput(probe3.GetPolyDataOutput)
+
+# Create a tube filter to represent the lines as tubes.  Set up the
+# associated mapper && actor.
+tuber = Vtk::TubeFilter.new
+tuber.SetInputConnection(appendF.GetOutputPort)
+tuber.SetRadius(0.1)
+lineMapper = Vtk::PolyDataMapper.new
+lineMapper.SetInputConnection(tuber.GetOutputPort)
+lineActor = Vtk::Actor.new
+lineActor.SetMapper(lineMapper)
+
+# Create an xy-plot using the output of the 3 probe filters as input.
+# The x-values we are plotting are arc length.
+xyplot = Vtk::XYPlotActor.new
+xyplot.AddInput(probe.GetOutput)
+xyplot.AddInput(probe2.GetOutput)
+xyplot.AddInput(probe3.GetOutput)
+xyplot.GetPositionCoordinate.SetValue(0.0, 0.67, 0)
+xyplot.GetPosition2Coordinate.SetValue(1.0, 0.33, 0) #relative to Position
+xyplot.SetXValuesToArcLength
+xyplot.SetNumberOfXLabels(6)
+xyplot.SetTitle("Pressure vs. Arc Length (Zoomed View)")
+xyplot.SetXTitle("")
+xyplot.SetYTitle("P")
+xyplot.SetXRange(0.1, 0.35)
+xyplot.SetYRange(0.2, 0.4)
+xyplot.GetProperty.SetColor(0, 0, 0)
+xyplot.GetProperty.SetLineWidth(2)
+# Set text prop color (same color for backward compat with test)
+# Assign same object to all text props
+tprop = xyplot.GetTitleTextProperty
+tprop.SetColor(xyplot.GetProperty.GetColor)
+xyplot.SetAxisTitleTextProperty(tprop)
+xyplot.SetAxisLabelTextProperty(tprop)
+
+# Create an xy-plot using the output of the 3 probe filters as input.
+# The x-values we are plotting are normalized arc length.
+xyplot2 = Vtk::XYPlotActor.new
+xyplot2.AddInput(probe.GetOutput)
+xyplot2.AddInput(probe2.GetOutput)
+xyplot2.AddInput(probe3.GetOutput)
+xyplot2.GetPositionCoordinate.SetValue(0.00, 0.33, 0)
+xyplot2.GetPosition2Coordinate.SetValue(1.0, 0.33, 0) #relative to Position
+xyplot2.SetXValuesToNormalizedArcLength
+xyplot2.SetNumberOfXLabels(6)
+xyplot2.SetTitle("Pressure vs. Normalized Arc Length")
+xyplot2.SetXTitle("")
+xyplot2.SetYTitle("P")
+xyplot2.PlotPointsOn
+xyplot2.PlotLinesOff
+xyplot2.GetProperty.SetColor(1, 0, 0)
+xyplot2.GetProperty.SetPointSize(2)
+# Set text prop color (same color for backward compat with test)
+# Assign same object to all text props
+tprop = xyplot2.GetTitleTextProperty
+tprop.SetColor(xyplot2.GetProperty.GetColor)
+xyplot2.SetAxisTitleTextProperty(tprop)
+xyplot2.SetAxisLabelTextProperty(tprop)
+
+# Create an xy-plot using the output of the 3 probe filters as input.
+# The x-values we are plotting are the underlying point data values.
+xyplot3 = Vtk::XYPlotActor.new
+xyplot3.AddInput(probe.GetOutput)
+xyplot3.AddInput(probe2.GetOutput)
+xyplot3.AddInput(probe3.GetOutput)
+xyplot3.GetPositionCoordinate.SetValue(0.0, 0.0, 0)
+xyplot3.GetPosition2Coordinate.SetValue(1.0, 0.33, 0) #relative to Position
+xyplot3.SetXValuesToIndex
+xyplot3.SetNumberOfXLabels(6)
+xyplot3.SetTitle("Pressure vs. Point Id")
+xyplot3.SetXTitle("Probe Length")
+xyplot3.SetYTitle("P")
+xyplot3.PlotPointsOn
+xyplot3.GetProperty.SetColor(0, 0, 1)
+xyplot3.GetProperty.SetPointSize(3)
+# Set text prop color (same color for backward compat with test)
+# Assign same object to all text props
+tprop = xyplot3.GetTitleTextProperty
+tprop.SetColor(xyplot3.GetProperty.GetColor)
+xyplot3.SetAxisTitleTextProperty(tprop)
+xyplot3.SetAxisLabelTextProperty(tprop)
+
+# Draw an outline of the PLOT3D data set.
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineActor.GetProperty.SetColor(0, 0, 0)
+
+# Create the Renderers, RenderWindow, && RenderWindowInteractor.
+ren = Vtk::Renderer.new
+ren2 = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+renWin.AddRenderer(ren2)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Set the background, viewport (necessary because we want to have the
+# renderers draw to different parts of the render window) of the first
+# renderer.  Add the outline && line actors to the renderer.
+ren.SetBackground(0.6784, 0.8471, 0.9020)
+ren.SetViewport(0, 0, 0.5, 1)
+ren.AddActor(outlineActor)
+ren.AddActor(lineActor)
+
+# Set the background && viewport of the second renderer.  Add the
+# xy-plot actors to the renderer.  Set the size of the render window.
+ren2.SetBackground(1, 1, 1)
+ren2.SetViewport(0.5, 0.0, 1.0, 1.0)
+ren2.AddActor2D(xyplot)
+ren2.AddActor2D(xyplot2)
+ren2.AddActor2D(xyplot3)
+renWin.SetSize(500, 250)
+
+# Set up the camera parameters.
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(3.95297, 100)
+cam1.SetFocalPoint(8.88908, 0.595038, 29.3342)
+cam1.SetPosition(-12.3332, 31.7479, 41.2387)
+cam1.SetViewUp(0.060772, -0.319905, 0.945498)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/DataManipulation/Ruby/Arrays.rb VTK/Examples/DataManipulation/Ruby/Arrays.rb
--- VTK_org/Examples/DataManipulation/Ruby/Arrays.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/DataManipulation/Ruby/Arrays.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,89 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of VTK data arrays as attribute
+# data as well as field data. It creates geometry (vtkPolyData) as
+# well as attribute data explicitly.
+
+require 'vtk'
+
+# Create a float array which represents the points.
+pcoords = Vtk::FloatArray.new
+# Note that by default, an array has 1 component.
+# We have to change it to 3 for points
+pcoords.SetNumberOfComponents(3)
+# We ask pcoords to allocate room for at least 4 tuples
+# && set the number of tuples to 4.
+pcoords.SetNumberOfTuples(4)
+# Assign each tuple. There are 5 specialized versions of SetTuple:
+# SetTuple1 SetTuple2 SetTuple3 SetTuple4 SetTuple9
+# These take 1, 2, 3, 4 && 9 components respectively.
+pcoords.SetTuple3(0, 0.0, 0.0, 0.0)
+pcoords.SetTuple3(1, 0.0, 1.0, 0.0)
+pcoords.SetTuple3(2, 1.0, 0.0, 0.0)
+pcoords.SetTuple3(3, 1.0, 1.0, 0.0)
+
+# Create vtkPoints && assign pcoords as the internal data array.
+points = Vtk::Points.new
+points.SetData(pcoords)
+
+# Create the cells. In this case, a triangle strip with 2 triangles
+# (which can be represented by 4 points)
+strips = Vtk::CellArray.new
+strips.InsertNextCell(4)
+strips.InsertCellPoint(0)
+strips.InsertCellPoint(1)
+strips.InsertCellPoint(2)
+strips.InsertCellPoint(3)
+
+# Create an integer array with 4 tuples. Note that when using
+# InsertNextValue (or InsertNextTuple1 which is equivalent in
+# this situation), the array will expand automatically
+temperature = Vtk::IntArray.new
+temperature.SetName("Temperature")
+temperature.InsertNextValue(10)
+temperature.InsertNextValue(20)
+temperature.InsertNextValue(30)
+temperature.InsertNextValue(40)
+
+# Create a double array.
+vorticity = Vtk::DoubleArray.new
+vorticity.SetName("Vorticity")
+vorticity.InsertNextValue(2.7)
+vorticity.InsertNextValue(4.1)
+vorticity.InsertNextValue(5.3)
+vorticity.InsertNextValue(3.4)
+
+# Create the dataset. In this case, we create a vtkPolyData
+polydata = Vtk::PolyData.new
+# Assign points && cells
+polydata.SetPoints(points)
+polydata.SetStrips(strips)
+# Assign scalars
+polydata.GetPointData.SetScalars(temperature)
+# Add the vorticity array. In this example, this field
+# is not used.
+polydata.GetPointData.AddArray(vorticity)
+
+# Create the mapper && set the appropriate scalar range
+# (default is (0,1)
+mapper = Vtk::PolyDataMapper.new
+mapper.SetInput(polydata)
+mapper.SetScalarRange(0, 40)
+
+# Create an actor.
+actor = Vtk::Actor.new
+actor.SetMapper(mapper)
+
+# Create the rendering objects.
+ren = Vtk::Renderer.new
+ren.AddActor(actor)
+
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/DataManipulation/Ruby/BuildUGrid.rb VTK/Examples/DataManipulation/Ruby/BuildUGrid.rb
--- VTK_org/Examples/DataManipulation/Ruby/BuildUGrid.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/DataManipulation/Ruby/BuildUGrid.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,386 @@
+#!/usr/bin/env ruby
+
+# This example shows how to manually construct unstructured grids
+# using Ruby.  Unstructured grids require explicit point && cell
+# representations, so every point && cell must be created, && then
+# added to the vtkUnstructuredGrid instance.
+
+require 'vtk'
+
+# Create several unstructured grids each containing a cell of a
+# different type.
+voxelPoints = Vtk::Points.new
+voxelPoints.SetNumberOfPoints(8)
+voxelPoints.InsertPoint(0, 0, 0, 0)
+voxelPoints.InsertPoint(1, 1, 0, 0)
+voxelPoints.InsertPoint(2, 0, 1, 0)
+voxelPoints.InsertPoint(3, 1, 1, 0)
+voxelPoints.InsertPoint(4, 0, 0, 1)
+voxelPoints.InsertPoint(5, 1, 0, 1)
+voxelPoints.InsertPoint(6, 0, 1, 1)
+voxelPoints.InsertPoint(7, 1, 1, 1)
+aVoxel = Vtk::Voxel.new
+aVoxel.GetPointIds.SetId(0, 0)
+aVoxel.GetPointIds.SetId(1, 1)
+aVoxel.GetPointIds.SetId(2, 2)
+aVoxel.GetPointIds.SetId(3, 3)
+aVoxel.GetPointIds.SetId(4, 4)
+aVoxel.GetPointIds.SetId(5, 5)
+aVoxel.GetPointIds.SetId(6, 6)
+aVoxel.GetPointIds.SetId(7, 7)
+aVoxelGrid = Vtk::UnstructuredGrid.new
+aVoxelGrid.Allocate(1, 1)
+aVoxelGrid.InsertNextCell(aVoxel.GetCellType, aVoxel.GetPointIds)
+aVoxelGrid.SetPoints(voxelPoints)
+aVoxelMapper = Vtk::DataSetMapper.new
+aVoxelMapper.SetInput(aVoxelGrid)
+aVoxelActor = Vtk::Actor.new
+aVoxelActor.SetMapper(aVoxelMapper)
+aVoxelActor.GetProperty.SetDiffuseColor(1, 0, 0)
+
+hexahedronPoints = Vtk::Points.new
+hexahedronPoints.SetNumberOfPoints(8)
+hexahedronPoints.InsertPoint(0, 0, 0, 0)
+hexahedronPoints.InsertPoint(1, 1, 0, 0)
+hexahedronPoints.InsertPoint(2, 1, 1, 0)
+hexahedronPoints.InsertPoint(3, 0, 1, 0)
+hexahedronPoints.InsertPoint(4, 0, 0, 1)
+hexahedronPoints.InsertPoint(5, 1, 0, 1)
+hexahedronPoints.InsertPoint(6, 1, 1, 1)
+hexahedronPoints.InsertPoint(7, 0, 1, 1)
+aHexahedron = Vtk::Hexahedron.new
+aHexahedron.GetPointIds.SetId(0, 0)
+aHexahedron.GetPointIds.SetId(1, 1)
+aHexahedron.GetPointIds.SetId(2, 2)
+aHexahedron.GetPointIds.SetId(3, 3)
+aHexahedron.GetPointIds.SetId(4, 4)
+aHexahedron.GetPointIds.SetId(5, 5)
+aHexahedron.GetPointIds.SetId(6, 6)
+aHexahedron.GetPointIds.SetId(7, 7)
+aHexahedronGrid = Vtk::UnstructuredGrid.new
+aHexahedronGrid.Allocate(1, 1)
+aHexahedronGrid.InsertNextCell(aHexahedron.GetCellType,
+                               aHexahedron.GetPointIds)
+aHexahedronGrid.SetPoints(hexahedronPoints)
+aHexahedronMapper = Vtk::DataSetMapper.new
+aHexahedronMapper.SetInput(aHexahedronGrid)
+aHexahedronActor = Vtk::Actor.new
+aHexahedronActor.SetMapper(aHexahedronMapper)
+aHexahedronActor.AddPosition(2, 0, 0)
+aHexahedronActor.GetProperty.SetDiffuseColor(1, 1, 0)
+
+tetraPoints = Vtk::Points.new
+tetraPoints.SetNumberOfPoints(4)
+tetraPoints.InsertPoint(0, 0, 0, 0)
+tetraPoints.InsertPoint(1, 1, 0, 0)
+tetraPoints.InsertPoint(2, 0.5, 1, 0)
+tetraPoints.InsertPoint(3, 0.5, 0.5, 1)
+aTetra = Vtk::Tetra.new
+aTetra.GetPointIds.SetId(0, 0)
+aTetra.GetPointIds.SetId(1, 1)
+aTetra.GetPointIds.SetId(2, 2)
+aTetra.GetPointIds.SetId(3, 3)
+aTetraGrid = Vtk::UnstructuredGrid.new
+aTetraGrid.Allocate(1, 1)
+aTetraGrid.InsertNextCell(aTetra.GetCellType, aTetra.GetPointIds)
+aTetraGrid.SetPoints(tetraPoints)
+aTetraMapper = Vtk::DataSetMapper.new
+aTetraMapper.SetInput(aTetraGrid)
+aTetraActor = Vtk::Actor.new
+aTetraActor.SetMapper(aTetraMapper)
+aTetraActor.AddPosition(4, 0, 0)
+aTetraActor.GetProperty.SetDiffuseColor(0, 1, 0)
+
+wedgePoints = Vtk::Points.new
+wedgePoints.SetNumberOfPoints(6)
+wedgePoints.InsertPoint(0, 0, 1, 0)
+wedgePoints.InsertPoint(1, 0, 0, 0)
+wedgePoints.InsertPoint(2, 0, 0.5, 0.5)
+wedgePoints.InsertPoint(3, 1, 1, 0)
+wedgePoints.InsertPoint(4, 1, 0, 0)
+wedgePoints.InsertPoint(5, 1, 0.5, 0.5)
+aWedge = Vtk::Wedge.new
+aWedge.GetPointIds.SetId(0, 0)
+aWedge.GetPointIds.SetId(1, 1)
+aWedge.GetPointIds.SetId(2, 2)
+aWedge.GetPointIds.SetId(3, 3)
+aWedge.GetPointIds.SetId(4, 4)
+aWedge.GetPointIds.SetId(5, 5)
+aWedgeGrid = Vtk::UnstructuredGrid.new
+aWedgeGrid.Allocate(1, 1)
+aWedgeGrid.InsertNextCell(aWedge.GetCellType, aWedge.GetPointIds)
+aWedgeGrid.SetPoints(wedgePoints)
+aWedgeMapper = Vtk::DataSetMapper.new
+aWedgeMapper.SetInput(aWedgeGrid)
+aWedgeActor = Vtk::Actor.new
+aWedgeActor.SetMapper(aWedgeMapper)
+aWedgeActor.AddPosition(6, 0, 0)
+aWedgeActor.GetProperty.SetDiffuseColor(0, 1, 1)
+
+pyramidPoints = Vtk::Points.new
+pyramidPoints.SetNumberOfPoints(5)
+pyramidPoints.InsertPoint(0, 0, 0, 0)
+pyramidPoints.InsertPoint(1, 1, 0, 0)
+pyramidPoints.InsertPoint(2, 1, 1, 0)
+pyramidPoints.InsertPoint(3, 0, 1, 0)
+pyramidPoints.InsertPoint(4, 0.5, 0.5, 1)
+aPyramid = Vtk::Pyramid.new
+aPyramid.GetPointIds.SetId(0, 0)
+aPyramid.GetPointIds.SetId(1, 1)
+aPyramid.GetPointIds.SetId(2, 2)
+aPyramid.GetPointIds.SetId(3, 3)
+aPyramid.GetPointIds.SetId(4, 4)
+aPyramidGrid = Vtk::UnstructuredGrid.new
+aPyramidGrid.Allocate(1, 1)
+aPyramidGrid.InsertNextCell(aPyramid.GetCellType, aPyramid.GetPointIds)
+aPyramidGrid.SetPoints(pyramidPoints)
+aPyramidMapper = Vtk::DataSetMapper.new
+aPyramidMapper.SetInput(aPyramidGrid)
+aPyramidActor = Vtk::Actor.new
+aPyramidActor.SetMapper(aPyramidMapper)
+aPyramidActor.AddPosition(8, 0, 0)
+aPyramidActor.GetProperty.SetDiffuseColor(1, 0, 1)
+
+pixelPoints = Vtk::Points.new
+pixelPoints.SetNumberOfPoints(4)
+pixelPoints.InsertPoint(0, 0, 0, 0)
+pixelPoints.InsertPoint(1, 1, 0, 0)
+pixelPoints.InsertPoint(2, 0, 1, 0)
+pixelPoints.InsertPoint(3, 1, 1, 0)
+aPixel = Vtk::Pixel.new
+aPixel.GetPointIds.SetId(0, 0)
+aPixel.GetPointIds.SetId(1, 1)
+aPixel.GetPointIds.SetId(2, 2)
+aPixel.GetPointIds.SetId(3, 3)
+aPixelGrid = Vtk::UnstructuredGrid.new
+aPixelGrid.Allocate(1, 1)
+aPixelGrid.InsertNextCell(aPixel.GetCellType, aPixel.GetPointIds)
+aPixelGrid.SetPoints(pixelPoints)
+aPixelMapper = Vtk::DataSetMapper.new
+aPixelMapper.SetInput(aPixelGrid)
+aPixelActor = Vtk::Actor.new
+aPixelActor.SetMapper(aPixelMapper)
+aPixelActor.AddPosition(0, 0, 2)
+aPixelActor.GetProperty.SetDiffuseColor(0, 1, 1)
+
+quadPoints = Vtk::Points.new
+quadPoints.SetNumberOfPoints(4)
+quadPoints.InsertPoint(0, 0, 0, 0)
+quadPoints.InsertPoint(1, 1, 0, 0)
+quadPoints.InsertPoint(2, 1, 1, 0)
+quadPoints.InsertPoint(3, 0, 1, 0)
+aQuad = Vtk::Quad.new
+aQuad.GetPointIds.SetId(0, 0)
+aQuad.GetPointIds.SetId(1, 1)
+aQuad.GetPointIds.SetId(2, 2)
+aQuad.GetPointIds.SetId(3, 3)
+aQuadGrid = Vtk::UnstructuredGrid.new
+aQuadGrid.Allocate(1, 1)
+aQuadGrid.InsertNextCell(aQuad.GetCellType, aQuad.GetPointIds)
+aQuadGrid.SetPoints(quadPoints)
+aQuadMapper = Vtk::DataSetMapper.new
+aQuadMapper.SetInput(aQuadGrid)
+aQuadActor = Vtk::Actor.new
+aQuadActor.SetMapper(aQuadMapper)
+aQuadActor.AddPosition(2, 0, 2)
+aQuadActor.GetProperty.SetDiffuseColor(1, 0, 1)
+
+trianglePoints = Vtk::Points.new
+trianglePoints.SetNumberOfPoints(3)
+trianglePoints.InsertPoint(0, 0, 0, 0)
+trianglePoints.InsertPoint(1, 1, 0, 0)
+trianglePoints.InsertPoint(2, 0.5, 0.5, 0)
+triangleTCoords = Vtk::FloatArray.new
+triangleTCoords.SetNumberOfComponents(3)
+triangleTCoords.SetNumberOfTuples(3)
+triangleTCoords.InsertTuple3(0, 1, 1, 1)
+triangleTCoords.InsertTuple3(1, 2, 2, 2)
+triangleTCoords.InsertTuple3(2, 3, 3, 3)
+aTriangle = Vtk::Triangle.new
+aTriangle.GetPointIds.SetId(0, 0)
+aTriangle.GetPointIds.SetId(1, 1)
+aTriangle.GetPointIds.SetId(2, 2)
+aTriangleGrid = Vtk::UnstructuredGrid.new
+aTriangleGrid.Allocate(1, 1)
+aTriangleGrid.InsertNextCell(aTriangle.GetCellType,
+                             aTriangle.GetPointIds)
+aTriangleGrid.SetPoints(trianglePoints)
+aTriangleGrid.GetPointData.SetTCoords(triangleTCoords)
+aTriangleMapper = Vtk::DataSetMapper.new
+aTriangleMapper.SetInput(aTriangleGrid)
+aTriangleActor = Vtk::Actor.new
+aTriangleActor.SetMapper(aTriangleMapper)
+aTriangleActor.AddPosition(4, 0, 2)
+aTriangleActor.GetProperty.SetDiffuseColor(0.3, 1, 0.5)
+
+polygonPoints = Vtk::Points.new
+polygonPoints.SetNumberOfPoints(4)
+polygonPoints.InsertPoint(0, 0, 0, 0)
+polygonPoints.InsertPoint(1, 1, 0, 0)
+polygonPoints.InsertPoint(2, 1, 1, 0)
+polygonPoints.InsertPoint(3, 0, 1, 0)
+aPolygon = Vtk::Polygon.new
+aPolygon.GetPointIds.SetNumberOfIds(4)
+aPolygon.GetPointIds.SetId(0, 0)
+aPolygon.GetPointIds.SetId(1, 1)
+aPolygon.GetPointIds.SetId(2, 2)
+aPolygon.GetPointIds.SetId(3, 3)
+aPolygonGrid = Vtk::UnstructuredGrid.new
+aPolygonGrid.Allocate(1, 1)
+aPolygonGrid.InsertNextCell(aPolygon.GetCellType, aPolygon.GetPointIds)
+aPolygonGrid.SetPoints(polygonPoints)
+aPolygonMapper = Vtk::DataSetMapper.new
+aPolygonMapper.SetInput(aPolygonGrid)
+aPolygonActor = Vtk::Actor.new
+aPolygonActor.SetMapper(aPolygonMapper)
+aPolygonActor.AddPosition(6, 0, 2)
+aPolygonActor.GetProperty.SetDiffuseColor(1, 0.4, 0.5)
+
+triangleStripPoints = Vtk::Points.new
+triangleStripPoints.SetNumberOfPoints(5)
+triangleStripPoints.InsertPoint(0, 0, 1, 0)
+triangleStripPoints.InsertPoint(1, 0, 0, 0)
+triangleStripPoints.InsertPoint(2, 1, 1, 0)
+triangleStripPoints.InsertPoint(3, 1, 0, 0)
+triangleStripPoints.InsertPoint(4, 2, 1, 0)
+triangleStripTCoords = Vtk::FloatArray.new
+triangleStripTCoords.SetNumberOfComponents(3)
+triangleStripTCoords.SetNumberOfTuples(3)
+triangleStripTCoords.InsertTuple3(0, 1, 1, 1)
+triangleStripTCoords.InsertTuple3(1, 2, 2, 2)
+triangleStripTCoords.InsertTuple3(2, 3, 3, 3)
+triangleStripTCoords.InsertTuple3(3, 4, 4, 4)
+triangleStripTCoords.InsertTuple3(4, 5, 5, 5)
+aTriangleStrip = Vtk::TriangleStrip.new
+aTriangleStrip.GetPointIds.SetNumberOfIds(5)
+aTriangleStrip.GetPointIds.SetId(0, 0)
+aTriangleStrip.GetPointIds.SetId(1, 1)
+aTriangleStrip.GetPointIds.SetId(2, 2)
+aTriangleStrip.GetPointIds.SetId(3, 3)
+aTriangleStrip.GetPointIds.SetId(4, 4)
+aTriangleStripGrid = Vtk::UnstructuredGrid.new
+aTriangleStripGrid.Allocate(1, 1)
+aTriangleStripGrid.InsertNextCell(aTriangleStrip.GetCellType,
+                                  aTriangleStrip.GetPointIds)
+aTriangleStripGrid.SetPoints(triangleStripPoints)
+aTriangleStripGrid.GetPointData.SetTCoords(triangleStripTCoords)
+aTriangleStripMapper = Vtk::DataSetMapper.new
+aTriangleStripMapper.SetInput(aTriangleStripGrid)
+aTriangleStripActor = Vtk::Actor.new
+aTriangleStripActor.SetMapper(aTriangleStripMapper)
+aTriangleStripActor.AddPosition(8, 0, 2)
+aTriangleStripActor.GetProperty.SetDiffuseColor(0.3, 0.7, 1)
+
+linePoints = Vtk::Points.new
+linePoints.SetNumberOfPoints(2)
+linePoints.InsertPoint(0, 0, 0, 0)
+linePoints.InsertPoint(1, 1, 1, 0)
+aLine = Vtk::Line.new
+aLine.GetPointIds.SetId(0, 0)
+aLine.GetPointIds.SetId(1, 1)
+aLineGrid = Vtk::UnstructuredGrid.new
+aLineGrid.Allocate(1, 1)
+aLineGrid.InsertNextCell(aLine.GetCellType, aLine.GetPointIds)
+aLineGrid.SetPoints(linePoints)
+aLineMapper = Vtk::DataSetMapper.new
+aLineMapper.SetInput(aLineGrid)
+aLineActor = Vtk::Actor.new
+aLineActor.SetMapper(aLineMapper)
+aLineActor.AddPosition(0, 0, 4)
+aLineActor.GetProperty.SetDiffuseColor(0.2, 1, 1)
+
+polyLinePoints = Vtk::Points.new
+polyLinePoints.SetNumberOfPoints(3)
+polyLinePoints.InsertPoint(0, 0, 0, 0)
+polyLinePoints.InsertPoint(1, 1, 1, 0)
+polyLinePoints.InsertPoint(2, 1, 0, 0)
+aPolyLine = Vtk::PolyLine.new
+aPolyLine.GetPointIds.SetNumberOfIds(3)
+aPolyLine.GetPointIds.SetId(0, 0)
+aPolyLine.GetPointIds.SetId(1, 1)
+aPolyLine.GetPointIds.SetId(2, 2)
+aPolyLineGrid = Vtk::UnstructuredGrid.new
+aPolyLineGrid.Allocate(1, 1)
+aPolyLineGrid.InsertNextCell(aPolyLine.GetCellType,
+                             aPolyLine.GetPointIds)
+aPolyLineGrid.SetPoints(polyLinePoints)
+aPolyLineMapper = Vtk::DataSetMapper.new
+aPolyLineMapper.SetInput(aPolyLineGrid)
+aPolyLineActor = Vtk::Actor.new
+aPolyLineActor.SetMapper(aPolyLineMapper)
+aPolyLineActor.AddPosition(2, 0, 4)
+aPolyLineActor.GetProperty.SetDiffuseColor(1, 1, 1)
+
+vertexPoints = Vtk::Points.new
+vertexPoints.SetNumberOfPoints(1)
+vertexPoints.InsertPoint(0, 0, 0, 0)
+aVertex = Vtk::Vertex.new
+aVertex.GetPointIds.SetId(0, 0)
+aVertexGrid = Vtk::UnstructuredGrid.new
+aVertexGrid.Allocate(1, 1)
+aVertexGrid.InsertNextCell(aVertex.GetCellType, aVertex.GetPointIds)
+aVertexGrid.SetPoints(vertexPoints)
+aVertexMapper = Vtk::DataSetMapper.new
+aVertexMapper.SetInput(aVertexGrid)
+aVertexActor = Vtk::Actor.new
+aVertexActor.SetMapper(aVertexMapper)
+aVertexActor.AddPosition(0, 0, 6)
+aVertexActor.GetProperty.SetDiffuseColor(1, 1, 1)
+
+polyVertexPoints = Vtk::Points.new
+polyVertexPoints.SetNumberOfPoints(3)
+polyVertexPoints.InsertPoint(0, 0, 0, 0)
+polyVertexPoints.InsertPoint(1, 1, 0, 0)
+polyVertexPoints.InsertPoint(2, 1, 1, 0)
+aPolyVertex = Vtk::PolyVertex.new
+aPolyVertex.GetPointIds.SetNumberOfIds(3)
+aPolyVertex.GetPointIds.SetId(0, 0)
+aPolyVertex.GetPointIds.SetId(1, 1)
+aPolyVertex.GetPointIds.SetId(2, 2)
+aPolyVertexGrid = Vtk::UnstructuredGrid.new
+aPolyVertexGrid.Allocate(1, 1)
+aPolyVertexGrid.InsertNextCell(aPolyVertex.GetCellType,
+                               aPolyVertex.GetPointIds)
+aPolyVertexGrid.SetPoints(polyVertexPoints)
+aPolyVertexMapper = Vtk::DataSetMapper.new
+aPolyVertexMapper.SetInput(aPolyVertexGrid)
+aPolyVertexActor = Vtk::Actor.new
+aPolyVertexActor.SetMapper(aPolyVertexMapper)
+aPolyVertexActor.AddPosition(2, 0, 6)
+aPolyVertexActor.GetProperty.SetDiffuseColor(1, 1, 1)
+
+# Create the usual rendering stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+renWin.SetSize(300, 150)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+ren.SetBackground(0.1, 0.2, 0.4)
+
+ren.AddActor(aVoxelActor)
+ren.AddActor(aHexahedronActor)
+ren.AddActor(aTetraActor)
+ren.AddActor(aWedgeActor)
+ren.AddActor(aPyramidActor)
+ren.AddActor(aPixelActor)
+ren.AddActor(aQuadActor)
+ren.AddActor(aTriangleActor)
+ren.AddActor(aPolygonActor)
+ren.AddActor(aTriangleStripActor)
+ren.AddActor(aLineActor)
+ren.AddActor(aPolyLineActor)
+ren.AddActor(aVertexActor)
+ren.AddActor(aPolyVertexActor)
+
+ren.ResetCamera
+ren.GetActiveCamera.Azimuth(30)
+ren.GetActiveCamera.Elevation(20)
+ren.GetActiveCamera.Dolly(2.8)
+ren.ResetCameraClippingRange
+
+# Render the scene && start interaction.
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/DataManipulation/Ruby/CreateStrip.rb VTK/Examples/DataManipulation/Ruby/CreateStrip.rb
--- VTK_org/Examples/DataManipulation/Ruby/CreateStrip.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/DataManipulation/Ruby/CreateStrip.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,59 @@
+#!/usr/bin/env ruby
+
+# This script shows how to manually create a vtkPolyData with a
+# triangle strip.
+
+require 'vtk'
+
+# First we'll create some points.
+points = Vtk::Points.new
+points.InsertPoint(0, 0.0, 0.0, 0.0)
+points.InsertPoint(1, 0.0, 1.0, 0.0)
+points.InsertPoint(2, 1.0, 0.0, 0.0)
+points.InsertPoint(3, 1.0, 1.0, 0.0)
+points.InsertPoint(4, 2.0, 0.0, 0.0)
+points.InsertPoint(5, 2.0, 1.0, 0.0)
+points.InsertPoint(6, 3.0, 0.0, 0.0)
+points.InsertPoint(7, 3.0, 1.0, 0.0)
+
+# The cell array can be thought of as a connectivity list.  Here we
+# specify the number of points followed by that number of point
+# ids. This can be repeated as many times as there are primitives in
+# the list.
+strips = Vtk::CellArray.new
+strips.InsertNextCell(8) # number of points
+strips.InsertCellPoint(0)
+strips.InsertCellPoint(1)
+strips.InsertCellPoint(2)
+strips.InsertCellPoint(3)
+strips.InsertCellPoint(4)
+strips.InsertCellPoint(5)
+strips.InsertCellPoint(6)
+strips.InsertCellPoint(7)
+profile = Vtk::PolyData.new
+profile.SetPoints(points)
+profile.SetStrips(strips)
+
+map = Vtk::PolyDataMapper.new
+map.SetInput(profile)
+
+strip = Vtk::Actor.new
+strip.SetMapper(map)
+strip.GetProperty.SetColor(0.3800, 0.7000, 0.1600)
+
+# Create the usual rendering stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(strip)
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(250, 250)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/DataManipulation/Ruby/FinancialField.rb VTK/Examples/DataManipulation/Ruby/FinancialField.rb
--- VTK_org/Examples/DataManipulation/Ruby/FinancialField.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/DataManipulation/Ruby/FinancialField.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,292 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of fields && use of
+# vtkProgrammableDataObjectSource. It creates fields the hard way (as
+# compared to reading a vtk field file), but shows you how to
+# interface to your own raw data.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+XAxis = "INTEREST_RATE"
+YAxis = "MONTHLY_PAYMENT"
+ZAxis = "MONTHLY_INCOME"
+Scalar = "TIME_LATE"
+
+def getNumberFromLine(line)
+    patn = Regexp.compile('([-+]{0,1}[\d.]+e?[-+\d]*)')
+   ret = []
+    while patn =~ line
+        line = line[line.index($1)+1..-1]
+        ret.push $1.to_f
+    end
+    return ret
+end
+
+# Parse an ASCII file && manually create a field. Then construct a 
+# dataset from the field.
+@dos = Vtk::ProgrammableDataObjectSource.new
+
+# First define the function that will parse the data.
+parseFile = Proc.new{
+
+    # Use Python to read an ASCII file
+    file = File.open(File.join(VTK_DATA_ROOT, "Data/financial.txt"), "r")
+
+    line = file.readline
+    numPts = getNumberFromLine(line)[0].to_i
+
+    numLines = (numPts - 1)/8
+    # Get the data object's field data && allocate
+    # room for 4, fields
+    fieldData = @dos.GetOutput.GetFieldData
+    fieldData.AllocateArrays(4)
+
+    # read TIME_LATE - dependent variable
+    # search the file until an array called TIME_LATE is found
+    while file.readline[0..8] != "TIME_LATE"
+    end
+
+    # Create the corresponding float array
+    timeLate = Vtk::FloatArray.new
+    timeLate.SetName("TIME_LATE")
+    # Read the values
+    for i in 0...numLines
+        val = getNumberFromLine(file.readline)
+        for j in 0...8
+            timeLate.InsertNextValue(val[j])            
+        end
+    end
+    # Add the array
+    fieldData.AddArray(timeLate)
+
+    # MONTHLY_PAYMENT - independent variable
+    while file.readline[0..14] != "MONTHLY_PAYMENT"
+    end
+
+    monthlyPayment = Vtk::FloatArray.new
+    monthlyPayment.SetName("MONTHLY_PAYMENT")
+    for i in 0...numLines
+        val = getNumberFromLine(file.readline)
+        for j in 0...8
+            monthlyPayment.InsertNextValue(val[j])
+        end
+    end
+
+    fieldData.AddArray(monthlyPayment)
+
+    # UNPAID_PRINCIPLE - skip
+    while file.readline[0..15] != "UNPAID_PRINCIPLE"
+    end
+    for i in 0...numLines
+        file.readline
+    end
+
+    # LOAN_AMOUNT - skip
+    while file.readline[0..10] != "LOAN_AMOUNT"
+    end
+    for i in 0...numLines
+        file.readline
+    end
+
+
+    # INTEREST_RATE - independent variable
+    while file.readline[0..12] != "INTEREST_RATE"
+    end
+
+    interestRate = Vtk::FloatArray.new
+    interestRate.SetName("INTEREST_RATE")
+    for i in 0...numLines
+        val = getNumberFromLine(file.readline)
+        for j in 0...8
+            interestRate.InsertNextValue(val[j])
+        end
+    end
+
+    fieldData.AddArray(interestRate)
+
+    # MONTHLY_INCOME - independent variable
+    while file.readline[0..13] != "MONTHLY_INCOME"
+    end
+
+    monthlyIncome = Vtk::FloatArray.new
+    monthlyIncome.SetName("MONTHLY_INCOME")
+    for i in 0...numLines
+        val = getNumberFromLine(file.readline)
+        for j in 0...8
+            monthlyIncome.InsertNextValue(val[j])
+        end
+    end
+
+    fieldData.AddArray(monthlyIncome)
+}
+
+# Arrange to call the parsing function when the programmable data
+# source is executed.
+@dos.SetExecuteMethod(parseFile)
+
+# Create the dataset.
+
+# DataObjectToDataSetFilter can create geometry using fields from
+# DataObject's FieldData
+do2ds = Vtk::DataObjectToDataSetFilter.new
+do2ds.SetInputConnection(@dos.GetOutputPort)
+# We are generating polygonal data
+do2ds.SetDataSetTypeToPolyData
+do2ds.DefaultNormalizeOn
+# All we need is points. Assign them.
+do2ds.SetPointComponent(0, XAxis, 0)
+do2ds.SetPointComponent(1, YAxis, 0)
+do2ds.SetPointComponent(2, ZAxis, 0)
+
+# RearrangeFields is used to move fields between DataObject's
+# FieldData, PointData && CellData.
+rf = Vtk::RearrangeFields.new
+rf.SetInputConnection(do2ds.GetOutputPort)
+# Add an operation to "move TIME_LATE from DataObject's FieldData to
+# PointData"
+rf.AddOperation("MOVE", Scalar, "DATA_OBJECT", "POINT_DATA")
+# Force the filter to execute. This is need to force the pipeline
+# to execute so that we can find the range of the array TIME_LATE
+rf.Update
+# Set max to the second (GetRange returns [min,max]) of the "range of the 
+# array called scalar in the PointData of the output of rf"
+max = rf.GetOutput.GetPointData.GetArray(Scalar).GetRange[1]
+
+
+# Use an ArrayCalculator to normalize TIME_LATE
+calc = Vtk::ArrayCalculator.new
+calc.SetInputConnection(rf.GetOutputPort)
+# Working on point data
+calc.SetAttributeModeToUsePointData
+# Map scalar to s. When setting function, we can use s to
+# represent the array scalar (TIME_LATE) 
+calc.AddScalarVariable("s", Scalar, 0)
+# Divide scalar by max (applies division to all components of the array)
+calc.SetFunction("s / %f"%max)
+# The output array will be called resArray
+calc.SetResultArrayName("resArray")
+
+# Use AssignAttribute to make resArray the active scalar field
+aa = Vtk::AssignAttribute.new
+aa.SetInputConnection(calc.GetOutputPort)
+aa.Assign("resArray", "SCALARS", "POINT_DATA")
+aa.Update
+
+# construct pipeline for original population
+# GaussianSplatter -> Contour -> Mapper -> Actor
+@popSplatter = Vtk::GaussianSplatter.new
+@popSplatter.SetInputConnection(aa.GetOutputPort)
+@popSplatter.SetSampleDimensions(50, 50, 50)
+@popSplatter.SetRadius(0.05)
+@popSplatter.ScalarWarpingOff
+
+popSurface = Vtk::ContourFilter.new
+popSurface.SetInputConnection(@popSplatter.GetOutputPort)
+popSurface.SetValue(0, 0.01)
+
+popMapper = Vtk::PolyDataMapper.new
+popMapper.SetInputConnection(popSurface.GetOutputPort)
+popMapper.ScalarVisibilityOff
+
+popActor = Vtk::Actor.new
+popActor.SetMapper(popMapper)
+popActor.GetProperty.SetOpacity(0.3)
+popActor.GetProperty.SetColor(0.9, 0.9, 0.9)
+
+# This is for decoration only.
+def createAxes
+
+    # Create axes.
+    @popSplatter.Update
+    bounds = @popSplatter.GetOutput.GetBounds
+    axes = Vtk::Axes.new
+    axes.SetOrigin(bounds[0], bounds[2], bounds[4])
+    axes.SetScaleFactor(@popSplatter.GetOutput.GetLength/5.0)
+
+    axesTubes = Vtk::TubeFilter.new
+    axesTubes.SetInputConnection(axes.GetOutputPort)
+    axesTubes.SetRadius(axes.GetScaleFactor/25.0)
+    axesTubes.SetNumberOfSides(6)
+
+    axesMapper = Vtk::PolyDataMapper.new
+    axesMapper.SetInputConnection(axesTubes.GetOutputPort)
+
+    axesActor = Vtk::Actor.new
+    axesActor.SetMapper(axesMapper)
+
+    # Label the axes.
+    xText = Vtk::VectorText.new
+    xText.SetText(XAxis)
+
+    xTextMapper = Vtk::PolyDataMapper.new
+    xTextMapper.SetInputConnection(xText.GetOutputPort)
+
+    xActor = Vtk::Follower.new
+    xActor.SetMapper(xTextMapper)
+    xActor.SetScale(0.02, 0.02, 0.02)
+    xActor.SetPosition(0.35, -0.05, -0.05)
+    xActor.GetProperty.SetColor(0, 0, 0)
+
+    yText = Vtk::VectorText.new
+    yText.SetText(YAxis)
+
+    yTextMapper = Vtk::PolyDataMapper.new
+    yTextMapper.SetInputConnection(yText.GetOutputPort)
+
+    yActor = Vtk::Follower.new
+    yActor.SetMapper(yTextMapper)
+    yActor.SetScale(0.02, 0.02, 0.02)
+    yActor.SetPosition(-0.05, 0.35, -0.05)
+    yActor.GetProperty.SetColor(0, 0, 0)
+
+    zText = Vtk::VectorText.new
+    zText.SetText(ZAxis)
+
+    zTextMapper = Vtk::PolyDataMapper.new
+    zTextMapper.SetInputConnection(zText.GetOutputPort)
+
+    zActor = Vtk::Follower.new
+    zActor.SetMapper(zTextMapper)
+    zActor.SetScale(0.02, 0.02, 0.02)
+    zActor.SetPosition(-0.05, -0.05, 0.35)
+    zActor.GetProperty.SetColor(0, 0, 0)
+    return axesActor, xActor, yActor, zActor
+end
+
+axesActor, xActor, yActor, zActor = createAxes
+
+# Create the render window, renderer, interactor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+renWin.SetWindowName("vtk - Field Data")
+renWin.SetSize(500, 500)
+
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(axesActor)
+ren.AddActor(xActor)
+ren.AddActor(yActor)
+ren.AddActor(xActor)
+ren.AddActor(popActor)
+ren.SetBackground(1, 1, 1)
+
+# Set the default camera position
+camera = Vtk::Camera.new
+camera.SetClippingRange(0.274, 13.72)
+camera.SetFocalPoint(0.433816, 0.333131, 0.449)
+camera.SetPosition(-1.96987, 1.15145, 1.49053)
+camera.SetViewUp(0.378927, 0.911821, 0.158107)
+ren.SetActiveCamera(camera)
+# Assign the camera to the followers.
+xActor.SetCamera(camera)
+yActor.SetCamera(camera)
+zActor.SetCamera(camera)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/DataManipulation/Ruby/marching.rb VTK/Examples/DataManipulation/Ruby/marching.rb
--- VTK_org/Examples/DataManipulation/Ruby/marching.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/DataManipulation/Ruby/marching.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,216 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of the vtkTransformPolyDataFilter
+# to reposition a 3D text string.
+
+require 'vtk'
+require 'vtk/util'
+
+# Define a Single Cube
+Scalars = Vtk::FloatArray.new
+Scalars.InsertNextValue(1.0)
+Scalars.InsertNextValue(0.0)
+Scalars.InsertNextValue(0.0)
+Scalars.InsertNextValue(1.0)
+Scalars.InsertNextValue(0.0)
+Scalars.InsertNextValue(0.0)
+Scalars.InsertNextValue(0.0)
+Scalars.InsertNextValue(0.0)
+
+Points = Vtk::Points.new
+Points.InsertNextPoint(0, 0, 0)
+Points.InsertNextPoint(1, 0, 0)
+Points.InsertNextPoint(1, 1, 0)
+Points.InsertNextPoint(0, 1, 0)
+Points.InsertNextPoint(0, 0, 1)
+Points.InsertNextPoint(1, 0, 1)
+Points.InsertNextPoint(1, 1, 1)
+Points.InsertNextPoint(0, 1, 1)
+
+Ids = Vtk::IdList.new
+Ids.InsertNextId(0)
+Ids.InsertNextId(1)
+Ids.InsertNextId(2)
+Ids.InsertNextId(3)
+Ids.InsertNextId(4)
+Ids.InsertNextId(5)
+Ids.InsertNextId(6)
+Ids.InsertNextId(7)
+
+Grid = Vtk::UnstructuredGrid.new
+Grid.Allocate(10, 10)
+Grid.InsertNextCell(12, Ids)
+Grid.SetPoints(Points)
+Grid.GetPointData.SetScalars(Scalars)
+
+# Find the triangles that lie along the 0.5 contour in this cube.
+Marching = Vtk::ContourFilter.new
+Marching.SetInput(Grid)
+Marching.SetValue(0, 0.5)
+Marching.Update
+
+# Extract the edges of the triangles just found.
+triangleEdges = Vtk::ExtractEdges.new
+triangleEdges.SetInputConnection(Marching.GetOutputPort)
+# Draw the edges as tubes instead of lines.  Also create the associated
+# mapper && actor to display the tubes.
+triangleEdgeTubes = Vtk::TubeFilter.new
+triangleEdgeTubes.SetInputConnection(triangleEdges.GetOutputPort)
+triangleEdgeTubes.SetRadius(0.005)
+triangleEdgeTubes.SetNumberOfSides(6)
+triangleEdgeTubes.UseDefaultNormalOn
+triangleEdgeTubes.SetDefaultNormal(0.577, 0.577, 0.577)
+triangleEdgeMapper = Vtk::PolyDataMapper.new
+triangleEdgeMapper.SetInputConnection(triangleEdgeTubes.GetOutputPort)
+triangleEdgeMapper.ScalarVisibilityOff
+triangleEdgeActor = Vtk::Actor.new
+triangleEdgeActor.SetMapper(triangleEdgeMapper)
+triangleEdgeActor.GetProperty.SetDiffuseColor(Vtk::Colors::Lamp_black)
+triangleEdgeActor.GetProperty.SetSpecular(0.4)
+triangleEdgeActor.GetProperty.SetSpecularPower(10)
+
+# Shrink the triangles we found earlier.  Create the associated mapper
+# && actor.  Set the opacity of the shrunken triangles.
+aShrinker = Vtk::ShrinkPolyData.new
+aShrinker.SetShrinkFactor(1)
+aShrinker.SetInputConnection(Marching.GetOutputPort)
+aMapper = Vtk::PolyDataMapper.new
+aMapper.ScalarVisibilityOff
+aMapper.SetInputConnection(aShrinker.GetOutputPort)
+Triangles = Vtk::Actor.new
+Triangles.SetMapper(aMapper)
+Triangles.GetProperty.SetDiffuseColor(Vtk::Colors::Banana)
+Triangles.GetProperty.SetOpacity(0.6)
+
+# Draw a cube the same size && at the same position as the one
+# created previously.  Extract the edges because we only want to see
+# the outline of the cube.  Pass the edges through a vtkTubeFilter so
+# they are displayed as tubes rather than lines.
+CubeModel = Vtk::CubeSource.new
+CubeModel.SetCenter(0.5, 0.5, 0.5)
+Edges = Vtk::ExtractEdges.new
+Edges.SetInputConnection(CubeModel.GetOutputPort)
+Tubes = Vtk::TubeFilter.new
+Tubes.SetInputConnection(Edges.GetOutputPort)
+Tubes.SetRadius(0.01)
+Tubes.SetNumberOfSides(6)
+Tubes.UseDefaultNormalOn
+Tubes.SetDefaultNormal(0.577, 0.577, 0.577)
+# Create the mapper && actor to display the cube edges.
+TubeMapper = Vtk::PolyDataMapper.new
+TubeMapper.SetInputConnection(Tubes.GetOutputPort)
+CubeEdges = Vtk::Actor.new
+CubeEdges.SetMapper(TubeMapper)
+CubeEdges.GetProperty.SetDiffuseColor(Vtk::Colors::Khaki)
+CubeEdges.GetProperty.SetSpecular(0.4)
+CubeEdges.GetProperty.SetSpecularPower(10)
+
+# Create a sphere to use as a glyph source for vtkGlyph3D.
+Sphere = Vtk::SphereSource.new
+Sphere.SetRadius(0.04)
+Sphere.SetPhiResolution(20)
+Sphere.SetThetaResolution(20)
+# Remove the part of the cube with data values below 0.5.
+ThresholdIn = Vtk::ThresholdPoints.new
+ThresholdIn.SetInput(Grid)
+ThresholdIn.ThresholdByUpper(0.5)
+# Display spheres at the vertices remaining in the cube data set after
+# it was passed through vtkThresholdPoints.
+Vertices = Vtk::Glyph3D.new
+Vertices.SetInputConnection(ThresholdIn.GetOutputPort)
+Vertices.SetSource(Sphere.GetOutput)
+# Create a mapper && actor to display the glyphs.
+SphereMapper = Vtk::PolyDataMapper.new
+SphereMapper.SetInputConnection(Vertices.GetOutputPort)
+SphereMapper.ScalarVisibilityOff
+CubeVertices = Vtk::Actor.new
+CubeVertices.SetMapper(SphereMapper)
+CubeVertices.GetProperty.SetDiffuseColor(Vtk::Colors::Tomato)
+CubeVertices.GetProperty.SetDiffuseColor(Vtk::Colors::Tomato)
+
+# Define the text for the label
+caseLabel = Vtk::VectorText.new
+caseLabel.SetText("Case 1")
+
+# Set up a transform to move the label to a new position.
+aLabelTransform = Vtk::Transform.new
+aLabelTransform.Identity
+aLabelTransform.Translate(-0.2, 0, 1.25)
+aLabelTransform.Scale(0.05, 0.05, 0.05)
+
+# Move the label to a new position.
+labelTransform = Vtk::TransformPolyDataFilter.new
+labelTransform.SetTransform(aLabelTransform)
+labelTransform.SetInputConnection(caseLabel.GetOutputPort)
+
+# Create a mapper && actor to display the text.
+labelMapper = Vtk::PolyDataMapper.new
+labelMapper.SetInputConnection(labelTransform.GetOutputPort)
+
+labelActor = Vtk::Actor.new
+labelActor.SetMapper(labelMapper)
+
+# Define the base that the cube sits on.  Create its associated mapper
+# && actor.  Set the position of the actor.
+baseModel = Vtk::CubeSource.new
+baseModel.SetXLength(1.5)
+baseModel.SetYLength(0.01)
+baseModel.SetZLength(1.5)
+baseMapper = Vtk::PolyDataMapper.new
+baseMapper.SetInputConnection(baseModel.GetOutputPort)
+base = Vtk::Actor.new
+base.SetMapper(baseMapper)
+base.SetPosition(0.5, -0.09, 0.5)
+
+# Create the Renderer, RenderWindow, && RenderWindowInteractor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+renWin.SetSize(640, 480)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer
+ren.AddActor(triangleEdgeActor)
+ren.AddActor(base)
+ren.AddActor(labelActor)
+ren.AddActor(CubeEdges)
+ren.AddActor(CubeVertices)
+ren.AddActor(Triangles)
+
+# Set the background color.
+ren.SetBackground(Vtk::Colors::Slate_grey)
+
+# This sets up the right values for case12 of the marching cubes
+# algorithm (routine translated from vtktesting/mccases.tcl).
+def case12(scalars, caselabel, iin, out)
+    scalars.InsertValue(0, out)
+    scalars.InsertValue(1, iin)
+    scalars.InsertValue(2, out)
+    scalars.InsertValue(3, iin)
+    scalars.InsertValue(4, iin)
+    scalars.InsertValue(5, iin)
+    scalars.InsertValue(6, out)
+    scalars.InsertValue(7, out)
+    if iin == 1
+        caselabel.SetText("Case 12 - 00111010")
+    else        caselabel.SetText("Case 12 - 11000101")
+    end
+end
+
+# Set the scalar values for this case of marching cubes.
+case12(Scalars, caseLabel, 0, 1)
+
+# Force the grid to update.
+Grid.Modified
+
+# Position the camera.
+ren.ResetCamera
+ren.GetActiveCamera.Dolly(1.2)
+ren.GetActiveCamera.Azimuth(30)
+ren.GetActiveCamera.Elevation(20)
+ren.ResetCameraClippingRange
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/DataManipulation/Ruby/pointToCellData.rb VTK/Examples/DataManipulation/Ruby/pointToCellData.rb
--- VTK_org/Examples/DataManipulation/Ruby/pointToCellData.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/DataManipulation/Ruby/pointToCellData.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,99 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the conversion of point data to cell data.
+# The conversion is necessary because we want to threshold data based
+# on cell scalar values.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Read some data with point data attributes. The data is from a
+# plastic blow molding process (e.g., to make plastic bottles) &&
+# consists of two logical components: a mold && a parison. The
+# parison is the hot plastic that is being molded, && the mold is
+# clamped around the parison to form its shape.
+reader = Vtk::UnstructuredGridReader.new
+reader.SetFileName(VTK_DATA_ROOT + "/Data/blow.vtk")
+reader.SetScalarsName("thickness9")
+reader.SetVectorsName("displacement9")
+
+# Convert the point data to cell data. The point data is passed
+# through the filter so it can be warped. The vtkThresholdFilter then
+# thresholds based on cell scalar values && extracts a portion of the
+# parison whose cell scalar values lie between 0.25 && 0.75.
+p2c = Vtk::PointDataToCellData.new
+p2c.SetInputConnection(reader.GetOutputPort)
+p2c.PassPointDataOn
+warp = Vtk::WarpVector.new
+warp.SetInput(p2c.GetUnstructuredGridOutput)
+thresh = Vtk::Threshold.new
+thresh.SetInputConnection(warp.GetOutputPort)
+thresh.ThresholdBetween(0.25, 0.75)
+thresh.SetInputArrayToProcess(1, 0, 0, 0, "thickness9")
+#thresh.SetAttributeModeToUseCellData
+
+# This is used to extract the mold from the parison. 
+connect = Vtk::ConnectivityFilter.new
+connect.SetInputConnection(thresh.GetOutputPort)
+connect.SetExtractionModeToSpecifiedRegions
+connect.AddSpecifiedRegion(0)
+connect.AddSpecifiedRegion(1)
+moldMapper = Vtk::DataSetMapper.new
+moldMapper.SetInputConnection(reader.GetOutputPort)
+moldMapper.ScalarVisibilityOff
+moldActor = Vtk::Actor.new
+moldActor.SetMapper(moldMapper)
+moldActor.GetProperty.SetColor(0.2, 0.2, 0.2)
+moldActor.GetProperty.SetRepresentationToWireframe
+
+# The threshold filter has been used to extract the parison.
+connect2 = Vtk::ConnectivityFilter.new
+connect2.SetInputConnection(thresh.GetOutputPort)
+parison = Vtk::GeometryFilter.new
+parison.SetInputConnection(connect2.GetOutputPort)
+normals2 = Vtk::PolyDataNormals.new
+normals2.SetInputConnection(parison.GetOutputPort)
+normals2.SetFeatureAngle(60)
+lut = Vtk::LookupTable.new
+lut.SetHueRange(0.0, 0.66667)
+parisonMapper = Vtk::PolyDataMapper.new
+parisonMapper.SetInputConnection(normals2.GetOutputPort)
+parisonMapper.SetLookupTable(lut)
+parisonMapper.SetScalarRange(0.12, 1.0)
+parisonActor = Vtk::Actor.new
+parisonActor.SetMapper(parisonMapper)
+
+# We generate some contour lines on the parison.
+cf = Vtk::ContourFilter.new
+cf.SetInputConnection(connect2.GetOutputPort)
+cf.SetValue(0, 0.5)
+contourMapper = Vtk::PolyDataMapper.new
+contourMapper.SetInputConnection(cf.GetOutputPort)
+contours = Vtk::Actor.new
+contours.SetMapper(contourMapper)
+
+# Create graphics stuff
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(moldActor)
+ren.AddActor(parisonActor)
+ren.AddActor(contours)
+
+ren.ResetCamera
+ren.GetActiveCamera.Azimuth(60)
+ren.GetActiveCamera.Roll(-90)
+ren.GetActiveCamera.Dolly(2)
+ren.ResetCameraClippingRange
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(750, 400)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/BoxWidget.rb VTK/Examples/GUI/Ruby/BoxWidget.rb
--- VTK_org/Examples/GUI/Ruby/BoxWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/BoxWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,85 @@
+#!/usr/bin/env ruby
+
+# Demonstrate how to use the vtkBoxWidget 3D widget. This script uses
+# a 3D box widget to define a "clipping box" to clip some simple
+# geometry (a mace). Make sure that you hit the "i" key to activate
+# the widget.
+
+require 'vtk'
+
+# Create a mace out of filters.
+sphere = Vtk::SphereSource.new
+cone = Vtk::ConeSource.new
+glyph = Vtk::Glyph3D.new
+glyph.SetInputConnection(sphere.GetOutputPort)
+glyph.SetSource(cone.GetOutput)
+glyph.SetVectorModeToUseNormal
+glyph.SetScaleModeToScaleByVector
+glyph.SetScaleFactor(0.25)
+
+# The sphere && spikes are appended into a single polydata. This just
+# makes things simpler to manage.
+apd = Vtk::AppendPolyData.new
+apd.AddInput(glyph.GetOutput)
+apd.AddInput(sphere.GetOutput)
+maceMapper = Vtk::PolyDataMapper.new
+maceMapper.SetInputConnection(apd.GetOutputPort)
+maceActor = Vtk::LODActor.new
+maceActor.SetMapper(maceMapper)
+maceActor.VisibilityOn
+
+# This portion of the code clips the mace with the vtkPlanes implicit
+# function.  The clipped region is colored green.
+planes = Vtk::Planes.new
+clipper = Vtk::ClipPolyData.new
+clipper.SetInputConnection(apd.GetOutputPort)
+clipper.SetClipFunction(planes)
+clipper.InsideOutOn
+selectMapper = Vtk::PolyDataMapper.new
+selectMapper.SetInputConnection(clipper.GetOutputPort)
+selectActor = Vtk::LODActor.new
+selectActor.SetMapper(selectMapper)
+selectActor.GetProperty.SetColor(0, 1, 0)
+selectActor.VisibilityOff
+selectActor.SetScale(1.01, 1.01, 1.01)
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# The SetInteractor method is how 3D widgets are associated with the
+# render window interactor.  Internally, SetInteractor sets up a bunch
+# of callbacks using the Command/Observer mechanism (AddObserver).
+boxWidget = Vtk::BoxWidget.new
+boxWidget.SetInteractor(iren)
+boxWidget.SetPlaceFactor(1.25)
+
+ren.AddActor(maceActor)
+ren.AddActor(selectActor)
+
+# Add the actors to the renderer, set the background && size
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin.SetSize(300, 300)
+
+# This callback funciton does the actual work: updates the vtkPlanes
+# implicit function.  This in turn causes the pipeline to update.
+SelectPolygons = Proc.new{|object, event|
+    # object will be the boxWidget
+    object.GetPlanes(planes)
+    selectActor.VisibilityOn
+}
+
+# Place the interactor initially. The input to a 3D widget is used to
+# initially position && scale the widget. The "EndInteractionEvent" is
+# observed which invokes the SelectPolygons callback.
+boxWidget.SetInput(glyph.GetOutput)
+boxWidget.PlaceWidget
+boxWidget.AddObserver("EndInteractionEvent", SelectPolygons)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/CustomInteraction.rb VTK/Examples/GUI/Ruby/CustomInteraction.rb
--- VTK_org/Examples/GUI/Ruby/CustomInteraction.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/CustomInteraction.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,230 @@
+#!/usr/bin/env ruby
+
+# This example creates a polygonal model of a cone, && then renders
+# it to the screen. It also defines an interaction style by creating a
+# set of Command/Observers. (Note: it is far more efficient to create
+# new styles by subclassing vtkInteractorStyle. This is just an
+# illustrative example.) If you really want trackball behavior, look
+# at the vtkInteractorStyleTrackballCamera class.
+
+require 'vtk'
+
+# We create an instance of vtkConeSource && set some of its
+# properties. The instance of vtkConeSource "cone" is part of a
+# visualization pipeline (it is a source process object); it produces
+# data (output type is vtkPolyData) which other filters may process.
+cone = Vtk::ConeSource.new
+cone.SetHeight(3.0)
+cone.SetRadius(1.0)
+cone.SetResolution(10)
+
+# In this example we terminate the pipeline with a mapper process
+# object.  (Intermediate filters such as vtkShrinkPolyData could be
+# inserted in between the source && the mapper.)  We create an
+# instance of vtkPolyDataMapper to map the polygonal data into
+# graphics primitives. We connect the output of the cone souece to the
+# input of this mapper.
+coneMapper = Vtk::PolyDataMapper.new
+coneMapper.SetInputConnection(cone.GetOutputPort)
+
+# Create an actor to represent the cone. The actor orchestrates
+# rendering of the mapper's graphics primitives. An actor also refers
+# to properties via a vtkProperty instance, && includes an internal
+# transformation matrix. We set this actor's mapper to be coneMapper
+# which we created above.
+coneActor = Vtk::Actor.new
+coneActor.SetMapper(coneMapper)
+
+# Create the Renderer && assign actors to it. A renderer is like a
+# viewport. It is part || all of a window on the screen && it is
+# responsible for drawing the actors it has.  We also set the
+# background color here.
+@ren = Vtk::Renderer.new
+@ren.AddActor(coneActor)
+@ren.SetBackground(0.1, 0.2, 0.4)
+
+# Finally we create the render window which will show up on the screen
+# We put our renderer into the render window using AddRenderer. We
+# also set the size to be 300 pixels by 300.
+@renWin = Vtk::RenderWindow.new
+@renWin.AddRenderer(@ren)
+@renWin.SetSize(300, 300)
+
+# Define custom interaction.
+iren = Vtk::RenderWindowInteractor.new
+iren.SetInteractorStyle(nil)
+iren.SetRenderWindow(@renWin)
+
+# Add the observers to watch for particular events. These invoke
+# Python functions.
+rotating = 0
+panning = 0
+zooming = 0
+
+# Handle the mouse button events.
+ButtonEvent = Proc.new{|obj, event|
+    if event == "LeftButtonPressEvent"
+        rotating = 1
+    elsif event == "LeftButtonReleaseEvent"
+        rotating = 0
+    elsif event == "MiddleButtonPressEvent"
+        panning = 1
+    elsif event == "MiddleButtonReleaseEvent"
+        panning = 0
+    elsif event == "RightButtonPressEvent"
+        zooming = 1
+    elsif event == "RightButtonReleaseEvent"
+        zooming = 0
+    end
+}
+
+# General high-level logic
+MouseMove = Proc.new{|obj, event|
+    lastXYpos = iren.GetLastEventPosition
+    lastX = lastXYpos[0]
+    lastY = lastXYpos[1]
+
+    xypos = iren.GetEventPosition
+    x = xypos[0]
+    y = xypos[1]
+
+    center = @renWin.GetSize
+    centerX = center[0]/2.0
+    centerY = center[1]/2.0
+
+    if rotating
+        Rotate(@ren, @ren.GetActiveCamera, x, y, lastX, lastY,
+               centerX, centerY)
+    elsif panning
+        Pan(@ren, @ren.GetActiveCamera, x, y, lastX, lastY, centerX,
+            centerY)
+    elsif zooming
+        Dolly(@ren, @ren.GetActiveCamera, x, y, lastX, lastY,
+              centerX, centerY)
+    end
+}
+
+
+Keypress = Proc.new{|obj, event|
+    key = obj.GetKeySym
+    if key == "e"
+        obj.InvokeEvent("DeleteAllObjects")
+        sys.exit
+    elsif key == "w"
+        Wireframe
+    elsif key =="s"
+        Surface 
+    end
+}
+
+
+# Routines that translate the events into camera motions.
+
+# This one is associated with the left mouse button. It translates x
+# && y relative motions into camera azimuth && elevation commands.
+def Rotate(renderer, camera, x, y, lastX, lastY, centerX, centerY) 
+    camera.Azimuth(lastX-x)
+    camera.Elevation(lastY-y)
+    camera.OrthogonalizeViewUp
+    @renWin.Render
+end
+
+
+# Pan translates x-y motion into translation of the focal point &&
+# position.
+def Pan(renderer, camera, x, y, lastX, lastY, centerX, centerY)
+    fPoint = camera.GetFocalPoint
+    fPoint0 = fPoint[0]
+    fPoint1 = fPoint[1]
+    fPoint2 = fPoint[2]
+
+    pPoint = camera.GetPosition
+    pPoint0 = pPoint[0]
+    pPoint1 = pPoint[1]
+    pPoint2 = pPoint[2]
+
+    renderer.SetWorldPoint(FPoint0, FPoint1, FPoint2, 1.0)
+    renderer.WorldToDisplay
+    dPoint = renderer.GetDisplayPoint
+    focalDepth = dPoint[2]
+
+    aPoint0 = centerX+(x-lastX)
+    aPoint1 = centerY+(y-lastY)
+
+    renderer.SetDisplayPoint(APoint0, APoint1, focalDepth)
+    renderer.DisplayToWorld
+    rPoint = renderer.GetWorldPoint
+    rPoint0 = rPoint[0]
+    rPoint1 = rPoint[1]
+    rPoint2 = rPoint[2]
+    rPoint3 = rPoint[3]
+
+    if rPoint3 != 0.0
+        rPoint0 = rPoint0/rPoint3
+        rPoint1 = rPoint1/rPoint3
+        rPoint2 = rPoint2/rPoint3
+    end
+
+    camera.SetFocalPoint( (fPoint0-rPoint0)/2.0 + fPoint0,
+                          (fPoint1-rPoint1)/2.0 + fPoint1,
+                          (fPoint2-rPoint2)/2.0 + fPoint2)
+    camera.SetPosition( (fPoint0-rPoint0)/2.0 + pPoint0,
+                        (fPoint1-rPoint1)/2.0 + pPoint1,
+                        (fPoint2-rPoint2)/2.0 + pPoint2)
+    @renWin.Render
+end
+
+
+# Dolly converts y-motion into a camera dolly commands.
+def Dolly(renderer, camera, x, y, lastX, lastY, centerX, centerY)
+    dollyFactor = pow(1.02,(0.5*(y-lastY)))
+    if camera.GetParallelProjection
+        parallelScale = camera.GetParallelScale*dollyFactor
+        camera.SetParallelScale(parallelScale)
+    else
+        camera.Dolly(dollyFactor)
+        renderer.ResetCameraClippingRange
+    end
+
+    @renWin.Render 
+end
+
+# Wireframe sets the representation of all actors to wireframe.
+def Wireframe
+    actors = @ren.GetActors
+    actors.InitTraversal
+    actor = actors.GetNextItem
+    while actor
+        actor.GetProperty.SetRepresentationToWireframe
+        actor = actors.GetNextItem
+    end
+
+    @renWin.Render 
+end
+
+# Surface sets the representation of all actors to surface.
+def Surface
+    actors = @ren.GetActors
+    actors.InitTraversal
+    actor = actors.GetNextItem
+    while actor
+        actor.GetProperty.SetRepresentationToSurface
+        actor = actors.GetNextItem
+    end
+    @renWin.Render
+end
+
+
+iren.AddObserver("LeftButtonPressEvent", ButtonEvent)
+iren.AddObserver("LeftButtonReleaseEvent", ButtonEvent)
+iren.AddObserver("MiddleButtonPressEvent", ButtonEvent)
+iren.AddObserver("MiddleButtonReleaseEvent", ButtonEvent)
+iren.AddObserver("RightButtonPressEvent", ButtonEvent)
+iren.AddObserver("RightButtonReleaseEvent", ButtonEvent)
+iren.AddObserver("MouseMoveEvent", MouseMove)
+iren.AddObserver("KeyPressEvent", Keypress)
+
+
+iren.Initialize
+@renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/ImagePlaneWidget.rb VTK/Examples/GUI/Ruby/ImagePlaneWidget.rb
--- VTK_org/Examples/GUI/Ruby/ImagePlaneWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/ImagePlaneWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,336 @@
+#!/usr/bin/env ruby
+
+# This code is a direct translation of the Tcl code in
+# ImagePlaneWidget.tcl.  It could easily be written using a nice class
+# to do the job but the present code should definitely make for an
+# illustrative example.
+
+# This example demonstrates how to use the vtkImagePlaneWidget
+# to probe a 3D image dataset with three orthogonal planes.
+# Buttons are provided to:
+# a) capture the render window display to a tiff file
+# b) x,y,z buttons reset the widget to orthonormal
+#    positioning, set the horizontal slider to move the
+#    associated widget along its normal, && set the
+#    camera to face the widget
+# c) right clicking on x,y,z buttons pops up a menu to set
+#    the associated widget's reslice interpolation mode
+
+require 'vtk'
+require 'vtk/util'
+require 'vtk/tk'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Start by loading some data.
+v16 = Vtk::Volume16Reader.new
+v16.SetDataDimensions(64, 64)
+v16.SetDataByteOrderToLittleEndian
+v16.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
+v16.SetImageRange(1, 93)
+v16.SetDataSpacing(3.2, 3.2, 1.5)
+v16.Update
+
+@xMin, @xMax, @yMin, @yMax, @zMin, @zMax = v16.GetOutput.GetWholeExtent
+
+spacing = v16.GetOutput.GetSpacing
+@sx, @sy, @sz = spacing
+
+origin = v16.GetOutput.GetOrigin
+@ox, @oy, @oz = origin
+
+# An outline is shown for context.
+outline = Vtk::OutlineFilter.new
+outline.SetInputConnection(v16.GetOutputPort)
+
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+
+# The shared picker enables us to use 3 planes at one time
+# && gets the picking order right
+picker = Vtk::CellPicker.new
+picker.SetTolerance(0.005)
+
+# The 3 image plane widgets are used to probe the dataset.
+planeWidgetX = Vtk::ImagePlaneWidget.new
+planeWidgetX.DisplayTextOn
+planeWidgetX.SetInput(v16.GetOutput)
+planeWidgetX.SetPlaneOrientationToXAxes
+planeWidgetX.SetSliceIndex(32)
+planeWidgetX.SetPicker(picker)
+planeWidgetX.SetKeyPressActivationValue("x")
+prop1 = planeWidgetX.GetPlaneProperty
+prop1.SetColor(1, 0, 0)
+
+planeWidgetY = Vtk::ImagePlaneWidget.new
+planeWidgetY.DisplayTextOn
+planeWidgetY.SetInput(v16.GetOutput)
+planeWidgetY.SetPlaneOrientationToYAxes
+planeWidgetY.SetSliceIndex(32)
+planeWidgetY.SetPicker(picker)
+planeWidgetY.SetKeyPressActivationValue("y")
+prop2 = planeWidgetY.GetPlaneProperty
+prop2.SetColor(1, 1, 0)
+planeWidgetY.SetLookupTable(planeWidgetX.GetLookupTable)
+
+# for the z-slice, turn off texture interpolation:
+# interpolation is now nearest neighbour, to demonstrate
+# cross-hair cursor snapping to pixel centers
+planeWidgetZ = Vtk::ImagePlaneWidget.new
+planeWidgetZ.DisplayTextOn
+planeWidgetZ.SetInput(v16.GetOutput)
+planeWidgetZ.SetPlaneOrientationToZAxes
+planeWidgetZ.SetSliceIndex(46)
+planeWidgetZ.SetPicker(picker)
+planeWidgetZ.SetKeyPressActivationValue("z")
+prop3 = planeWidgetZ.GetPlaneProperty
+prop3.SetColor(0, 0, 1)
+planeWidgetZ.SetLookupTable(planeWidgetX.GetLookupTable)
+
+# Create the RenderWindow && Renderer
+@ren = Vtk::Renderer.new
+@renWin = Vtk::RenderWindow.new
+@renWin.AddRenderer(@ren)
+
+# Add the outline actor to the renderer, set the background color && size
+@ren.AddActor(outlineActor)
+@renWin.SetSize(600, 600)
+@ren.SetBackground(0.1, 0.1, 0.2)
+
+@current_widget = planeWidgetZ
+mode_widget = planeWidgetZ
+
+# Create the GUI
+# We first create the supporting functions (callbacks) for the GUI
+#
+# Align the camera so that it faces the desired widget
+def alignCamera
+  #global @ox, @oy, @oz, sx, sy, sz, xMax, xMin, yMax, yMin, zMax, \
+  #      zMin, slice_number
+  #global current_widget
+  cx = @ox+(0.5*(@xMax-@xMin))*@sx
+  cy = @oy+(0.5*(@yMax-@yMin))*@sy
+  cz = @oy+(0.5*(@zMax-@zMin))*@sz
+  vx, vy, vz = 0, 0, 0
+  nx, ny, nz = 0, 0, 0
+  iaxis = @current_widget.GetPlaneOrientation
+  if iaxis == 0
+    vz = -1
+    nx = @ox + @xMax*@sx
+    cx = @ox + @slice_number*@sx
+  elsif iaxis == 1
+    vz = -1
+    ny = @oy+@yMax*@sy
+    cy = @oy+@slice_number*@sy
+  else
+    vy = 1
+    nz = @oz+@zMax*@sz
+    cz = @oz+@slice_number*@sz
+  end
+
+  px = cx+nx*2
+  py = cy+ny*2
+  pz = cz+nz*3
+
+  camera = @ren.GetActiveCamera
+  camera.SetViewUp(vx, vy, vz)
+  camera.SetFocalPoint(cx, cy, cz)
+  camera.SetPosition(px, py, pz)
+  camera.OrthogonalizeViewUp
+  @ren.ResetCameraClippingRange
+  @renWin.Render
+end
+
+
+
+# Share the popup menu among buttons, keeping track of associated
+# widget's interpolation mode
+def buttonEvent(event, arg=nil)
+  if arg == 0
+    mode_widget = planeWidgetX
+  elsif arg == 1
+    mode_widget = planeWidgetY
+  elsif arg == 2
+    mode_widget = planeWidgetZ
+  else
+    return
+  end
+  mode.set(mode_widget.GetResliceInterpolate)
+  popm.entryconfigure(arg, variable=mode)
+  popm.post(event.x + event.x_root, event.y + event.y_root)
+end
+
+
+###
+# Now actually create the GUI
+root = TkRoot.new
+
+# Popup menu
+popm = TkMenu.new(root, 'tearoff'=>0)
+mode = TkVariable.new
+mode.value = 1
+# Set the widget's reslice interpolation mode
+# to the corresponding popup menu choice
+setInterpolation = Proc.new{
+  if mode.get == 0
+    mode_widget.TextureInterpolateOff
+  else
+    mode_widget.TextureInterpolateOn
+  end
+
+  mode_widget.SetResliceInterpolate(mode.get)
+  @renWin.Render
+}
+popm.add_radiobutton('label'=>"nearest", 'variable'=>mode, 'value'=>0,
+                     'command'=>setInterpolation)
+popm.add_radiobutton('label'=>"linear", 'variable'=>mode, 'value'=>1,
+                     'command'=>setInterpolation)
+popm.add_radiobutton('label'=>"cubic", 'variable'=>mode, 'value'=>2,
+                     'command'=>setInterpolation)
+
+display_frame = TkFrame.new(root)
+display_frame.pack('side'=>"top", 'anchor'=>"n", 'fill'=>"both", 'expand'=>false)
+
+# Buttons
+ctrl_buttons = TkFrame.new(root)
+ctrl_buttons.pack('side'=>"top", 'anchor'=>"n", 'fill'=>"both", 'expand'=>false)
+
+quit_button = TkButton.new(ctrl_buttons, 'text'=>"Quit", 'command'=>Proc.new{exit})
+
+# Capture the display && place in a tiff
+captureImage = Proc.new{
+  w2i = Vtk::WindowToImageFilter.new
+  writer = Vtk::TIFFWriter.new
+  w2i.SetInput(@renWin)
+  w2i.Update
+  writer.SetInputConnection(w2i.GetOutputPort)
+  writer.SetFileName("image.tif")
+  @renWin.Render
+  writer.Write
+}
+capture_button = TkButton.new(ctrl_buttons, 'text'=>"Tif",
+                                'command'=>captureImage)
+
+# Align the widget back into orthonormal position,
+# set the slider to reflect the widget's position,
+# call AlignCamera to set the camera facing the widget
+alignXaxis = Proc.new{
+  po = planeWidgetX.GetPlaneOrientation
+  if po == 3
+    planeWidgetX.SetPlaneOrientationToXAxes
+    @slice_number = (@xMax-@xMin)/2
+    planeWidgetX.SetSliceIndex(@slice_number)
+  else
+    @slice_number = planeWidgetX.GetSliceIndex
+  end
+
+  @current_widget = planeWidgetX
+
+  @slice.configure('from'=>@xMin, 'to'=>@xMax)
+  @slice.set(@slice_number)
+  alignCamera
+}
+
+
+alignYaxis = Proc.new{
+  po = planeWidgetY.GetPlaneOrientation
+  if po == 3
+    planeWidgetY.SetPlaneOrientationToYAxes
+    @slice_number = (@yMax-@yMin)/2
+    planeWidgetY.SetSliceIndex(@slice_number)
+  else
+    @slice_number = planeWidgetY.GetSliceIndex
+  end
+
+  @current_widget = planeWidgetY
+
+  @slice.configure('from'=>@yMin, 'to'=>@yMax)
+  @slice.set(@slice_number)
+  alignCamera
+}
+
+alignZaxis = Proc.new{
+  po = planeWidgetZ.GetPlaneOrientation
+  if po == 3
+    planeWidgetZ.SetPlaneOrientationToZAxes
+    @slice_number = (@zMax-@zMin)/2
+    planeWidgetZ.SetSliceIndex(@slice_number)
+  else
+    @slice_number = planeWidgetZ.GetSliceIndex
+  end
+
+  @current_widget = planeWidgetZ
+
+  @slice.configure('from'=>@zMin, 'to'=>@zMax)
+  @slice.set(@slice_number)
+  alignCamera
+}
+
+x_button = TkButton.new(ctrl_buttons, 'text'=>"x", 'command'=>alignXaxis)
+y_button = TkButton.new(ctrl_buttons, 'text'=>"y", 'command'=>alignYaxis)
+z_button = TkButton.new(ctrl_buttons, 'text'=>"z", 'command'=>alignZaxis)
+x_button.bind("Button-3"){|e| buttonEvent(e, 0) }
+y_button.bind("Button-3"){|e| buttonEvent(e, 1) }
+z_button.bind("Button-3"){|e| buttonEvent(e, 2) }
+
+for i in [quit_button, capture_button, x_button, y_button, z_button]
+  i.pack('side'=>"left", 'expand'=>true, 'fill'=>"both")
+end
+
+
+# Create the render widget
+renderer_frame = TkFrame.new(display_frame)
+renderer_frame.pack('padx'=>3, 'pady'=>3, 'side'=>"left", 'anchor'=>"n",
+                    'fill'=>"both", 'expand'=>false)
+
+render_widget = Vtk::TkRenderWindowInteractor.new(renderer_frame,
+                                                  'rw'=>@renWin,
+                                                  'width'=>600, 'height'=>600)
+for i in [render_widget, display_frame]
+  i.pack('side'=>"top", 'anchor'=>"n", 'fill'=>"both", 'expand'=>false)
+end
+
+# Add a slice scale to browse the current slice stack
+@slice_number = TkVariable.new
+@slice_number.value = @current_widget.GetSliceIndex
+setSlice = Proc.new{|sl|
+  @current_widget.SetSliceIndex(sl.to_i)
+  @ren.ResetCameraClippingRange
+  @renWin.Render
+}
+@slice = TkScale.new(root, 'from'=>@zMin, 'to'=>@zMax, 'orient'=>"horizontal",
+                      'command'=>setSlice,'variable'=>@slice_number,
+                      'label'=>"Slice")
+@slice.pack('fill'=>"x", 'expand'=>false)
+
+# Done with the GUI. 
+###
+
+# Set the interactor for the widgets
+iact = render_widget.GetRenderWindow.GetInteractor
+iact.UnRegister(nil)
+planeWidgetX.SetInteractor(iact)
+planeWidgetX.On
+planeWidgetY.SetInteractor(iact)
+planeWidgetY.On
+planeWidgetZ.SetInteractor(iact)
+planeWidgetZ.On
+
+# Create an initial interesting view
+cam1 = @ren.GetActiveCamera
+cam1.Elevation(110)
+cam1.SetViewUp(0, 0, -1)
+cam1.Azimuth(45)
+@ren.ResetCameraClippingRange
+
+# Render it
+render_widget.Render
+
+iact.Initialize
+@renWin.Render
+iact.Start
+
+# Start Tkinter event loop
+root.mainloop
diff -uNr VTK_org/Examples/GUI/Ruby/ImageTracerWidget.rb VTK/Examples/GUI/Ruby/ImageTracerWidget.rb
--- VTK_org/Examples/GUI/Ruby/ImageTracerWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/ImageTracerWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,301 @@
+#!/usr/bin/env ruby
+
+# initial translation from the tcl by VTK/Utilities/tcl2py.py
+# further cleanup && fixes to the translation by Charl P. Botha
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# This example demonstrates how to use the vtkImageTracerWidget
+# to trace on a slice of a 3D image dataset on one of its orthogonal planes.
+# The button actions && key modifiers are as follows for controlling the
+# widget:
+# 1) left button click over the image, hold && drag draws a free hand line.
+# 2) left button click && release erases the widget line, if it exists, &&
+# repositions the handle.
+# 3) middle button click starts a snap line.  The snap line can be
+# terminated by clicking the middle button while depressing the ctrl key.
+# 4) when tracing || snap drawing a line, if the last cursor position is
+# within specified tolerance to the first handle, the widget line will form
+# a closed loop with only one handle.
+# 5) right button clicking && holding on any handle that is part of a snap
+# line allows handle dragging.  Any existing line segments are updated
+# accordingly.
+# 6) ctrl key + right button down on any handle will erase it. Any existing
+# snap line segments are updated accordingly.  If the line was formed by
+# continous tracing, the line is deleted leaving one handle.
+# 7) shift key + right button down on any snap line segment will insert a
+# handle at the cursor position.  The snap line segment is split accordingly.
+#
+#
+
+AdjustSpline = Proc.new{|evt, obj|
+    @itw.GetPath(@poly)
+    npts = @itw.GetNumberOfHandles
+
+    if npts < 2
+        @imageActor2.SetInput(extract.GetOutput)
+        return
+    end
+
+    closed = @itw.IsClosed
+
+    if closed
+        @isw.ClosedOn
+    else
+        @isw.ClosedOff
+        @imageActor2.SetInput(extract.GetOutput)
+    end
+
+    @isw.SetNumberOfHandles(npts)
+
+    for i in 0...npts
+        pt = @poly.GetPoints.GetPoint(i)
+        @isw.SetHandlePosition(i, pt[0], pt[1], pt[2])
+    end
+
+    if closed
+        @isw.GetPolyData(@spoly)
+        @imageActor2.SetInput(@stencil.GetOutput)
+        @stencil.Update
+    end
+}
+
+AdjustTracer = Proc.new{|evt, obj|
+    npts = @isw.GetNumberOfHandles
+    @points.SetNumberOfPoints(npts)
+
+    for i in 0...npts
+        pt = @isw.GetHandlePosition(i)
+        @points.SetPoint(i, pt[0], pt[1], pt[2])
+    end
+
+    closed = @isw.GetClosed
+
+    if closed
+        @isw.GetPolyData(@spoly)
+        @imageActor2.SetInput(@stencil.GetOutput)
+        @stencil.Update
+    end
+
+    @itw.InitializeHandles(@points)
+}
+
+
+# Start by loading some data.
+v16 = Vtk::Volume16Reader.new
+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
+#
+
+srange = v16.GetOutput.GetScalarRange
+min = srange[0]
+max = srange[1]
+
+diff = max-min
+slope = 255.0/diff
+inter = -slope*min
+shift = inter/slope
+
+shifter = Vtk::ImageShiftScale.new
+shifter.SetShift(shift)
+shifter.SetScale(slope)
+shifter.SetOutputScalarTypeToUnsignedChar
+shifter.SetInputConnection(v16.GetOutputPort)
+shifter.ReleaseDataFlagOff
+shifter.Update
+
+# Display a y-z plane.
+#
+imageActor = Vtk::ImageActor.new
+imageActor.SetInput(shifter.GetOutput)
+imageActor.VisibilityOn
+imageActor.SetDisplayExtent(31, 31, 0, 63, 0, 92)
+imageActor.InterpolateOff
+#
+
+spc = shifter.GetOutput.GetSpacing
+orig = shifter.GetOutput.GetOrigin
+x0 = orig[0]
+xspc = spc[0]
+pos = x0+xspc*31.0
+
+# An alternative would be to formulate position in this case by:
+# set bounds [imageActor GetBounds]
+# set pos [lindex $bounds 0]
+#
+#
+
+ren = Vtk::Renderer.new
+ren.SetBackground(0.4, 0.4, 0.5)
+ren2 = Vtk::Renderer.new
+ren2.SetBackground(0.5, 0.4, 0.4)
+#
+
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+renWin.AddRenderer(ren2)
+renWin.SetSize(600, 300)
+#
+
+ren.SetViewport(0, 0, 0.5, 1)
+ren2.SetViewport(0.5, 0, 1, 1)
+#
+
+interactor = Vtk::InteractorStyleImage.new
+#
+
+iren = Vtk::RenderWindowInteractor.new
+iren.SetInteractorStyle(interactor)
+iren.SetRenderWindow(renWin)
+#
+
+extract = Vtk::ExtractVOI.new
+extract.SetVOI(31, 31, 0, 63, 0, 92)
+extract.SetSampleRate(1, 1, 1)
+extract.SetInputConnection(shifter.GetOutputPort)
+extract.ReleaseDataFlagOff
+#
+
+@imageActor2 = Vtk::ImageActor.new
+@imageActor2.SetInput(extract.GetOutput)
+@imageActor2.VisibilityOn
+@imageActor2.SetDisplayExtent(31, 31, 0, 63, 0, 92)
+@imageActor2.InterpolateOff
+#
+
+# Set up the image tracer widget
+#
+@itw = Vtk::ImageTracerWidget.new
+#
+# Set the tolerance for capturing last handle when near first handle
+# to form closed paths.
+#
+@itw.SetCaptureRadius(1.5)
+@itw.GetGlyphSource.SetColor(1, 0, 0)
+#
+# Set the size of the glyph handle
+#
+@itw.GetGlyphSource.SetScale(3.0)
+#
+# Set the initial rotation of the glyph if desired.  The default glyph
+# set internally by the widget is a '+' so rotating 45 deg. gives a 'x'
+#
+@itw.GetGlyphSource.SetRotationAngle(45.0)
+@itw.GetGlyphSource.Modified
+@itw.ProjectToPlaneOn
+@itw.SetProjectionNormalToXAxes
+@itw.SetProjectionPosition(pos)
+@itw.SetViewProp(imageActor)
+@itw.SetInput(shifter.GetOutput)
+@itw.SetInteractor(iren)
+@itw.PlaceWidget
+
+#
+# When the underlying vtkDataSet is a vtkImageData, the widget can be
+# forced to snap to either nearest pixel @points, || pixel centers.  Here
+# it is turned off.
+#
+@itw.SnapToImageOff
+
+#
+# Automatically form closed paths.
+#
+#itw AutoCloseOn
+@itw.AutoCloseOn
+#
+
+# Set up a vtkSplineWidget in the second renderer && have
+# its handles set by the tracer widget.
+#
+@isw = Vtk::SplineWidget.new
+@isw.SetCurrentRenderer(ren2)
+@isw.SetDefaultRenderer(ren2)
+@isw.SetInput(extract.GetOutput)
+@isw.SetInteractor(iren)
+bnds = @imageActor2.GetBounds
+@isw.PlaceWidget(bnds[0], bnds[1], bnds[2], bnds[3], bnds[4], bnds[5])
+@isw.ProjectToPlaneOn
+@isw.SetProjectionNormalToXAxes
+@isw.SetProjectionPosition(pos)
+#
+
+# Have the widgets control each others handle positions.
+#
+@itw.AddObserver('EndInteractionEvent',AdjustSpline)
+@isw.AddObserver('EndInteractionEvent',AdjustTracer)
+#
+
+@itw.On
+@isw.On
+#
+
+@poly = Vtk::PolyData.new
+@points = Vtk::Points.new
+@spoly = Vtk::PolyData.new
+#
+
+# Set up a pipleline to demonstrate extraction of a 2D
+# region of interest.  Defining a closed clockwise path using the
+# tracer widget will extract all pixels within the loop.  A counter
+# clockwise path provides the dual region of interest.
+#
+extrude = Vtk::LinearExtrusionFilter.new
+extrude.SetInput(@spoly)
+extrude.SetScaleFactor(1)
+extrude.SetExtrusionTypeToNormalExtrusion
+extrude.SetVector(1, 0, 0)
+#
+
+dataToStencil = Vtk::PolyDataToImageStencil.new
+dataToStencil.SetInputConnection(extrude.GetOutputPort)
+#
+
+@stencil = Vtk::ImageStencil.new
+@stencil.SetInputConnection(extract.GetOutputPort)
+@stencil.SetStencil(dataToStencil.GetOutput)
+@stencil.ReverseStencilOff
+@stencil.SetBackgroundValue(128)
+#
+
+# Add all the actors.
+#
+ren.AddViewProp(imageActor)
+ren2.AddViewProp(@imageActor2)
+#
+
+# Render the image.
+#
+renWin.Render
+#
+
+ren.GetActiveCamera.SetViewUp(0, 1, 0)
+ren.GetActiveCamera.Azimuth(270)
+ren.GetActiveCamera.Roll(270)
+ren.GetActiveCamera.Dolly(1.7)
+ren.ResetCameraClippingRange
+#
+
+ren2.GetActiveCamera.SetViewUp(0, 1, 0)
+ren2.GetActiveCamera.Azimuth(270)
+ren2.GetActiveCamera.Roll(270)
+ren2.GetActiveCamera.Dolly(1.7)
+ren2.ResetCameraClippingRange
+#
+
+# if we don't do this, the widgets disappear behind the imageActor.
+Vtk::Mapper.SetResolveCoincidentTopologyToPolygonOffset
+Vtk::Mapper.SetResolveCoincidentTopologyPolygonOffsetParameters(10,10)
+
+
+renWin.Render
+#
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/ImplicitPlaneWidget.rb VTK/Examples/GUI/Ruby/ImplicitPlaneWidget.rb
--- VTK_org/Examples/GUI/Ruby/ImplicitPlaneWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/ImplicitPlaneWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,80 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use the vtkPlaneWidget to probe a
+# dataset && then generate contours on the probed data.
+
+require 'vtk'
+
+# Create a mace out of filters.
+sphere = Vtk::SphereSource.new
+cone = Vtk::ConeSource.new
+glyph = Vtk::Glyph3D.new
+glyph.SetInputConnection(sphere.GetOutputPort)
+glyph.SetSource(cone.GetOutput)
+glyph.SetVectorModeToUseNormal
+glyph.SetScaleModeToScaleByVector
+glyph.SetScaleFactor(0.25)
+
+# The sphere && spikes are appended into a single polydata.
+# This just makes things simpler to manage.
+apd = Vtk::AppendPolyData.new
+apd.AddInput(glyph.GetOutput)
+apd.AddInput(sphere.GetOutput)
+
+maceMapper = Vtk::PolyDataMapper.new
+maceMapper.SetInputConnection(apd.GetOutputPort)
+
+maceActor = Vtk::LODActor.new
+maceActor.SetMapper(maceMapper)
+maceActor.VisibilityOn
+
+# This portion of the code clips the mace with the vtkPlanes
+# implicit function. The clipped region is colored green.
+plane = Vtk::Plane.new
+clipper = Vtk::ClipPolyData.new
+clipper.SetInputConnection(apd.GetOutputPort)
+clipper.SetClipFunction(plane)
+clipper.InsideOutOn
+
+selectMapper = Vtk::PolyDataMapper.new
+selectMapper.SetInputConnection(clipper.GetOutputPort)
+
+selectActor = Vtk::LODActor.new
+selectActor.SetMapper(selectMapper)
+selectActor.GetProperty.SetColor(0, 1, 0)
+selectActor.VisibilityOff
+selectActor.SetScale(1.01, 1.01, 1.01)
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# The callback function
+myCallback = Proc.new{|obj, event|
+    obj.GetPlane(plane)
+    selectActor.VisibilityOn
+}
+
+# Associate the line widget with the interactor
+planeWidget = Vtk::ImplicitPlaneWidget.new
+planeWidget.SetInteractor(iren)
+planeWidget.SetPlaceFactor(1.25)
+planeWidget.SetInput(glyph.GetOutput)
+planeWidget.PlaceWidget
+planeWidget.AddObserver("InteractionEvent", myCallback)
+
+ren.AddActor(maceActor)
+ren.AddActor(selectActor)
+
+# Add the actors to the renderer, set the background && size
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(300, 300)
+ren.SetBackground(0.1, 0.2, 0.4)
+
+# Start interaction.
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/OrthogonalPlanesWithTkPhoto.rb VTK/Examples/GUI/Ruby/OrthogonalPlanesWithTkPhoto.rb
--- VTK_org/Examples/GUI/Ruby/OrthogonalPlanesWithTkPhoto.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/OrthogonalPlanesWithTkPhoto.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,150 @@
+require 'vtk'
+require 'vtk/util'
+require 'vtk/tk'
+
+
+class SampleViewer
+  def initialize
+    root = TkRoot.new.title( 'Ruby Version of vtkImageDataToTkPhoto' )
+
+    # Image pipeline
+    reader = Vtk::Volume16Reader.new
+    reader.SetDataDimensions( 64, 64 )
+    reader.SetDataByteOrderToLittleEndian
+    reader.SetFilePrefix( vtkGetDataRoot + '/Data/headsq/quarter'  )
+    reader.SetImageRange( 1, 93 )
+    reader.SetDataSpacing( 3.2, 3.2, 1.5 )
+    reader.Update 
+
+    @cast = cast = Vtk::ImageCast.new
+    cast.SetInputConnection( reader.GetOutputPort )
+    cast.SetOutputScalarType( reader.GetOutput.GetScalarType )
+    cast.ClampOverflowOn
+
+    # Make the image a little bigger
+    @resample = resample = Vtk::ImageResample.new
+    resample.SetInputConnection( cast.GetOutputPort )
+    resample.SetAxisMagnificationFactor( 0, 2 )
+    resample.SetAxisMagnificationFactor( 1, 2 )
+    resample.SetAxisMagnificationFactor( 2, 1 )
+
+    l,h = reader.GetOutput.GetScalarRange
+
+    # Create the three orthogonal views
+
+    tphoto = @tphoto = Vtk::TkPhotoImage.new
+    cphoto = @cphoto = Vtk::TkPhotoImage.new
+    sphoto = @sphoto = Vtk::TkPhotoImage.new
+    reader.Update
+    d = reader.GetOutput.GetDimensions
+    @Position = [ (d[0]/2.0).to_i, (d[0]/2.0).to_i, (d[0]/2.0).to_i ]
+
+    # Create a popup menu
+    castToUnsignedChar = Proc.new{
+      @cast.SetOutputScalarTypeToUnsignedChar
+      self.SetImages
+    }
+    castToUnsignedShort = Proc.new{
+      @cast.SetOutputScalarTypeToUnsignedShort
+      self.SetImages
+    }
+    castToUnsignedInt = Proc.new{
+      @cast.SetOutputScalarTypeToUnsignedInt
+      self.SetImages
+    }
+    castToFloat = Proc.new{
+      @cast.SetOutputScalarTypeToFloat
+      self.SetImages
+    }
+
+    v = TkVariable.new
+    @popup = popup = TkMenu.new( root, 'tearoff'=>0 )
+    popup.add_radiobutton( 'label'=>'unsigned char', 'command'=>castToUnsignedChar, 'variable'=>v, 'value'=>-1 )
+    popup.add_radiobutton( 'label'=>'unsigned short', 'command'=>castToUnsignedShort, 'variable'=>v, 'value'=>0 )
+    popup.add_radiobutton( 'label'=>'unsigned int', 'command'=>castToUnsignedInt, 'variable'=>v, 'value'=>1 )
+    popup.add_radiobutton( 'label'=>'float', 'command'=>castToFloat, 'variable'=>v, 'value'=>2 )
+
+    v.value = 0
+
+    setWindowLevel = Proc.new{|event|
+      self.SetImages
+    }
+
+    w = @TransverseLabelWidget = TkLabel.new( root, 'image'=>tphoto )
+    w.grid( 'row'=>0, 'column'=>0 )
+    w.bind( "Button1-Motion" ){|e,i,o.s| i||i=tphoto; o||o='transverse'; s||s=self; s.Motion( e, i, o ) }
+    w.bind( "Button-3" ){|e| self.DoPopup(e) }
+    w = TkLabel.new( root, 'image'=>cphoto )
+    w.grid( 'row'=>1, 'column'=>0 )
+    w.bind( "Button1-Motion" ){|e,i,o,s| i||i=cphoto; o||o='coronal'; s||s=self; s.Motion( e, i, o ) }
+    w.bind( "Button-3" ){|e| self.DoPopup(e) }
+    w = TkLabel.new( root, 'image'=>sphoto )
+    w.grid( 'row'=>0, 'column'=>1 )
+    w.bind( "Button1-Motion" ){|e,i,o.s| i||i=sphoto; o||o='sagittal'; s||s=self; s.Motion( e, i, o ) }
+    w.bind( "Button-3" ){|e| self.DoPopup(e) }
+    w = @WindowWidget = TkScale.new( root, 'label'=>'Window', 'orient'=>'horizontal', 'from'=>1, 'to'=>(h-l)/2, 'command'=>setWindowLevel )
+    w = @LevelWidget = TkScale.new( root, 'label'=>'Level', 'orient'=>'horizontal', 'from'=>l, 'to'=>h, 'command'=>setWindowLevel )
+    @WindowWidget.grid( 'row'=>2, 'columnspan'=>2, 'sticky'=>'ew' )
+    @LevelWidget.grid( 'row'=>3, 'columnspan'=>2, 'sticky'=>'ew' );
+    @WindowWidget.set( 1370 );
+    @LevelWidget.set( 1268 );
+
+    w = @LabelWidget = TkLabel.new( root, 'bd'=>2, 'relief'=>'raised' )
+    w.grid( 'row'=>4, 'columnspan'=>2, 'sticky'=>'ew' )
+    w.configure( 'text'=>"Use the right mouse button to change data type" )
+  end
+
+
+  def DoPopup( event )
+    @popup.post( event.x_root, event.y_root )
+  end
+
+  def Motion( event, image, orientation )
+    w = image.width
+    h = image.height
+    if orientation == 'transverse'
+      @Position[0] = event.x
+      @Position[1] = h - event.y - 1
+    end
+    if orientation == 'coronal'
+      @Position[0] = event.x
+      @Position[2] = event.y
+    end
+    if orientation == 'sagittal'
+      @Position[1] = w - event.x - 1
+      @Position[2] = event.y
+    end
+    x, y, z = @Posistion
+    @LabelWidget.configure( 'text'=>"Position: #{"%d"%x}, #{"%d"%y}, #{"%d"%z}" )
+    self.SetImages
+  end
+
+  def SetImages
+    window = @WindowWidget.get
+    level = @LevelWidget.get
+    image = @resample.GetOutput 
+    @tphoto.PutImageSlice( image,
+                           @Position[2],
+                           'orientation'=>'transverse',
+                           'window'=>window,
+                           'level'=>level )
+    @sphoto.PutImageSlice( image,
+                           @Position[0],
+                           'orientation'=>'sagittal',
+                           'window'=>window,
+                           'level'=>level )
+    @cphoto.PutImageSlice( image,
+                           @Position[1],
+                           'orientation'=>'coronal',
+                           'window'=>window,
+                           'level'=>level )
+  end
+
+end
+
+
+
+if $0 == __FILE__
+  S = SampleViewer.new
+  Tk.mainloop
+end
diff -uNr VTK_org/Examples/GUI/Ruby/ProbeWithPointWidget.rb VTK/Examples/GUI/Ruby/ProbeWithPointWidget.rb
--- VTK_org/Examples/GUI/Ruby/ProbeWithPointWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/ProbeWithPointWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,93 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use the vtkPointWidget to probe a
+# dataset && then color the probed point (represented as a cone) as
+# per the probed value && orient it as per the vector.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Start by loading some data.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# The plane widget is used probe the dataset.
+pointWidget = Vtk::PointWidget.new
+pointWidget.SetInput(pl3d.GetOutput)
+pointWidget.AllOff
+pointWidget.PlaceWidget
+point = Vtk::PolyData.new
+pointWidget.GetPolyData(point)
+
+probe = Vtk::ProbeFilter.new
+probe.SetInput(point)
+probe.SetSource(pl3d.GetOutput)
+
+# create glyph
+cone = Vtk::ConeSource.new
+cone.SetResolution(16)
+glyph = Vtk::Glyph3D.new
+glyph.SetInputConnection(probe.GetOutputPort)
+glyph.SetSource(cone.GetOutput)
+glyph.SetVectorModeToUseVector
+glyph.SetScaleModeToDataScalingOff
+glyph.SetScaleFactor(pl3d.GetOutput.GetLength*0.1)
+glyphMapper = Vtk::PolyDataMapper.new
+glyphMapper.SetInputConnection(glyph.GetOutputPort)
+glyphActor = Vtk::Actor.new
+glyphActor.SetMapper(glyphMapper)
+glyphActor.VisibilityOff
+
+# An outline is shown for context.
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Actually set the color && orientation of the probe.
+BeginInteraction = Proc.new{|obj, event|
+    obj.GetPolyData(point)
+    glyphActor.VisibilityOn 
+}
+
+ProbeData = Proc.new{|obj, event|
+    obj.GetPolyData(point) 
+}
+
+# Associate the line widget with the interactor
+pointWidget.SetInteractor(iren)
+pointWidget.AddObserver("EnableEvent", BeginInteraction)
+pointWidget.AddObserver("StartInteractionEvent", BeginInteraction)
+pointWidget.AddObserver("InteractionEvent", ProbeData)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(outlineActor)
+ren.AddActor(glyphActor)
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(300, 300)
+ren.SetBackground(0.1, 0.2, 0.4)
+
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(3.95297, 50)
+cam1.SetFocalPoint(9.71821, 0.458166, 29.3999)
+cam1.SetPosition(2.7439, -37.3196, 38.7167)
+cam1.SetViewUp(-0.16123, 0.264271, 0.950876)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/ProbingWithPlaneWidget.rb VTK/Examples/GUI/Ruby/ProbingWithPlaneWidget.rb
--- VTK_org/Examples/GUI/Ruby/ProbingWithPlaneWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/ProbingWithPlaneWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,90 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use the vtkPlaneWidget to probe
+# a dataset && then generate contours on the probed data.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Start by loading some data.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# The plane widget is used probe the dataset.
+planeWidget = Vtk::PlaneWidget.new
+planeWidget.SetInput(pl3d.GetOutput)
+planeWidget.NormalToXAxisOn
+planeWidget.SetResolution(20)
+planeWidget.SetRepresentationToOutline
+planeWidget.PlaceWidget
+plane = Vtk::PolyData.new
+planeWidget.GetPolyData(plane)
+
+probe = Vtk::ProbeFilter.new
+probe.SetInput(plane)
+probe.SetSource(pl3d.GetOutput)
+
+contourMapper = Vtk::PolyDataMapper.new
+contourMapper.SetInputConnection(probe.GetOutputPort)
+contourMapper.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+contourActor = Vtk::Actor.new
+contourActor.SetMapper(contourMapper)
+contourActor.VisibilityOff
+
+# An outline is shown for context.
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Actually generate contour lines.
+BeginInteraction = Proc.new{|obj, event|
+    global plane, contourActor
+    obj.GetPolyData(plane)
+    contourActor.VisibilityOn
+}
+
+ProbeData = Proc.new{|obj, event|
+    global plane
+    obj.GetPolyData(plane)
+}
+
+
+# Associate the widget with the interactor
+planeWidget.SetInteractor(iren)
+# Handle the events.
+planeWidget.AddObserver("EnableEvent", BeginInteraction)
+planeWidget.AddObserver("StartInteractionEvent", BeginInteraction)
+planeWidget.AddObserver("InteractionEvent", ProbeData)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(outlineActor)
+ren.AddActor(contourActor)
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(300, 300)
+ren.SetBackground(0.1, 0.2, 0.4)
+
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(3.95297, 50)
+cam1.SetFocalPoint(9.71821, 0.458166, 29.3999)
+cam1.SetPosition(2.7439, -37.3196, 38.7167)
+cam1.SetViewUp(-0.16123, 0.264271, 0.950876)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/SphereWidget.rb VTK/Examples/GUI/Ruby/SphereWidget.rb
--- VTK_org/Examples/GUI/Ruby/SphereWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/SphereWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,115 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use the vtkSphereWidget to control
+# the position of a light.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Start by loading some data.
+dem = Vtk::DEMReader.new
+dem.SetFileName(VTK_DATA_ROOT + "/Data/SainteHelens.dem")
+dem.Update
+
+Scale = 2
+lut = Vtk::LookupTable.new
+lut.SetHueRange(0.6, 0)
+lut.SetSaturationRange(1.0, 0)
+lut.SetValueRange(0.5, 1.0)
+
+lo = Scale*dem.GetElevationBounds[0]
+hi = Scale*dem.GetElevationBounds[1]
+
+shrink = Vtk::ImageShrink3D.new
+shrink.SetShrinkFactors(4, 4, 1)
+shrink.SetInputConnection(dem.GetOutputPort)
+shrink.AveragingOn
+
+geom = Vtk::ImageDataGeometryFilter.new
+geom.SetInputConnection(shrink.GetOutputPort)
+geom.ReleaseDataFlagOn
+
+warp = Vtk::WarpScalar.new
+warp.SetInputConnection(geom.GetOutputPort)
+warp.SetNormal(0, 0, 1)
+warp.UseNormalOn
+warp.SetScaleFactor(Scale)
+warp.ReleaseDataFlagOn
+
+elevation = Vtk::ElevationFilter.new
+elevation.SetInputConnection(warp.GetOutputPort)
+elevation.SetLowPoint(0, 0, lo)
+elevation.SetHighPoint(0, 0, hi)
+elevation.SetScalarRange(lo, hi)
+elevation.ReleaseDataFlagOn
+
+normals = Vtk::PolyDataNormals.new
+normals.SetInput(elevation.GetPolyDataOutput)
+normals.SetFeatureAngle(60)
+normals.ConsistencyOff
+normals.SplittingOff
+normals.ReleaseDataFlagOn
+
+demMapper = Vtk::PolyDataMapper.new
+demMapper.SetInputConnection(normals.GetOutputPort)
+demMapper.SetScalarRange(lo, hi)
+demMapper.SetLookupTable(lut)
+demMapper.ImmediateModeRenderingOn
+
+demActor = Vtk::LODActor.new
+demActor.SetMapper(demMapper)
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+iren.LightFollowCameraOff
+iren.SetInteractorStyle(nil)
+
+# Associate the line widget with the interactor
+sphereWidget = Vtk::SphereWidget.new
+sphereWidget.SetInteractor(iren)
+sphereWidget.SetProp3D(demActor)
+sphereWidget.SetPlaceFactor(4)
+sphereWidget.PlaceWidget
+sphereWidget.TranslationOff
+sphereWidget.ScaleOff
+sphereWidget.HandleVisibilityOn
+
+# Uncomment the next line if you want to see the widget active when
+# the script starts
+#sphereWidget.EnabledOn
+
+# Actually probe the data
+MoveLight = Proc.new{|obj, event|
+    global light
+    light.SetPosition(obj.GetHandlePosition)
+}
+
+sphereWidget.AddObserver("InteractionEvent", MoveLight)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(demActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(300, 300)
+ren.SetBackground(0.1, 0.2, 0.4)
+
+cam1 = ren.GetActiveCamera
+cam1.SetViewUp(0, 0, 1)
+cam1.SetFocalPoint(dem.GetOutput.GetCenter)
+cam1.SetPosition(1, 0, 0)
+ren.ResetCamera
+cam1.Elevation(25)
+cam1.Azimuth(125)
+cam1.Zoom(1.25)
+
+light = Vtk::Light.new
+light.SetFocalPoint(dem.GetOutput.GetCenter)
+ren.AddLight(light)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/StreamlinesWithLineWidget.rb VTK/Examples/GUI/Ruby/StreamlinesWithLineWidget.rb
--- VTK_org/Examples/GUI/Ruby/StreamlinesWithLineWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/StreamlinesWithLineWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,143 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use the vtkLineWidget to seed &&
+# manipulate streamlines. Two line widgets are created. One is invoked
+# by pressing 'i', the other by pressing 'L' (capital). Both can exist
+# together.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Start by loading some data.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# The line widget is used seed the streamlines.
+lineWidget = Vtk::LineWidget.new
+seeds = Vtk::PolyData.new
+lineWidget.SetInput(pl3d.GetOutput)
+lineWidget.SetAlignToYAxis
+lineWidget.PlaceWidget
+lineWidget.GetPolyData(seeds)
+lineWidget.ClampToBoundsOn
+
+rk4 = Vtk::RungeKutta4.new
+streamer = Vtk::StreamLine.new
+streamer.SetInputConnection(pl3d.GetOutputPort)
+streamer.SetSource(seeds)
+streamer.SetMaximumPropagationTime(100)
+streamer.SetIntegrationStepLength(0.2)
+streamer.SetStepLength(0.001)
+streamer.SetNumberOfThreads(1)
+streamer.SetIntegrationDirectionToForward
+streamer.VorticityOn
+streamer.SetIntegrator(rk4)
+rf = Vtk::RibbonFilter.new
+rf.SetInputConnection(streamer.GetOutputPort)
+rf.SetWidth(0.1)
+rf.SetWidthFactor(5)
+streamMapper = Vtk::PolyDataMapper.new
+streamMapper.SetInputConnection(rf.GetOutputPort)
+streamMapper.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+streamline = Vtk::Actor.new
+streamline.SetMapper(streamMapper)
+streamline.VisibilityOff
+
+# The second line widget is used seed more streamlines.
+lineWidget2 = Vtk::LineWidget.new
+seeds2 = Vtk::PolyData.new
+lineWidget2.SetInput(pl3d.GetOutput)
+lineWidget2.PlaceWidget
+lineWidget2.GetPolyData(seeds2)
+lineWidget2.SetKeyPressActivationValue('L')
+
+streamer2 = Vtk::StreamLine.new
+streamer2.SetInputConnection(pl3d.GetOutputPort)
+streamer2.SetSource(seeds2)
+streamer2.SetMaximumPropagationTime(100)
+streamer2.SetIntegrationStepLength(0.2)
+streamer2.SetStepLength(0.001)
+streamer2.SetNumberOfThreads(1)
+streamer2.SetIntegrationDirectionToForward
+streamer2.VorticityOn
+streamer2.SetIntegrator(rk4)
+rf2 = Vtk::RibbonFilter.new
+rf2.SetInputConnection(streamer2.GetOutputPort)
+rf2.SetWidth(0.1)
+rf2.SetWidthFactor(5)
+streamMapper2 = Vtk::PolyDataMapper.new
+streamMapper2.SetInputConnection(rf2.GetOutputPort)
+streamMapper2.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+streamline2 = Vtk::Actor.new
+streamline2.SetMapper(streamMapper2)
+streamline2.VisibilityOff
+
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Callback functions that actually generate streamlines.
+BeginInteraction = Proc.new{|obj, event|
+    global streamline
+    streamline.VisibilityOn 
+}
+
+GenerateStreamlines = Proc.new{|obj, event|
+    global seeds, renWin
+    obj.GetPolyData(seeds)
+    renWin.Render
+}
+
+BeginInteraction2 = Proc.new{|obj, event|
+    global streamline2
+    streamline2.VisibilityOn
+}
+
+GenerateStreamlines2 = Proc.new{|obj, event|
+    global seeds2, renWin
+    obj.GetPolyData(seeds2)
+    renWin.Render
+}
+
+# Associate the line widget with the interactor && setup callbacks.
+lineWidget.SetInteractor(iren)
+lineWidget.AddObserver("StartInteractionEvent", BeginInteraction)
+lineWidget.AddObserver("InteractionEvent", GenerateStreamlines)
+
+lineWidget2.SetInteractor(iren)
+lineWidget2.AddObserver("StartInteractionEvent", BeginInteraction2)
+lineWidget2.AddObserver("EndInteractionEvent", GenerateStreamlines2)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(outlineActor)
+ren.AddActor(streamline)
+ren.AddActor(streamline2)
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(300, 300)
+ren.SetBackground(0.1, 0.2, 0.4)
+
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(3.95297, 50)
+cam1.SetFocalPoint(9.71821, 0.458166, 29.3999)
+cam1.SetPosition(2.7439, -37.3196, 38.7167)
+cam1.SetViewUp(-0.16123, 0.264271, 0.950876)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/TransformWithBoxWidget.rb VTK/Examples/GUI/Ruby/TransformWithBoxWidget.rb
--- VTK_org/Examples/GUI/Ruby/TransformWithBoxWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/TransformWithBoxWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,66 @@
+#!/usr/bin/env ruby
+
+# Demonstrate how to use the vtkBoxWidget to translate, scale, &&
+# rotate actors.  The basic idea is that the box widget controls an
+# actor's transform. A callback which modifies the transform is
+# invoked as the box widget is manipulated.
+
+require 'vtk'
+
+# Start by creating some simple geometry; in this case a mace.
+sphere = Vtk::SphereSource.new
+cone = Vtk::ConeSource.new
+glyph = Vtk::Glyph3D.new
+glyph.SetInputConnection(sphere.GetOutputPort)
+glyph.SetSource(cone.GetOutput)
+glyph.SetVectorModeToUseNormal
+glyph.SetScaleModeToScaleByVector
+glyph.SetScaleFactor(0.25)
+appendData = Vtk::AppendPolyData.new
+appendData.AddInput(glyph.GetOutput)
+appendData.AddInput(sphere.GetOutput)
+maceMapper = Vtk::PolyDataMapper.new
+maceMapper.SetInputConnection(appendData.GetOutputPort)
+maceActor = Vtk::LODActor.new
+maceActor.SetMapper(maceMapper)
+maceActor.VisibilityOn
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# The box widget observes the events invoked by the render window
+# interactor.  These events come from user interaction in the render
+# window.
+boxWidget = Vtk::BoxWidget.new
+boxWidget.SetInteractor(iren)
+boxWidget.SetPlaceFactor(1.25)
+
+# Add the actors to the renderer, set the background && window size.
+ren.AddActor(maceActor)
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin.SetSize(300, 300)
+
+# As the box widget is interacted with, it produces a transformation
+# matrix that is set on the actor.
+t = Vtk::Transform.new
+TransformActor = Proc.new{|obj, event|
+    global t, maceActor
+    obj.GetTransform(t)
+    maceActor.SetUserTransform(t)
+}
+
+# Place the interactor initially. The actor is used to place && scale
+# the interactor. An observer is added to the box widget to watch for
+# interaction events. This event is captured && used to set the
+# transformation matrix of the actor.
+boxWidget.SetProp3D(maceActor)
+boxWidget.PlaceWidget
+boxWidget.AddObserver("InteractionEvent", TransformActor)
+
+iren.Initialize 
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/GUI/Ruby/VolumeRenderWithBoxWidget.rb VTK/Examples/GUI/Ruby/VolumeRenderWithBoxWidget.rb
--- VTK_org/Examples/GUI/Ruby/VolumeRenderWithBoxWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/GUI/Ruby/VolumeRenderWithBoxWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,130 @@
+#!/usr/bin/env ruby
+
+# Demonstrate how to use the vtkBoxWidget to control volume rendering
+# within the interior of the widget.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Load a volume, use the widget to control what's volume
+# rendered. Basically the idea is that the vtkBoxWidget provides a box
+# which clips the volume rendering.
+v16 = Vtk::Volume16Reader.new
+v16.SetDataDimensions(64, 64)
+v16.GetOutput.SetOrigin(0.0, 0.0, 0.0)
+v16.SetDataByteOrderToLittleEndian
+v16.SetFilePrefix(VTK_DATA_ROOT+ "/Data/headsq/quarter")
+v16.SetImageRange(1, 93)
+v16.SetDataSpacing(3.2, 3.2, 1.5)
+
+tfun = Vtk::PiecewiseFunction.new
+tfun.AddPoint(70.0, 0.0)
+tfun.AddPoint(599.0, 0)
+tfun.AddPoint(600.0, 0)
+tfun.AddPoint(1195.0, 0)
+tfun.AddPoint(1200, 0.2)
+tfun.AddPoint(1300, 0.3)
+tfun.AddPoint(2000, 0.3)
+tfun.AddPoint(4095.0, 1.0)
+
+ctfun = Vtk::ColorTransferFunction.new
+ctfun.AddRGBPoint(0.0, 0.5, 0.0, 0.0)
+ctfun.AddRGBPoint(600.0, 1.0, 0.5, 0.5)
+ctfun.AddRGBPoint(1280.0, 0.9, 0.2, 0.3)
+ctfun.AddRGBPoint(1960.0, 0.81, 0.27, 0.1)
+ctfun.AddRGBPoint(4095.0, 0.5, 0.5, 0.5)
+
+compositeFunction = Vtk::VolumeRayCastCompositeFunction.new
+
+volumeMapper = Vtk::VolumeRayCastMapper.new
+volumeMapper.SetInputConnection(v16.GetOutputPort)
+volumeMapper.SetVolumeRayCastFunction(compositeFunction)
+
+volumeProperty = Vtk::VolumeProperty.new
+volumeProperty.SetColor(ctfun)
+volumeProperty.SetScalarOpacity(tfun)
+volumeProperty.SetInterpolationTypeToLinear
+volumeProperty.ShadeOn
+
+newvol = Vtk::Volume.new
+newvol.SetMapper(volumeMapper)
+newvol.SetProperty(volumeProperty)
+
+outline = Vtk::OutlineFilter.new
+outline.SetInputConnection(v16.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# The SetInteractor method is how 3D widgets are associated with the
+# render window interactor. Internally, SetInteractor sets up a bunch
+# of callbacks using the Command/Observer mechanism (AddObserver).
+boxWidget = Vtk::BoxWidget.new
+boxWidget.SetInteractor(iren)
+boxWidget.SetPlaceFactor(1.0)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(outlineActor)
+ren.AddVolume(newvol)
+
+ren.SetBackground(0, 0, 0)
+renWin.SetSize(300, 300)
+
+# When interaction starts, the requested frame rate is increased.
+StartInteraction = Proc.new{|obj, event|
+    global renWin
+    renWin.SetDesiredUpdateRate(10)
+}
+
+# When interaction ends, the requested frame rate is decreased to
+# normal levels. This causes a full resolution render to occur.
+EndInteraction = Proc.new{|obj, event|
+    global renWin
+    renWin.SetDesiredUpdateRate(0.001)
+}
+
+# The implicit function vtkPlanes is used in conjunction with the
+# volume ray cast mapper to limit which portion of the volume is
+# volume rendered.
+planes = Vtk::Planes.new
+ClipVolumeRender = Proc.new{|obj, event|
+    global planes, volumeMapper
+    obj.GetPlanes(planes)
+    volumeMapper.SetClippingPlanes(planes)
+}
+
+
+# Place the interactor initially. The output of the reader is used to
+# place the box widget.
+boxWidget.SetInput(v16.GetOutput)
+boxWidget.PlaceWidget
+boxWidget.InsideOutOn
+boxWidget.AddObserver("StartInteractionEvent", StartInteraction)
+boxWidget.AddObserver("InteractionEvent", ClipVolumeRender)
+boxWidget.AddObserver("EndInteractionEvent", EndInteraction)
+
+outlineProperty = boxWidget.GetOutlineProperty
+outlineProperty.SetRepresentationToWireframe
+outlineProperty.SetAmbient(1.0)
+outlineProperty.SetAmbientColor(1, 1, 1)
+outlineProperty.SetLineWidth(3)
+
+selectedOutlineProperty = boxWidget.GetSelectedOutlineProperty
+selectedOutlineProperty.SetRepresentationToWireframe
+selectedOutlineProperty.SetAmbient(1.0)
+selectedOutlineProperty.SetAmbientColor(1, 0, 0)
+selectedOutlineProperty.SetLineWidth(3)
+
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/ImageProcessing/Ruby/Contours2D.rb VTK/Examples/ImageProcessing/Ruby/Contours2D.rb
--- VTK_org/Examples/ImageProcessing/Ruby/Contours2D.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/ImageProcessing/Ruby/Contours2D.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,75 @@
+#!/usr/bin/env ruby
+
+# This example shows how to sample a mathematical function over a
+# volume. A slice from the volume is then extracted && then contoured
+# to produce 2D contour lines.
+#
+require 'vtk'
+
+# Quadric definition. This is a type of implicit function. Here the 
+# coefficients to the equations are set.
+quadric = Vtk::Quadric.new
+quadric.SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0)
+
+# The vtkSampleFunction uses the quadric function && evaluates function
+# value over a regular lattice (i.e., a volume).
+sample = Vtk::SampleFunction.new
+sample.SetSampleDimensions(30, 30, 30)
+sample.SetImplicitFunction(quadric)
+sample.ComputeNormalsOff
+sample.Update
+
+# Here a single slice (i.e., image) is extracted from the volume. (Note: in
+# actuality the VOI request causes the sample function to operate on just the
+# slice.)
+extract = Vtk::ExtractVOI.new
+extract.SetInputConnection(sample.GetOutputPort)
+extract.SetVOI(0, 29, 0, 29, 15, 15)
+extract.SetSampleRate(1, 2, 3)
+
+# The image is contoured to produce contour lines. Thirteen contour values
+# ranging from (0,1.2) inclusive are produced.
+contours = Vtk::ContourFilter.new
+contours.SetInputConnection(extract.GetOutputPort)
+contours.GenerateValues(13, 0.0, 1.2)
+
+# The contour lines are mapped to the graphics library.
+contMapper = Vtk::PolyDataMapper.new
+contMapper.SetInputConnection(contours.GetOutputPort)
+contMapper.SetScalarRange(0.0, 1.2)
+
+contActor = Vtk::Actor.new
+contActor.SetMapper(contMapper)
+
+# Create outline an outline of the sampled data.
+outline = Vtk::OutlineFilter.new
+outline.SetInputConnection(sample.GetOutputPort)
+
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineActor.GetProperty.SetColor(0, 0, 0)
+
+# Create the renderer, render window, && interactor.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Set the background color to white. Associate the actors with the
+# renderer.
+ren.SetBackground(1, 1, 1)
+ren.AddActor(contActor)
+ren.AddActor(outlineActor)
+
+# Zoom in a little bit.
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.5)
+
+# Initialize && start the event loop.
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/ImageProcessing/Ruby/ImageInteractor.rb VTK/Examples/ImageProcessing/Ruby/ImageInteractor.rb
--- VTK_org/Examples/ImageProcessing/Ruby/ImageInteractor.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/ImageProcessing/Ruby/ImageInteractor.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,175 @@
+#!/usr/bin/env ruby
+
+# This example shows how to use the InteractorStyleImage && add your
+# own event handling.  The InteractorStyleImage is a special
+# interactor designed to be used with vtkImageActor in a rendering
+# window context. It forces the camera to stay perpendicular to the
+# x-y plane.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create the image
+reader = Vtk::PNGReader.new
+reader.SetDataSpacing(0.8, 0.8, 1.5)
+reader.SetFileName(VTK_DATA_ROOT + "/Data/fullhead15.png")
+
+shiftScale = Vtk::ImageShiftScale.new
+shiftScale.SetInputConnection(reader.GetOutputPort)
+shiftScale.SetShift(0)
+shiftScale.SetScale(0.07)
+shiftScale.SetOutputScalarTypeToUnsignedChar
+
+ia = Vtk::ImageActor.new
+ia.SetInput(shiftScale.GetOutput)
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+iren.Initialize
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(ia)
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin.SetSize(400, 400)
+
+renWin.Render
+
+cam1 = ren.GetActiveCamera
+
+ren.ResetCameraClippingRange
+renWin.Render
+
+### Supporting data for callbacks
+pts = Vtk::Points.new
+pts.SetNumberOfPoints(4)
+lines = Vtk::CellArray.new
+lines.InsertNextCell(5)
+lines.InsertCellPoint(0)
+lines.InsertCellPoint(1)
+lines.InsertCellPoint(2)
+lines.InsertCellPoint(3)
+lines.InsertCellPoint(0)
+pd = Vtk::PolyData.new
+pd.SetPoints(pts)
+pd.SetLines(lines)
+bboxMapper = Vtk::PolyDataMapper2D.new
+bboxMapper.SetInput(pd)
+bboxActor = Vtk::Actor2D.new
+bboxActor.SetMapper(bboxMapper)
+bboxActor.GetProperty.SetColor(1, 0, 0)
+ren.AddViewProp(bboxActor)
+
+### Functions for callbacks 
+@x = 0
+@y = 0
+@bboxEnabled = 0
+
+StartZoom = Proc.new{|obj, event|
+    xy = iren.GetEventPosition
+    @x, @y = xy
+
+    pts.SetPoint(0, @x, @y, 0)
+    pts.SetPoint(1, @x, @y, 0)
+    pts.SetPoint(2, @x, @y, 0)
+    pts.SetPoint(3, @x, @y, 0)
+
+    @bboxEnabled = 1
+    bboxActor.VisibilityOn
+}
+
+
+MouseMove = Proc.new{|obj, event|
+    if @bboxEnabled
+        xy = iren.GetEventPosition
+        x, y = xy
+        pts.SetPoint(1, x, @y, 0)
+        pts.SetPoint(2, x, y, 0)
+        pts.SetPoint(3, @x, y, 0)
+        renWin.Render 
+    end
+}
+
+
+# Do the hard stuff: pan && dolly
+EndZoom = Proc.new{|obj, event|
+    p1 = pts.GetPoint(0)
+
+    p2 = pts.GetPoint(2)
+    x1, y1, z1 = p1
+    x2, y2, z2 = p2
+
+    ren.SetDisplayPoint(x1, y1, 0)
+    ren.DisplayToWorld
+    p1 = ren.GetWorldPoint
+    ren.SetDisplayPoint(x2, y2, 0)
+    ren.DisplayToWorld
+    p2 = ren.GetWorldPoint
+
+    p1X, p1Y, p1Z = p1[0..2]
+
+    p2X, p2Y, p2Z = p2[0..2]
+
+    camera = ren.GetActiveCamera
+    focalPt = camera.GetFocalPoint
+    focalX, focalY, focalZ = focalPt
+
+    position = camera.GetPosition
+    positionX, positionY, positionZ = position
+
+    deltaX = focalX-(p1X+p2X)/2.0
+    deltaY = focalY-(p1Y+p2Y)/2.0
+
+    # Set camera focal point to the center of the box
+    camera.SetFocalPoint((p1X+p2X)/2.0, (p1Y+p2Y)/2.0, focalZ)
+    camera.SetPosition(positionX-deltaX, positionY-deltaY,positionZ)
+
+    # Now dolly the camera to fill the box
+    # This is a half-assed hack for demonstration purposes
+    if p1X > p2X
+        deltaX = p1X-p2X
+    else
+        deltaX = p2X-p1X
+    end
+    if p1Y > p2Y
+        deltaY = p1Y-p2Y
+    else
+       deltaY = p2Y-p1Y
+    end
+
+    winSize = renWin.GetSize
+    winX, winY = winSize
+
+    sx = deltaX/winX
+    sy = deltaY/winY
+
+
+    if sx > sy
+        dolly = 1.0+1.0/(2.0*sx)
+    else
+        dolly = 1.0+1.0/(2.0*sy)
+    end
+
+    camera.Dolly(dolly)
+    ren.ResetCameraClippingRange
+
+    @bboxEnabled = 0
+    bboxActor.VisibilityOff
+    renWin.Render
+}
+
+# Create an image interactor style && associate it with the
+# interactive renderer. Then assign some callbacks with the
+# appropriate events. THe callbacks are implemented as Python functions.
+interactor = Vtk::InteractorStyleImage.new
+iren.SetInteractorStyle(interactor)
+interactor.AddObserver("LeftButtonPressEvent", StartZoom)
+interactor.AddObserver("MouseMoveEvent", MouseMove)
+interactor.AddObserver("LeftButtonReleaseEvent", EndZoom)
+
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/IO/Ruby/flamingo.rb VTK/Examples/IO/Ruby/flamingo.rb
--- VTK_org/Examples/IO/Ruby/flamingo.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/IO/Ruby/flamingo.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of vtk3DSImporter.
+# vtk3DSImporter is used to load 3D Studio files.  Unlike writers,
+# importers can load scenes (data as well as lights, cameras, actors
+# etc.). Importers will either generate an instance of vtkRenderWindow
+# and/or vtkRenderer || will use the ones you specify.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+
+# Create the importer && read a file
+importer = Vtk::3DSImporter.new
+importer.ComputeNormalsOn
+importer.SetFileName(VTK_DATA_ROOT + "/Data/iflamigm.3ds")
+importer.Read
+
+# Here we let the importer create a renderer && a render window for
+# us. We could have also create && assigned those ourselves like so:
+# renWin = Vtk::RenderWindow.new
+# importer.SetRenderWindow(renWin)
+
+# Assign an interactor.
+# We have to ask the importer for it's render window.
+renWin = importer.GetRenderWindow
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Set the render window's size
+renWin.SetSize(300, 300)
+
+# Set some properties on the renderer.
+# We have to ask the importer for it's renderer.
+ren = importer.GetRenderer
+ren.SetBackground(0.1, 0.2, 0.4)
+
+# Position the camera:
+# change view up to +z
+camera = ren.GetActiveCamera
+camera.SetPosition(0, 1, 0)
+camera.SetFocalPoint(0, 0, 0)
+camera.SetViewUp(0, 0, 1)
+# let the renderer compute good position && focal point
+ren.ResetCamera
+camera.Dolly(1.4)
+ren.ResetCameraClippingRange
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/IO/Ruby/stl.rb VTK/Examples/IO/Ruby/stl.rb
--- VTK_org/Examples/IO/Ruby/stl.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/IO/Ruby/stl.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,42 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of vtkSTLReader to load data into
+# VTK from a file.  This example also uses vtkLODActor which changes
+# its graphical representation of the data to maintain interactive
+# performance.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create the reader && read a data file.  Connect the mapper &&
+# actor.
+sr = Vtk::STLReader.new
+sr.SetFileName(VTK_DATA_ROOT + "/Data/42400-IDGH.stl")
+
+stlMapper = Vtk::PolyDataMapper.new
+stlMapper.SetInputConnection(sr.GetOutputPort)
+
+stlActor = Vtk::LODActor.new
+stlActor.SetMapper(stlMapper)
+
+# Create the Renderer, RenderWindow, && RenderWindowInteractor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the render; set the background && size
+ren.AddActor(stlActor)
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin.SetSize(500, 500)
+
+# Zoom in closer
+ren.ResetCamera
+cam1 = ren.GetActiveCamera
+cam1.Zoom(1.4)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Medical/Ruby/Medical1.rb VTK/Examples/Medical/Ruby/Medical1.rb
--- VTK_org/Examples/Medical/Ruby/Medical1.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Medical/Ruby/Medical1.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,93 @@
+#!/usr/bin/env ruby
+
+# This example reads a volume dataset, extracts an isosurface that
+# represents the skin && displays it.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create the renderer, the render window, && the interactor. The
+# renderer draws into the render window, the interactor enables mouse-
+# && keyboard-based interaction with the scene.
+aRenderer = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(aRenderer)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# The following reader is used to read a series of 2D slices (images)
+# that compose the volume. The slice dimensions are set, && the
+# pixel spacing. The data Endianness must also be specified. The reader
+# usese the FilePrefix in combination with the slice number to construct
+# filenames using the format FilePrefix.%d. (In this case the FilePrefix
+# is the root name of the file: quarter.)
+v16 = Vtk::Volume16Reader.new
+v16.SetDataDimensions(64, 64)
+v16.SetDataByteOrderToLittleEndian
+v16.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
+v16.SetImageRange(1, 93)
+v16.SetDataSpacing(3.2, 3.2, 1.5)
+
+# An isosurface, || contour value of 500 is known to correspond to the
+# skin of the patient. Once generated, a vtkPolyDataNormals filter is
+# is used to create normals for smooth surface shading during rendering.
+# The triangle stripper is used to create triangle strips from the
+# isosurface these render much faster on may systems.
+skinExtractor = Vtk::ContourFilter.new
+skinExtractor.SetInputConnection(v16.GetOutputPort)
+skinExtractor.SetValue(0, 500)
+skinNormals = Vtk::PolyDataNormals.new
+skinNormals.SetInputConnection(skinExtractor.GetOutputPort)
+skinNormals.SetFeatureAngle(60.0)
+skinMapper = Vtk::PolyDataMapper.new
+skinMapper.SetInputConnection(skinNormals.GetOutputPort)
+skinMapper.ScalarVisibilityOff
+skin = Vtk::Actor.new
+skin.SetMapper(skinMapper)
+
+# An outline provides context around the data.
+outlineData = Vtk::OutlineFilter.new
+outlineData.SetInputConnection(v16.GetOutputPort)
+mapOutline = Vtk::PolyDataMapper.new
+mapOutline.SetInputConnection(outlineData.GetOutputPort)
+outline = Vtk::Actor.new
+outline.SetMapper(mapOutline)
+outline.GetProperty.SetColor(0, 0, 0)
+
+# It is convenient to create an initial view of the data. The FocalPoint
+# && Position form a vector direction. Later on (ResetCamera method)
+# this vector is used to position the camera to look at the data in
+# this direction.
+aCamera = Vtk::Camera.new
+aCamera.SetViewUp(0, 0, -1)
+aCamera.SetPosition(0, 1, 0)
+aCamera.SetFocalPoint(0, 0, 0)
+aCamera.ComputeViewPlaneNormal
+
+# Actors are added to the renderer. An initial camera view is created.
+# The Dolly method moves the camera towards the FocalPoint,
+# thereby enlarging the image.
+aRenderer.AddActor(outline)
+aRenderer.AddActor(skin)
+aRenderer.SetActiveCamera(aCamera)
+aRenderer.ResetCamera
+aCamera.Dolly(1.5)
+
+# Set a background color for the renderer && set the size of the
+# render window (expressed in pixels).
+aRenderer.SetBackground(1, 1, 1)
+renWin.SetSize(640, 480)
+
+# Note that when camera movement occurs (as it does in the Dolly
+# method), the clipping planes often need adjusting. Clipping planes
+# consist of two planes: near && far along the view direction. The
+# near plane clips out objects in front of the plane the far plane
+# clips out objects behind the plane. This way only what is drawn
+# between the planes is actually rendered.
+aRenderer.ResetCameraClippingRange
+
+# Interact with the data.
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Medical/Ruby/Medical2.rb VTK/Examples/Medical/Ruby/Medical2.rb
--- VTK_org/Examples/Medical/Ruby/Medical2.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Medical/Ruby/Medical2.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,119 @@
+#!/usr/bin/env ruby
+
+# This example reads a volume dataset, extracts two isosurfaces that
+# represent the skin && bone, && then displays them.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create the renderer, the render window, && the interactor. The
+# renderer draws into the render window, the interactor enables mouse-
+# && keyboard-based interaction with the scene.
+aRenderer = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(aRenderer)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# The following reader is used to read a series of 2D slices (images)
+# that compose the volume. The slice dimensions are set, && the
+# pixel spacing. The data Endianness must also be specified. The reader
+# usese the FilePrefix in combination with the slice number to construct
+# filenames using the format FilePrefix.%d. (In this case the FilePrefix
+# is the root name of the file: quarter.)
+v16 = Vtk::Volume16Reader.new
+v16.SetDataDimensions(64, 64)
+v16.SetDataByteOrderToLittleEndian
+v16.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
+v16.SetImageRange(1, 93)
+v16.SetDataSpacing(3.2, 3.2, 1.5)
+
+# An isosurface, || contour value of 500 is known to correspond to the
+# skin of the patient. Once generated, a vtkPolyDataNormals filter is
+# is used to create normals for smooth surface shading during rendering.
+# The triangle stripper is used to create triangle strips from the
+# isosurface these render much faster on may systems.
+skinExtractor = Vtk::ContourFilter.new
+skinExtractor.SetInputConnection(v16.GetOutputPort)
+skinExtractor.SetValue(0, 500)
+skinNormals = Vtk::PolyDataNormals.new
+skinNormals.SetInputConnection(skinExtractor.GetOutputPort)
+skinNormals.SetFeatureAngle(60.0)
+skinStripper = Vtk::Stripper.new
+skinStripper.SetInputConnection(skinNormals.GetOutputPort)
+skinMapper = Vtk::PolyDataMapper.new
+skinMapper.SetInputConnection(skinStripper.GetOutputPort)
+skinMapper.ScalarVisibilityOff
+skin = Vtk::Actor.new
+skin.SetMapper(skinMapper)
+skin.GetProperty.SetDiffuseColor(1, 0.49, 0.25)
+skin.GetProperty.SetSpecular(0.3)
+skin.GetProperty.SetSpecularPower(20)
+
+# An isosurface, || contour value of 1150 is known to correspond to the
+# skin of the patient. Once generated, a vtkPolyDataNormals filter is
+# is used to create normals for smooth surface shading during rendering.
+# The triangle stripper is used to create triangle strips from the
+# isosurface these render much faster on may systems.
+boneExtractor = Vtk::ContourFilter.new
+boneExtractor.SetInputConnection(v16.GetOutputPort)
+boneExtractor.SetValue(0, 1150)
+boneNormals = Vtk::PolyDataNormals.new
+boneNormals.SetInputConnection(boneExtractor.GetOutputPort)
+boneNormals.SetFeatureAngle(60.0)
+boneStripper = Vtk::Stripper.new
+boneStripper.SetInputConnection(boneNormals.GetOutputPort)
+boneMapper = Vtk::PolyDataMapper.new
+boneMapper.SetInputConnection(boneStripper.GetOutputPort)
+boneMapper.ScalarVisibilityOff
+bone = Vtk::Actor.new
+bone.SetMapper(boneMapper)
+bone.GetProperty.SetDiffuseColor(1, 1, 0.9412)
+
+# An outline provides context around the data.
+outlineData = Vtk::OutlineFilter.new
+outlineData.SetInputConnection(v16.GetOutputPort)
+mapOutline = Vtk::PolyDataMapper.new
+mapOutline.SetInputConnection(outlineData.GetOutputPort)
+outline = Vtk::Actor.new
+outline.SetMapper(mapOutline)
+outline.GetProperty.SetColor(0, 0, 0)
+
+# It is convenient to create an initial view of the data. The FocalPoint
+# && Position form a vector direction. Later on (ResetCamera method)
+# this vector is used to position the camera to look at the data in
+# this direction.
+aCamera = Vtk::Camera.new
+aCamera.SetViewUp(0, 0, -1)
+aCamera.SetPosition(0, 1, 0)
+aCamera.SetFocalPoint(0, 0, 0)
+aCamera.ComputeViewPlaneNormal
+
+# Actors are added to the renderer. An initial camera view is created.
+# The Dolly method moves the camera towards the FocalPoint,
+# thereby enlarging the image.
+aRenderer.AddActor(outline)
+aRenderer.AddActor(skin)
+aRenderer.AddActor(bone)
+aRenderer.SetActiveCamera(aCamera)
+aRenderer.ResetCamera
+aCamera.Dolly(1.5)
+
+# Set a background color for the renderer && set the size of the
+# render window (expressed in pixels).
+aRenderer.SetBackground(1, 1, 1)
+renWin.SetSize(640, 480)
+
+# Note that when camera movement occurs (as it does in the Dolly
+# method), the clipping planes often need adjusting. Clipping planes
+# consist of two planes: near && far along the view direction. The
+# near plane clips out objects in front of the plane the far plane
+# clips out objects behind the plane. This way only what is drawn
+# between the planes is actually rendered.
+aRenderer.ResetCameraClippingRange
+
+# Interact with the data.
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Medical/Ruby/Medical3.rb VTK/Examples/Medical/Ruby/Medical3.rb
--- VTK_org/Examples/Medical/Ruby/Medical3.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Medical/Ruby/Medical3.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,196 @@
+#!/usr/bin/env ruby
+
+# This example reads a volume dataset, extracts two isosurfaces that
+# represent the skin && bone, creates three orthogonal planes
+# (saggital, axial, coronal), && displays them.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create the renderer, the render window, && the interactor. The
+# renderer draws into the render window, the interactor enables mouse-
+# && keyboard-based interaction with the scene.
+aRenderer = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(aRenderer)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# The following reader is used to read a series of 2D slices (images)
+# that compose the volume. The slice dimensions are set, && the
+# pixel spacing. The data Endianness must also be specified. The reader
+# usese the FilePrefix in combination with the slice number to construct
+# filenames using the format FilePrefix.%d. (In this case the FilePrefix
+# is the root name of the file: quarter.)
+v16 = Vtk::Volume16Reader.new
+v16.SetDataDimensions(64, 64)
+v16.SetDataByteOrderToLittleEndian
+v16.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
+v16.SetImageRange(1, 93)
+v16.SetDataSpacing(3.2, 3.2, 1.5)
+
+# An isosurface, || contour value of 500 is known to correspond to the
+# skin of the patient. Once generated, a vtkPolyDataNormals filter is
+# is used to create normals for smooth surface shading during rendering.
+# The triangle stripper is used to create triangle strips from the
+# isosurface these render much faster on may systems.
+skinExtractor = Vtk::ContourFilter.new
+skinExtractor.SetInputConnection(v16.GetOutputPort)
+skinExtractor.SetValue(0, 500)
+skinNormals = Vtk::PolyDataNormals.new
+skinNormals.SetInputConnection(skinExtractor.GetOutputPort)
+skinNormals.SetFeatureAngle(60.0)
+skinStripper = Vtk::Stripper.new
+skinStripper.SetInputConnection(skinNormals.GetOutputPort)
+skinMapper = Vtk::PolyDataMapper.new
+skinMapper.SetInputConnection(skinStripper.GetOutputPort)
+skinMapper.ScalarVisibilityOff
+skin = Vtk::Actor.new
+skin.SetMapper(skinMapper)
+skin.GetProperty.SetDiffuseColor(1, 0.49, 0.25)
+skin.GetProperty.SetSpecular(0.3)
+skin.GetProperty.SetSpecularPower(20)
+
+# An isosurface, || contour value of 1150 is known to correspond to the
+# skin of the patient. Once generated, a vtkPolyDataNormals filter is
+# is used to create normals for smooth surface shading during rendering.
+# The triangle stripper is used to create triangle strips from the
+# isosurface these render much faster on may systems.
+boneExtractor = Vtk::ContourFilter.new
+boneExtractor.SetInputConnection(v16.GetOutputPort)
+boneExtractor.SetValue(0, 1150)
+boneNormals = Vtk::PolyDataNormals.new
+boneNormals.SetInputConnection(boneExtractor.GetOutputPort)
+boneNormals.SetFeatureAngle(60.0)
+boneStripper = Vtk::Stripper.new
+boneStripper.SetInputConnection(boneNormals.GetOutputPort)
+boneMapper = Vtk::PolyDataMapper.new
+boneMapper.SetInputConnection(boneStripper.GetOutputPort)
+boneMapper.ScalarVisibilityOff
+bone = Vtk::Actor.new
+bone.SetMapper(boneMapper)
+bone.GetProperty.SetDiffuseColor(1, 1, 0.9412)
+
+# An outline provides context around the data.
+outlineData = Vtk::OutlineFilter.new
+outlineData.SetInputConnection(v16.GetOutputPort)
+mapOutline = Vtk::PolyDataMapper.new
+mapOutline.SetInputConnection(outlineData.GetOutputPort)
+outline = Vtk::Actor.new
+outline.SetMapper(mapOutline)
+outline.GetProperty.SetColor(0, 0, 0)
+
+# Now we are creating three orthogonal planes passing through the
+# volume. Each plane uses a different texture map && therefore has
+# diferent coloration.
+
+# Start by creatin a black/white lookup table.
+bwLut = Vtk::LookupTable.new
+bwLut.SetTableRange(0, 2000)
+bwLut.SetSaturationRange(0, 0)
+bwLut.SetHueRange(0, 0)
+bwLut.SetValueRange(0, 1)
+bwLut.Build
+
+# Now create a lookup table that consists of the full hue circle (from
+# HSV).
+hueLut = Vtk::LookupTable.new
+hueLut.SetTableRange(0, 2000)
+hueLut.SetHueRange(0, 1)
+hueLut.SetSaturationRange(1, 1)
+hueLut.SetValueRange(1, 1)
+hueLut.Build
+
+# Finally, create a lookup table with a single hue but having a range
+# in the saturation of the hue.
+satLut = Vtk::LookupTable.new
+satLut.SetTableRange(0, 2000)
+satLut.SetHueRange(0.6, 0.6)
+satLut.SetSaturationRange(0, 1)
+satLut.SetValueRange(1, 1)
+satLut.Build
+
+# Create the first of the three planes. The filter vtkImageMapToColors
+# maps the data through the corresponding lookup table created above.
+# The vtkImageActor is a type of vtkProp && conveniently displays an
+# image on a single quadrilateral plane. It does this using texture
+# mapping && as a result is quite fast. (Note: the input image has to
+# be unsigned char values, which the vtkImageMapToColors produces.)
+# Note also that by specifying the DisplayExtent, the pipeline
+# requests data of this extent && the vtkImageMapToColors only
+# processes a slice of data.
+saggitalColors = Vtk::ImageMapToColors.new
+saggitalColors.SetInputConnection(v16.GetOutputPort)
+saggitalColors.SetLookupTable(bwLut)
+saggital = Vtk::ImageActor.new
+saggital.SetInput(saggitalColors.GetOutput)
+saggital.SetDisplayExtent(32, 32, 0, 63, 0, 92)
+
+# Create the second (axial) plane of the three planes. We use the same
+# approach as before except that the extent differs.
+axialColors = Vtk::ImageMapToColors.new
+axialColors.SetInputConnection(v16.GetOutputPort)
+axialColors.SetLookupTable(hueLut)
+axial = Vtk::ImageActor.new
+axial.SetInput(axialColors.GetOutput)
+axial.SetDisplayExtent(0, 63, 0, 63, 46, 46)
+
+# Create the third (coronal) plane of the three planes. We use the same
+# approach as before except that the extent differs.
+coronalColors = Vtk::ImageMapToColors.new
+coronalColors.SetInputConnection(v16.GetOutputPort)
+coronalColors.SetLookupTable(satLut)
+coronal = Vtk::ImageActor.new
+coronal.SetInput(coronalColors.GetOutput)
+coronal.SetDisplayExtent(0, 63, 32, 32, 0, 92)
+
+# It is convenient to create an initial view of the data. The FocalPoint
+# && Position form a vector direction. Later on (ResetCamera method)
+# this vector is used to position the camera to look at the data in
+# this direction.
+aCamera = Vtk::Camera.new
+aCamera.SetViewUp(0, 0, -1)
+aCamera.SetPosition(0, 1, 0)
+aCamera.SetFocalPoint(0, 0, 0)
+aCamera.ComputeViewPlaneNormal
+
+# Actors are added to the renderer.
+aRenderer.AddActor(outline)
+aRenderer.AddActor(saggital)
+aRenderer.AddActor(axial)
+aRenderer.AddActor(coronal)
+#aRenderer.AddActor(axial)
+#aRenderer.AddActor(coronal)
+aRenderer.AddActor(skin)
+aRenderer.AddActor(bone)
+
+# Turn off bone for this example.
+bone.VisibilityOff
+
+# Set skin to semi-transparent.
+skin.GetProperty.SetOpacity(0.5)
+
+# An initial camera view is created.  The Dolly method moves
+# the camera towards the FocalPoint, thereby enlarging the image.
+aRenderer.SetActiveCamera(aCamera)
+aRenderer.ResetCamera
+aCamera.Dolly(1.5)
+
+# Set a background color for the renderer && set the size of the
+# render window (expressed in pixels).
+aRenderer.SetBackground(1, 1, 1)
+renWin.SetSize(640, 480)
+
+# Note that when camera movement occurs (as it does in the Dolly
+# method), the clipping planes often need adjusting. Clipping planes
+# consist of two planes: near && far along the view direction. The
+# near plane clips out objects in front of the plane the far plane
+# clips out objects behind the plane. This way only what is drawn
+# between the planes is actually rendered.
+aRenderer.ResetCameraClippingRange
+
+# Interact with the data.
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/constrainedDelaunay.rb VTK/Examples/Modelling/Ruby/constrainedDelaunay.rb
--- VTK_org/Examples/Modelling/Ruby/constrainedDelaunay.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/constrainedDelaunay.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,150 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use a constraint polygon in
+# Delaunay triangulation.
+
+require 'vtk'
+require 'vtk/util'
+
+# Generate the input points and constrained edges/polygons.
+points = Vtk::Points.new
+points.InsertPoint(0, 1, 4, 0)
+points.InsertPoint(1, 3, 4, 0)
+points.InsertPoint(2, 7, 4, 0)
+points.InsertPoint(3, 11, 4, 0)
+points.InsertPoint(4, 13, 4, 0)
+points.InsertPoint(5, 13, 8, 0)
+points.InsertPoint(6, 13, 12, 0)
+points.InsertPoint(7, 10, 12, 0)
+points.InsertPoint(8, 7, 12, 0)
+points.InsertPoint(9, 4, 12, 0)
+points.InsertPoint(10, 1, 12, 0)
+points.InsertPoint(11, 1, 8, 0)
+points.InsertPoint(12, 3.5, 5, 0)
+points.InsertPoint(13, 4.5, 5, 0)
+points.InsertPoint(14, 5.5, 8, 0)
+points.InsertPoint(15, 6.5, 8, 0)
+points.InsertPoint(16, 6.5, 5, 0)
+points.InsertPoint(17, 7.5, 5, 0)
+points.InsertPoint(18, 7.5, 8, 0)
+points.InsertPoint(19, 9, 8, 0)
+points.InsertPoint(20, 9, 5, 0)
+points.InsertPoint(21, 10, 5, 0)
+points.InsertPoint(22, 10, 7, 0)
+points.InsertPoint(23, 11, 5, 0)
+points.InsertPoint(24, 12, 5, 0)
+points.InsertPoint(25, 10.5, 8, 0)
+points.InsertPoint(26, 12, 11, 0)
+points.InsertPoint(27, 11, 11, 0)
+points.InsertPoint(28, 10, 9, 0)
+points.InsertPoint(29, 10, 11, 0)
+points.InsertPoint(30, 9, 11, 0)
+points.InsertPoint(31, 9, 9, 0)
+points.InsertPoint(32, 7.5, 9, 0)
+points.InsertPoint(33, 7.5, 11, 0)
+points.InsertPoint(34, 6.5, 11, 0)
+points.InsertPoint(35, 6.5, 9, 0)
+points.InsertPoint(36, 5, 9, 0)
+points.InsertPoint(37, 4, 6, 0)
+points.InsertPoint(38, 3, 9, 0)
+points.InsertPoint(39, 2, 9, 0)
+polys = Vtk::CellArray.new
+polys.InsertNextCell(12)
+polys.InsertCellPoint(0)
+polys.InsertCellPoint(1)
+polys.InsertCellPoint(2)
+polys.InsertCellPoint(3)
+polys.InsertCellPoint(4)
+polys.InsertCellPoint(5)
+polys.InsertCellPoint(6)
+polys.InsertCellPoint(7)
+polys.InsertCellPoint(8)
+polys.InsertCellPoint(9)
+polys.InsertCellPoint(10)
+polys.InsertCellPoint(11)
+polys.InsertNextCell(28)
+polys.InsertCellPoint(39)
+polys.InsertCellPoint(38)
+polys.InsertCellPoint(37)
+polys.InsertCellPoint(36)
+polys.InsertCellPoint(35)
+polys.InsertCellPoint(34)
+polys.InsertCellPoint(33)
+polys.InsertCellPoint(32)
+polys.InsertCellPoint(31)
+polys.InsertCellPoint(30)
+polys.InsertCellPoint(29)
+polys.InsertCellPoint(28)
+polys.InsertCellPoint(27)
+polys.InsertCellPoint(26)
+polys.InsertCellPoint(25)
+polys.InsertCellPoint(24)
+polys.InsertCellPoint(23)
+polys.InsertCellPoint(22)
+polys.InsertCellPoint(21)
+polys.InsertCellPoint(20)
+polys.InsertCellPoint(19)
+polys.InsertCellPoint(18)
+polys.InsertCellPoint(17)
+polys.InsertCellPoint(16)
+polys.InsertCellPoint(15)
+polys.InsertCellPoint(14)
+polys.InsertCellPoint(13)
+polys.InsertCellPoint(12)
+
+polyData = Vtk::PolyData.new
+polyData.SetPoints(points)
+polyData.SetPolys(polys)
+
+# Notice this trick. The SetInput method accepts a vtkPolyData that
+# is also the input to the Delaunay filter. The points of the
+# vtkPolyData are used to generate the triangulation; the polygons are
+# used to create a constraint region. The polygons are very carefully
+# created and ordered in the right direction to indicate inside and
+# outside of the polygon.
+delny = Vtk::Delaunay2D.new
+delny.SetInput(polyData)
+delny.SetSource(polyData)
+mapMesh = Vtk::PolyDataMapper.new
+mapMesh.SetInputConnection(delny.GetOutputPort)
+meshActor = Vtk::Actor.new
+meshActor.SetMapper(mapMesh)
+
+# Now we just pretty the mesh up with tubed edges and balls at the
+# vertices.
+extract = Vtk::ExtractEdges.new
+extract.SetInputConnection(delny.GetOutputPort)
+tubes = Vtk::TubeFilter.new
+tubes.SetInputConnection(extract.GetOutputPort)
+tubes.SetRadius(0.1)
+tubes.SetNumberOfSides(6)
+mapEdges = Vtk::PolyDataMapper.new
+mapEdges.SetInputConnection(tubes.GetOutputPort)
+edgeActor = Vtk::Actor.new
+edgeActor.SetMapper(mapEdges)
+edgeActor.GetProperty.SetColor(Vtk::Colors::Peacock)
+edgeActor.GetProperty.SetSpecularColor(1, 1, 1)
+edgeActor.GetProperty.SetSpecular(0.3)
+edgeActor.GetProperty.SetSpecularPower(20)
+edgeActor.GetProperty.SetAmbient(0.2)
+edgeActor.GetProperty.SetDiffuse(0.8)
+
+# Create the rendering window, renderer, and interactive renderer
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(meshActor)
+ren.AddActor(edgeActor)
+ren.SetBackground(0, 0, 0)
+renWin.SetSize(450, 300)
+
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(2)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/Delaunay3D.rb VTK/Examples/Modelling/Ruby/Delaunay3D.rb
--- VTK_org/Examples/Modelling/Ruby/Delaunay3D.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/Delaunay3D.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,61 @@
+#!/usr/bin/env ruby
+
+# This example shows how to use Delaunay3D with alpha shapes.
+
+require 'vtk'
+
+# The points to be triangulated are generated randomly in the unit
+# cube located at the origin. The points are then associated with a
+# vtkPolyData.
+math = Vtk::Math
+points = Vtk::Points.new
+for i in 0...25
+    points.InsertPoint(i, math.Random(0, 1), math.Random(0, 1),
+                       math.Random(0, 1))
+end
+
+profile = Vtk::PolyData.new
+profile.SetPoints(points)
+
+# Delaunay3D is used to triangulate the points. The Tolerance is the
+# distance that nearly coincident points are merged
+# together. (Delaunay does better if points are well spaced.) The
+# alpha value is the radius of circumcircles, circumspheres. Any mesh
+# entity whose circumcircle is smaller than this value is output.
+delny = Vtk::Delaunay3D.new
+delny.SetInput(profile)
+delny.SetTolerance(0.01)
+delny.SetAlpha(0.2)
+delny.BoundingTriangulationOff
+
+# Shrink the result to help see it better.
+shrink = Vtk::ShrinkFilter.new
+shrink.SetInputConnection(delny.GetOutputPort)
+shrink.SetShrinkFactor(0.9)
+
+map = Vtk::DataSetMapper.new
+map.SetInputConnection(shrink.GetOutputPort)
+
+triangulation = Vtk::Actor.new
+triangulation.SetMapper(map)
+triangulation.GetProperty.SetColor(1, 0, 0)
+
+# Create graphics stuff
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(triangulation)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(250, 250)
+renWin.Render
+
+cam1 = ren.GetActiveCamera
+cam1.Zoom(1.5)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/DelMesh.rb VTK/Examples/Modelling/Ruby/DelMesh.rb
--- VTK_org/Examples/Modelling/Ruby/DelMesh.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/DelMesh.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,87 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use 2D Delaunay triangulation.
+# We create a fancy image of a 2D Delaunay triangulation. Points are
+# randomly generated.
+
+require 'vtk'
+require 'vtk/util'
+
+# Generate some random points
+math = Vtk::Math
+points = Vtk::Points.new
+for i in 0...50
+    points.InsertPoint(i, math.Random(0, 1), math.Random(0, 1), 0.0)
+end
+
+# Create a polydata with the points we just created.
+profile = Vtk::PolyData.new
+profile.SetPoints(points)
+
+# Perform a 2D Delaunay triangulation on them.
+delny = Vtk::Delaunay2D.new
+delny.SetInput(profile)
+delny.SetTolerance(0.001)
+mapMesh = Vtk::PolyDataMapper.new
+mapMesh.SetInputConnection(delny.GetOutputPort)
+meshActor = Vtk::Actor.new
+meshActor.SetMapper(mapMesh)
+meshActor.GetProperty.SetColor(0.1, 0.2, 0.4)
+
+# We will now create a nice looking mesh by wrapping the edges in tubes,
+# and putting fat spheres at the points.
+extract = Vtk::ExtractEdges.new
+extract.SetInputConnection(delny.GetOutputPort)
+tubes = Vtk::TubeFilter.new
+tubes.SetInputConnection(extract.GetOutputPort)
+tubes.SetRadius(0.01)
+tubes.SetNumberOfSides(6)
+mapEdges = Vtk::PolyDataMapper.new
+mapEdges.SetInputConnection(tubes.GetOutputPort)
+edgeActor = Vtk::Actor.new
+edgeActor.SetMapper(mapEdges)
+edgeActor.GetProperty.SetColor(Vtk::Colors::Peacock)
+edgeActor.GetProperty.SetSpecularColor(1, 1, 1)
+edgeActor.GetProperty.SetSpecular(0.3)
+edgeActor.GetProperty.SetSpecularPower(20)
+edgeActor.GetProperty.SetAmbient(0.2)
+edgeActor.GetProperty.SetDiffuse(0.8)
+
+ball = Vtk::SphereSource.new
+ball.SetRadius(0.025)
+ball.SetThetaResolution(12)
+ball.SetPhiResolution(12)
+balls = Vtk::Glyph3D.new
+balls.SetInputConnection(delny.GetOutputPort)
+balls.SetSourceConnection(ball.GetOutputPort)
+mapBalls = Vtk::PolyDataMapper.new
+mapBalls.SetInputConnection(balls.GetOutputPort)
+ballActor = Vtk::Actor.new
+ballActor.SetMapper(mapBalls)
+ballActor.GetProperty.SetColor(Vtk::Colors::Hot_pink)
+ballActor.GetProperty.SetSpecularColor(1, 1, 1)
+ballActor.GetProperty.SetSpecular(0.3)
+ballActor.GetProperty.SetSpecularPower(20)
+ballActor.GetProperty.SetAmbient(0.2)
+ballActor.GetProperty.SetDiffuse(0.8)
+
+# Create the rendering window, renderer, and interactive renderer
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(ballActor)
+ren.AddActor(edgeActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(150, 150)
+
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.5)
+
+# Interact with the data.
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/expCos.rb VTK/Examples/Modelling/Ruby/expCos.rb
--- VTK_org/Examples/Modelling/Ruby/expCos.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/expCos.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,84 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use a programmable filter && how
+# to use the special vtkDataSetToDataSet::GetOutput methods
+
+require 'vtk'
+
+include Math
+
+# We create a 100 by 100 point plane to sample
+plane = Vtk::PlaneSource.new
+plane.SetXResolution(100)
+plane.SetYResolution(100)
+
+# We transform the plane by a factor of 10 on X && Y
+transform = Vtk::Transform.new
+transform.Scale(10, 10, 1)
+transF = Vtk::TransformPolyDataFilter.new
+transF.SetInputConnection(plane.GetOutputPort)
+transF.SetTransform(transform)
+
+# Compute Bessel function && derivatives. We'll use a programmable filter
+# for this. Note the unusual GetInput & GetOutput methods.
+besselF = Vtk::ProgrammableFilter.new
+besselF.SetInputConnection(transF.GetOutputPort)
+
+# The SetExecuteMethod takes a Python function as an argument
+# In here is where all the processing is done.
+bessel = Proc.new{
+    input = besselF.GetPolyDataInput
+    numPts = input.GetNumberOfPoints
+    newPts = Vtk::Points.new
+    derivs = Vtk::FloatArray.new
+
+    for i in 0...numPts
+        x = input.GetPoint(i)
+        x0, x1 = x[0..1]
+
+        r = sqrt(x0*x0+x1*x1)
+        x2 = exp(-r)*cos(10.0*r)
+        deriv = -exp(-r)*(cos(10.0*r)+10.0*sin(10.0*r))
+
+        newPts.InsertPoint(i, x0, x1, x2)
+        derivs.InsertValue(i, deriv) 
+    end
+
+    besselF.GetPolyDataOutput.CopyStructure(input)
+    besselF.GetPolyDataOutput.SetPoints(newPts)
+    besselF.GetPolyDataOutput.GetPointData.SetScalars(derivs)
+}
+
+besselF.SetExecuteMethod(bessel) 
+
+# We warp the plane based on the scalar values calculated above
+warp = Vtk::WarpScalar.new
+warp.SetInput(besselF.GetPolyDataOutput)
+warp.XYPlaneOn
+warp.SetScaleFactor(0.5)
+
+
+# We create a mapper && actor as usual. In the case we adjust the
+# scalar range of the mapper to match that of the computed scalars
+mapper = Vtk::PolyDataMapper.new
+mapper.SetInput(warp.GetPolyDataOutput)
+mapper.SetScalarRange(besselF.GetPolyDataOutput.GetScalarRange)
+carpet = Vtk::Actor.new
+carpet.SetMapper(mapper)
+
+# Create the RenderWindow, Renderer
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+ren.AddActor(carpet)
+renWin.SetSize(500, 500)
+
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.5)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/faultLines.rb VTK/Examples/Modelling/Ruby/faultLines.rb
--- VTK_org/Examples/Modelling/Ruby/faultLines.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/faultLines.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,70 @@
+#!/usr/bin/env ruby
+
+# Create a constrained Delaunay triangulation following fault lines. The
+# fault lines serve as constraint edges in the Delaunay triangulation.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Generate some points by reading a VTK data file. The data file also
+# has edges that represent constraint lines. This is originally from a
+# geologic horizon.
+reader = Vtk::PolyDataReader.new
+reader.SetFileName(VTK_DATA_ROOT + "/Data/faults.vtk")
+
+# Perform a 2D triangulation with constraint edges.
+delny = Vtk::Delaunay2D.new
+delny.SetInputConnection(reader.GetOutputPort)
+delny.SetSourceConnection(reader.GetOutputPort)
+delny.SetTolerance(0.00001)
+normals = Vtk::PolyDataNormals.new
+normals.SetInputConnection(delny.GetOutputPort)
+mapMesh = Vtk::PolyDataMapper.new
+mapMesh.SetInputConnection(normals.GetOutputPort)
+meshActor = Vtk::Actor.new
+meshActor.SetMapper(mapMesh)
+meshActor.GetProperty.SetColor(Vtk::Colors::Beige)
+
+# Now pretty up the mesh with tubed edges and balls at the vertices.
+tuber = Vtk::TubeFilter.new
+tuber.SetInputConnection(reader.GetOutputPort)
+tuber.SetRadius(25)
+mapLines = Vtk::PolyDataMapper.new
+mapLines.SetInputConnection(tuber.GetOutputPort)
+linesActor = Vtk::Actor.new
+linesActor.SetMapper(mapLines)
+linesActor.GetProperty.SetColor(1, 0, 0)
+linesActor.GetProperty.SetColor(Vtk::Colors::Tomato)
+
+# Create graphics objects
+# Create the rendering window, renderer, and interactive renderer
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(linesActor)
+ren.AddActor(meshActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(350, 250)
+
+cam1 = Vtk::Camera.new
+cam1.SetClippingRange(2580, 129041)
+cam1.SetFocalPoint(461550, 6.58e+006, 2132)
+cam1.SetPosition(463960, 6.559e+06, 16982)
+cam1.SetViewUp(-0.321899, 0.522244, 0.78971)
+light = Vtk::Light.new
+light.SetPosition(0, 0, 1)
+light.SetFocalPoint(0, 0, 0)
+ren.SetActiveCamera(cam1)
+ren.AddLight(light)
+
+ren.GetActiveCamera.Zoom(1.5)
+iren.LightFollowCameraOff
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/hello.rb VTK/Examples/Modelling/Ruby/hello.rb
--- VTK_org/Examples/Modelling/Ruby/hello.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/hello.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,63 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use implicit modelling.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create lines which serve as the "seed" geometry. The lines spell the
+# word "hello".
+reader = Vtk::PolyDataReader.new
+reader.SetFileName(VTK_DATA_ROOT + "/Data/hello.vtk")
+lineMapper = Vtk::PolyDataMapper.new
+lineMapper.SetInputConnection(reader.GetOutputPort)
+lineActor = Vtk::Actor.new
+lineActor.SetMapper(lineMapper)
+lineActor.GetProperty.SetColor(Vtk::Colors::Red)
+
+# Create implicit model with vtkImplicitModeller. This computes a
+# scalar field which is the distance from the generating geometry. The
+# contour filter then extracts the geoemtry at the distance value 0.25
+# from the generating geometry.
+imp = Vtk::ImplicitModeller.new
+imp.SetInputConnection(reader.GetOutputPort)
+imp.SetSampleDimensions(110, 40, 20)
+imp.SetMaximumDistance(0.25)
+imp.SetModelBounds(-1.0, 10.0, -1.0, 3.0, -1.0, 1.0)
+contour = Vtk::ContourFilter.new
+contour.SetInputConnection(imp.GetOutputPort)
+contour.SetValue(0, 0.25)
+impMapper = Vtk::PolyDataMapper.new
+impMapper.SetInputConnection(contour.GetOutputPort)
+impMapper.ScalarVisibilityOff
+impActor = Vtk::Actor.new
+impActor.SetMapper(impMapper)
+impActor.GetProperty.SetColor(Vtk::Colors::Peacock)
+impActor.GetProperty.SetOpacity(0.5)
+
+# Create the usual graphics stuff.
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(lineActor)
+ren.AddActor(impActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(600, 250)
+
+camera = Vtk::Camera.new
+camera.SetClippingRange(1.81325, 90.6627)
+camera.SetFocalPoint(4.5, 1, 0)
+camera.SetPosition(4.5, 1.0, 6.73257)
+camera.SetViewUp(0, 1, 0)
+camera.Zoom(0.8)
+ren.SetActiveCamera(camera)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/iceCream.rb VTK/Examples/Modelling/Ruby/iceCream.rb
--- VTK_org/Examples/Modelling/Ruby/iceCream.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/iceCream.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,95 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to use boolean combinations of implicit
+# functions to create a model of an ice cream cone.
+
+require 'vtk'
+require 'vtk/util'
+
+# Create implicit function primitives. These have been carefully
+# placed to give the effect that we want. We are going to use various
+# combinations of these functions to create the shape we want; for
+# example, we use planes intersected with a cone (which is infinite in
+# extent) to get a finite cone.
+cone = Vtk::Cone.new
+cone.SetAngle(20)
+vertPlane = Vtk::Plane.new
+vertPlane.SetOrigin(0.1, 0, 0)
+vertPlane.SetNormal(-1, 0, 0)
+basePlane = Vtk::Plane.new
+basePlane.SetOrigin(1.2, 0, 0)
+basePlane.SetNormal(1, 0, 0)
+iceCream = Vtk::Sphere.new
+iceCream.SetCenter(1.333, 0, 0)
+iceCream.SetRadius(0.5)
+bite = Vtk::Sphere.new
+bite.SetCenter(1.5, 0, 0.5)
+bite.SetRadius(0.25)
+
+# Combine primitives to build ice-cream cone. Clip the cone with planes.
+theCone = Vtk::ImplicitBoolean.new
+theCone.SetOperationTypeToIntersection
+theCone.AddFunction(cone)
+theCone.AddFunction(vertPlane)
+theCone.AddFunction(basePlane)
+
+# Take a bite out of the ice cream.
+theCream = Vtk::ImplicitBoolean.new
+theCream.SetOperationTypeToDifference
+theCream.AddFunction(iceCream)
+theCream.AddFunction(bite)
+
+# The sample function generates a distance function from the implicit
+# function (which in this case is the cone). This is then contoured to
+# get a polygonal surface.
+theConeSample = Vtk::SampleFunction.new
+theConeSample.SetImplicitFunction(theCone)
+theConeSample.SetModelBounds(-1, 1.5, -1.25, 1.25, -1.25, 1.25)
+theConeSample.SetSampleDimensions(60, 60, 60)
+theConeSample.ComputeNormalsOff
+theConeSurface = Vtk::ContourFilter.new
+theConeSurface.SetInputConnection(theConeSample.GetOutputPort)
+theConeSurface.SetValue(0, 0.0)
+coneMapper = Vtk::PolyDataMapper.new
+coneMapper.SetInputConnection(theConeSurface.GetOutputPort)
+coneMapper.ScalarVisibilityOff
+coneActor = Vtk::Actor.new
+coneActor.SetMapper(coneMapper)
+coneActor.GetProperty.SetColor(Vtk::Colors::Chocolate)
+
+# The same here for the ice cream.
+theCreamSample = Vtk::SampleFunction.new
+theCreamSample.SetImplicitFunction(theCream)
+theCreamSample.SetModelBounds(0, 2.5, -1.25, 1.25, -1.25, 1.25)
+theCreamSample.SetSampleDimensions(60, 60, 60)
+theCreamSample.ComputeNormalsOff
+theCreamSurface = Vtk::ContourFilter.new
+theCreamSurface.SetInputConnection(theCreamSample.GetOutputPort)
+theCreamSurface.SetValue(0, 0.0)
+creamMapper = Vtk::PolyDataMapper.new
+creamMapper.SetInputConnection(theCreamSurface.GetOutputPort)
+creamMapper.ScalarVisibilityOff
+creamActor = Vtk::Actor.new
+creamActor.SetMapper(creamMapper)
+creamActor.GetProperty.SetColor(Vtk::Colors::Mint)
+
+# Create the usual rendering stuff
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(coneActor)
+ren.AddActor(creamActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(250, 250)
+ren.ResetCamera
+ren.GetActiveCamera.Roll(90)
+ren.GetActiveCamera.Dolly(1.5)
+ren.ResetCameraClippingRange
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/PerlinTerrain.rb VTK/Examples/Modelling/Ruby/PerlinTerrain.rb
--- VTK_org/Examples/Modelling/Ruby/PerlinTerrain.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/PerlinTerrain.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,67 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to combine a "geometric" implicit
+# function with noise at different frequencies to produce the
+# appearance of a landscape.
+
+require 'vtk'
+
+plane = Vtk::Plane.new
+
+p1 = Vtk::PerlinNoise.new
+p1.SetFrequency(1, 1, 0)
+
+p2 = Vtk::PerlinNoise.new
+p2.SetFrequency(3, 5, 0)
+p2.SetPhase(0.5, 0.5, 0)
+
+p3 = Vtk::PerlinNoise.new
+p3.SetFrequency(16, 16, 0)
+
+sum = Vtk::ImplicitSum.new
+sum.SetNormalizeByWeight(1)
+sum.AddFunction(plane)
+sum.AddFunction(p1, 0.2)
+sum.AddFunction(p2, 0.1)
+sum.AddFunction(p3, 0.02)
+
+sample = Vtk::SampleFunction.new
+sample.SetImplicitFunction(sum)
+sample.SetSampleDimensions(65, 65, 20)
+sample.SetModelBounds(-1, 1, -1, 1, -0.5, 0.5)
+sample.ComputeNormalsOff
+surface = Vtk::ContourFilter.new
+surface.SetInputConnection(sample.GetOutputPort)
+surface.SetValue(0, 0.0)
+
+smooth = Vtk::PolyDataNormals.new
+smooth.SetInputConnection(surface.GetOutputPort)
+smooth.SetFeatureAngle(90)
+
+mapper = Vtk::PolyDataMapper.new
+mapper.SetInputConnection(smooth.GetOutputPort)
+mapper.ScalarVisibilityOff
+actor = Vtk::Actor.new
+actor.SetMapper(mapper)
+actor.GetProperty.SetColor(0.4, 0.2, 0.1)
+
+# Create the renderer etc.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(actor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(500, 500)
+ren.ResetCamera
+ren.GetActiveCamera.Elevation(-45)
+ren.GetActiveCamera.Azimuth(10)
+ren.GetActiveCamera.Dolly(1.35)
+ren.ResetCameraClippingRange
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/procrustesAlignment.rb VTK/Examples/Modelling/Ruby/procrustesAlignment.rb
--- VTK_org/Examples/Modelling/Ruby/procrustesAlignment.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/procrustesAlignment.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,185 @@
+#!/usr/bin/env ruby
+
+# This example shows how to align a set of objects together using the
+# Procrustes algorithm.  We make three ellipsoids by distorting and
+# translating a sphere and then align them together, using the
+# different modes of Procrustes alignment: rigid-body, similarity and
+# affine.
+
+require 'vtk'
+
+sphere = Vtk::SphereSource.new
+
+# make two copies of the shape and distort them a little
+transform1 = Vtk::Transform.new
+transform1.Translate(0.2, 0.1, 0.3)
+transform1.Scale(1.3, 1.1, 0.8)
+
+transform2 = Vtk::Transform.new
+transform2.Translate(0.3, 0.7, 0.1)
+transform2.Scale(1.0, 0.1, 1.8)
+
+transformer1 = Vtk::TransformPolyDataFilter.new
+transformer1.SetInputConnection(sphere.GetOutputPort)
+transformer1.SetTransform(transform1)
+
+transformer2 = Vtk::TransformPolyDataFilter.new
+transformer2.SetInputConnection(sphere.GetOutputPort)
+transformer2.SetTransform(transform2)
+
+# map these three shapes into the first renderer
+map1a = Vtk::PolyDataMapper.new
+map1a.SetInputConnection(sphere.GetOutputPort)
+Actor1a = Vtk::Actor.new
+Actor1a.SetMapper(map1a)
+Actor1a.GetProperty.SetDiffuseColor(1.0000, 0.3882, 0.2784)
+
+map1b = Vtk::PolyDataMapper.new
+map1b.SetInputConnection(transformer1.GetOutputPort)
+Actor1b = Vtk::Actor.new
+Actor1b.SetMapper(map1b)
+Actor1b.GetProperty.SetDiffuseColor(0.3882, 1.0000, 0.2784)
+
+map1c = Vtk::PolyDataMapper.new
+map1c.SetInputConnection(transformer2.GetOutputPort)
+Actor1c = Vtk::Actor.new
+Actor1c.SetMapper(map1c)
+Actor1c.GetProperty.SetDiffuseColor(0.3882, 0.2784, 1.0000)
+
+# -- align the shapes using Procrustes (using SetModeToRigidBody) --
+procrustes1 = Vtk::ProcrustesAlignmentFilter.new
+procrustes1.SetNumberOfInputs(3)
+procrustes1.SetInputConnection(0, sphere.GetOutputPort)
+procrustes1.SetInputConnection(1, transformer1.GetOutputPort)
+procrustes1.SetInputConnection(2, transformer2.GetOutputPort)
+procrustes1.GetLandmarkTransform.SetModeToRigidBody
+
+# map the aligned shapes into the second renderer
+map2a = Vtk::PolyDataMapper.new
+map2a.SetInputConnection(procrustes1.GetOutputPort(0))
+Actor2a = Vtk::Actor.new
+Actor2a.SetMapper(map2a)
+Actor2a.GetProperty.SetDiffuseColor(1.0000, 0.3882, 0.2784)
+
+map2b = Vtk::PolyDataMapper.new
+map2b.SetInputConnection(procrustes1.GetOutputPort(1))
+Actor2b = Vtk::Actor.new
+Actor2b.SetMapper(map2b)
+Actor2b.GetProperty.SetDiffuseColor(0.3882, 1.0000, 0.2784)
+
+map2c = Vtk::PolyDataMapper.new
+map2c.SetInputConnection(procrustes1.GetOutputPort(2))
+Actor2c = Vtk::Actor.new
+Actor2c.SetMapper(map2c)
+Actor2c.GetProperty.SetDiffuseColor(0.3882, 0.2784, 1.0000)
+
+# -- align the shapes using Procrustes (using SetModeToSimilarity
+# (default)) --
+procrustes2 = Vtk::ProcrustesAlignmentFilter.new
+procrustes2.SetNumberOfInputs(3)
+procrustes2.SetInputConnection(0, sphere.GetOutputPort)
+procrustes2.SetInputConnection(1, transformer1.GetOutputPort)
+procrustes2.SetInputConnection(2, transformer2.GetOutputPort)
+
+# map the aligned shapes into the third renderer
+map3a = Vtk::PolyDataMapper.new
+map3a.SetInputConnection(procrustes2.GetOutputPort(0))
+Actor3a = Vtk::Actor.new
+Actor3a.SetMapper(map3a)
+Actor3a.GetProperty.SetDiffuseColor(1.0000, 0.3882, 0.2784)
+
+map3b = Vtk::PolyDataMapper.new
+map3b.SetInputConnection(procrustes2.GetOutputPort(1))
+Actor3b = Vtk::Actor.new
+Actor3b.SetMapper(map3b)
+Actor3b.GetProperty.SetDiffuseColor(0.3882, 1.0000, 0.2784)
+
+map3c = Vtk::PolyDataMapper.new
+map3c.SetInputConnection(procrustes2.GetOutputPort(2))
+Actor3c = Vtk::Actor.new
+Actor3c.SetMapper(map3c)
+Actor3c.GetProperty.SetDiffuseColor(0.3882, 0.2784, 1.0000)
+
+# -- align the shapes using Procrustes (using SetModeToAffine) --
+procrustes3 = Vtk::ProcrustesAlignmentFilter.new
+procrustes3.SetNumberOfInputs(3)
+procrustes3.SetInputConnection(0, sphere.GetOutputPort)
+procrustes3.SetInputConnection(1, transformer1.GetOutputPort)
+procrustes3.SetInputConnection(2, transformer2.GetOutputPort)
+procrustes3.GetLandmarkTransform.SetModeToAffine
+
+# map the aligned shapes into the fourth renderer
+map4a = Vtk::PolyDataMapper.new
+map4a.SetInputConnection(procrustes3.GetOutputPort(0))
+Actor4a = Vtk::Actor.new
+Actor4a.SetMapper(map4a)
+Actor4a.GetProperty.SetDiffuseColor(1.0000, 0.3882, 0.2784)
+
+map4b = Vtk::PolyDataMapper.new
+map4b.SetInputConnection(procrustes3.GetOutputPort(1))
+Actor4b = Vtk::Actor.new
+Actor4b.SetMapper(map4b)
+Actor4b.GetProperty.SetDiffuseColor(0.3882, 1.0000, 0.2784)
+
+map4c = Vtk::PolyDataMapper.new
+map4c.SetInputConnection(procrustes3.GetOutputPort(2))
+Actor4c = Vtk::Actor.new
+Actor4c.SetMapper(map4c)
+Actor4c.GetProperty.SetDiffuseColor(0.3882, 0.2784, 1.0000)
+
+# Create the RenderWindow and its four Renderers
+ren = Vtk::Renderer.new
+ren2 = Vtk::Renderer.new
+ren3 = Vtk::Renderer.new
+ren4 = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+renWin.AddRenderer(ren2)
+renWin.AddRenderer(ren3)
+renWin.AddRenderer(ren4)
+renWin.SetSize(400, 100)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer
+ren.AddActor(Actor1a)
+ren.AddActor(Actor1b)
+ren.AddActor(Actor1c)
+
+ren2.AddActor(Actor2a)
+ren2.AddActor(Actor2b)
+ren2.AddActor(Actor2c)
+
+ren3.AddActor(Actor3a)
+ren3.AddActor(Actor3b)
+ren3.AddActor(Actor3c)
+
+ren4.AddActor(Actor4a)
+ren4.AddActor(Actor4b)
+ren4.AddActor(Actor4c)
+
+# set the properties of the renderers
+ren.SetBackground(1, 1, 1)
+ren.SetViewport(0.0, 0.0, 0.25, 1.0)
+ren.GetActiveCamera.SetPosition(1, -1, 0)
+ren.ResetCamera
+
+ren2.SetBackground(1, 1, 1)
+ren2.SetViewport(0.25, 0.0, 0.5, 1.0)
+ren2.GetActiveCamera.SetPosition(1, -1, 0)
+ren2.ResetCamera
+
+ren3.SetBackground(1, 1, 1)
+ren3.SetViewport(0.5, 0.0, 0.75, 1.0)
+ren3.GetActiveCamera.SetPosition(1, -1, 0)
+ren3.ResetCamera
+
+ren4.SetBackground(1, 1, 1)
+ren4.SetViewport(0.75, 0.0, 1.0, 1.0)
+ren4.GetActiveCamera.SetPosition(1, -1, 0)
+ren4.ResetCamera
+
+# Render the image and start interaction.
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/reconstructSurface.rb VTK/Examples/Modelling/Ruby/reconstructSurface.rb
--- VTK_org/Examples/Modelling/Ruby/reconstructSurface.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/reconstructSurface.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,86 @@
+#!/usr/bin/env ruby
+
+# This example shows how to construct a surface from a point cloud.
+# First we generate a volume using the
+# vtkSurfaceReconstructionFilter. The volume values are a distance
+# field. Once this is generated, the volume is countoured at a
+# distance value of 0.0.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Read some points. Use a programmable filter to read them.
+pointSource = Vtk::ProgrammableSource.new
+
+readPoints = Proc.new{
+    output = pointSource.GetPolyDataOutput
+    points = Vtk::Points.new
+    output.SetPoints(points)
+
+    file = File.open(File.join(VTK_DATA_ROOT, "Data/cactus.3337.pts"))
+
+    line = file.gets
+    while line
+        data = line.split
+        if data && data[0] == 'p'
+            x, y, z = data[1].to_f, data[2].to_f, data[3].to_f
+            points.InsertNextPoint(x, y, z)
+        end
+        line = file.gets
+    end
+}
+
+pointSource.SetExecuteMethod(readPoints)
+
+
+# Construct the surface && create isosurface.
+surf = Vtk::SurfaceReconstructionFilter.new
+surf.SetInput(pointSource.GetPolyDataOutput)
+
+cf = Vtk::ContourFilter.new
+cf.SetInputConnection(surf.GetOutputPort)
+cf.SetValue(0, 0.0)
+
+# Sometimes the contouring algorithm can create a volume whose gradient
+# vector && ordering of polygon (using the right hand rule) are
+# inconsistent. vtkReverseSense cures this problem.
+reverse = Vtk::ReverseSense.new
+reverse.SetInputConnection(cf.GetOutputPort)
+reverse.ReverseCellsOn
+reverse.ReverseNormalsOn
+
+map = Vtk::PolyDataMapper.new
+map.SetInputConnection(reverse.GetOutputPort)
+map.ScalarVisibilityOff
+
+surfaceActor = Vtk::Actor.new
+surfaceActor.SetMapper(map)
+surfaceActor.GetProperty.SetDiffuseColor(1.0000, 0.3882, 0.2784)
+surfaceActor.GetProperty.SetSpecularColor(1, 1, 1)
+surfaceActor.GetProperty.SetSpecular(0.4)
+surfaceActor.GetProperty.SetSpecularPower(50)
+
+# Create the RenderWindow, Renderer && both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background && size
+ren.AddActor(surfaceActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(400, 400)
+ren.GetActiveCamera.SetFocalPoint(0, 0, 0)
+ren.GetActiveCamera.SetPosition(1, 0, 0)
+ren.GetActiveCamera.SetViewUp(0, 0, 1)
+ren.ResetCamera
+ren.GetActiveCamera.Azimuth(20)
+ren.GetActiveCamera.Elevation(30)
+ren.GetActiveCamera.Dolly(1.2)
+ren.ResetCameraClippingRange
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Modelling/Ruby/SpherePuzzle.rb VTK/Examples/Modelling/Ruby/SpherePuzzle.rb
--- VTK_org/Examples/Modelling/Ruby/SpherePuzzle.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Modelling/Ruby/SpherePuzzle.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,167 @@
+#!/usr/bin/env ruby
+
+# A game with VTK && Tk. :)
+
+require 'tk'
+require 'vtk'
+require 'vtk/tk'
+
+# Create the pipeline
+@puzzle = Vtk::SpherePuzzle.new
+mapper = Vtk::PolyDataMapper.new
+mapper.SetInputConnection(@puzzle.GetOutputPort)
+actor = Vtk::Actor.new
+actor.SetMapper(mapper)
+
+arrows = Vtk::SpherePuzzleArrows.new
+mapper2 = Vtk::PolyDataMapper.new
+mapper2.SetInputConnection(arrows.GetOutputPort)
+actor2 = Vtk::Actor.new
+actor2.SetMapper(mapper2)
+
+@renWin = Vtk::RenderWindow.new
+@ren = Vtk::Renderer.new
+@renWin.AddRenderer(@ren)
+
+# Add the actors to the renderer, set the background && size
+@ren.AddActor(actor)
+@ren.AddActor(actor2)
+@ren.SetBackground(0.1, 0.2, 0.4)
+
+@ren.ResetCamera
+cam = @ren.GetActiveCamera
+cam.Elevation(-40)
+
+
+## Generate the GUI
+@root = TkRoot.new{
+  title "Sphere Puzzle"
+}
+
+# Define a quit method that exits cleanly.
+quit = Proc.new{
+  exit
+}
+
+# Create the toplevel window
+@root.protocol("WM_DELETE_WINDOW", quit)
+
+# Create some frames
+f1 = TkFrame.new(@root)
+f2 = TkFrame.new(@root)
+
+f1.pack("side"=>"top", "anchor"=>"n", "expand"=>1, "fill"=>"both")
+f2.pack("side"=>"bottom", "anchor"=>"s", "expand"=>"t", "fill"=>"x")
+
+# Create the Tk render widget, && bind the events
+@iren = Vtk::TkRenderWindowInteractor.new(f1, 'width'=>400, 'height'=>400, 'rw'=>@renWin)
+@iren.pack("expand"=>"t", "fill"=>"both")
+
+reset = Proc.new{
+  @puzzle.Reset
+  @renWin.Render
+}
+
+# Display some information
+l1 = TkLabel.new(f2, 'text'=>"Position cursor over the rotation plane.")
+l2 = TkLabel.new(f2, 'text'=>"Moving pieces will be highlighted.")
+l3 = TkLabel.new(f2, 'text'=>"Press 'm' to make a move.")
+reset = TkButton.new(f2, 'text'=>"Reset", 'command'=>reset)
+
+b1 = TkButton.new(f2, "text"=>"Quit", "command"=>quit)
+
+for i in [l1, l2, l3, reset, b1]
+    i.pack("side"=>"top", "expand"=>"t", "fill"=>"x")
+end
+
+# Done with the GUI.  Create callback functions.
+
+@in_piece_rotation = false
+@lastVal = nil
+
+# Highlight pieces
+MotionCallback = Proc.new{|obj, event|
+  if @in_piece_rotation
+    return 
+  end
+
+  istyle = @iren.GetInteractorStyle.GetCurrentStyle
+
+  # Return if the user is performing interaction
+  if istyle.GetState != 0
+    return
+  end
+
+  # Get mouse position
+  pos = @iren.GetEventPosition
+  x, y = pos
+
+  # Get world point
+  @ren.SetDisplayPoint(x, y, @ren.GetZ(x, y))
+  @ren.DisplayToWorld
+  pt = @ren.GetWorldPoint
+  val = @puzzle.SetPoint(pt[0], pt[1], pt[2])
+
+  if ( !@lastVal) || val != @lastVal
+    @renWin.Render
+    @lastVal = val
+  end
+}
+
+# Rotate the puzzle
+CharCallback = Proc.new{|obj, event|
+  keycode = @iren.GetKeyCode
+  if keycode != "m" && keycode != "M"
+    return
+  end
+
+  pos = @iren.GetEventPosition
+  ButtonCallback(pos[0], pos[1])
+}
+
+def ButtonCallback(x, y)
+  if @in_piece_rotation
+    return
+  end
+  @in_piece_rotation = true
+
+  # Get world point
+  @ren.SetDisplayPoint(x, y, @ren.GetZ(x,y))
+  @ren.DisplayToWorld
+  pt = @ren.GetWorldPoint
+  x, y, z = pt[0..2]
+
+  for ii in 0..10
+    i = ii*10
+    @puzzle.SetPoint(x, y, z)
+    @puzzle.MovePoint(i)
+    @renWin.Render
+    @root.update
+  end
+
+  @in_piece_rotation = false
+end
+
+@root.update
+
+# Modify some bindings, use the interactor style 'switch'
+istyle = Vtk::InteractorStyleSwitch.new
+
+@iren.SetInteractorStyle(istyle)
+istyle.SetCurrentStyleToTrackballCamera
+
+@iren.AddObserver("MouseMoveEvent", MotionCallback)
+@iren.AddObserver("CharEvent", CharCallback)
+
+# Shuffle the puzzle
+ButtonCallback(218, 195)
+ButtonCallback(261, 128)
+ButtonCallback(213, 107)
+ButtonCallback(203, 162)
+ButtonCallback(134, 186)
+
+@iren.Initialize
+@renWin.Render
+@iren.Start
+
+@root.mainloop
diff -uNr VTK_org/Examples/Rendering/Ruby/assembly.rb VTK/Examples/Rendering/Ruby/assembly.rb
--- VTK_org/Examples/Rendering/Ruby/assembly.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Rendering/Ruby/assembly.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,83 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of vtkAssembly.  In an assembly,
+# the motion of one actor affects the position of other actors.
+
+require 'vtk'
+
+# Create four parts: a top level assembly (in this case, a
+# vtkCylinder) and three primitives (using vtkSphereSource,
+# vtkCubeSource, and vtkConeSource).  Set up mappers and actors for
+# each part of the assembly to carry information about material
+# properties and associated geometry.
+sphere = Vtk::SphereSource.new
+sphereMapper = Vtk::PolyDataMapper.new
+sphereMapper.SetInputConnection(sphere.GetOutputPort)
+sphereActor = Vtk::Actor.new
+sphereActor.SetMapper(sphereMapper)
+sphereActor.SetOrigin(2, 1, 3)
+sphereActor.RotateY(6)
+sphereActor.SetPosition(2.25, 0, 0)
+sphereActor.GetProperty.SetColor(1, 0, 1)
+
+cube = Vtk::CubeSource.new
+cubeMapper = Vtk::PolyDataMapper.new
+cubeMapper.SetInputConnection(cube.GetOutputPort)
+cubeActor = Vtk::Actor.new
+cubeActor.SetMapper(cubeMapper)
+cubeActor.SetPosition(0.0, 0.25, 0)
+cubeActor.GetProperty.SetColor(0, 0, 1)
+
+cone = Vtk::ConeSource.new
+coneMapper = Vtk::PolyDataMapper.new
+coneMapper.SetInputConnection(cone.GetOutputPort)
+coneActor = Vtk::Actor.new
+coneActor.SetMapper(coneMapper)
+coneActor.SetPosition(0, 0, 0.25)
+coneActor.GetProperty.SetColor(0, 1, 0)
+
+# top part of the assembly
+cylinder = Vtk::CylinderSource.new
+cylinderMapper = Vtk::PolyDataMapper.new
+cylinderMapper.SetInputConnection(cylinder.GetOutputPort)
+cylinderMapper.SetResolveCoincidentTopologyToPolygonOffset
+cylinderActor = Vtk::Actor.new
+cylinderActor.SetMapper(cylinderMapper)
+cylinderActor.GetProperty.SetColor(1, 0, 0)
+
+# Create the assembly and add the 4 parts to it.  Also set the origin,
+# position and orientation in space.
+assembly = Vtk::Assembly.new
+assembly.AddPart(cylinderActor)
+assembly.AddPart(sphereActor)
+assembly.AddPart(cubeActor)
+assembly.AddPart(coneActor)
+assembly.SetOrigin(5, 10, 15)
+assembly.AddPosition(5, 0, 0)
+assembly.RotateX(15)
+
+# Create the Renderer, RenderWindow, and RenderWindowInteractor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(assembly)
+ren.AddActor(coneActor)
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin.SetSize(200, 200)
+
+# Set up the camera to get a particular view of the scene
+camera = Vtk::Camera.new
+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)
+ren.SetActiveCamera(camera)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Rendering/Ruby/CADPart.rb VTK/Examples/Rendering/Ruby/CADPart.rb
--- VTK_org/Examples/Rendering/Ruby/CADPart.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Rendering/Ruby/CADPart.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,56 @@
+#!/usr/bin/env ruby
+
+# This simple example shows how to do basic rendering and pipeline
+# creation. It also demonstrates the use of the LODActor.
+
+# Import the VTK-Ruby module
+require 'vtk'
+require 'vtk/util'
+# Get the location of the data.
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# This creates a polygonal cylinder model with eight circumferential
+# facets.
+part = Vtk::STLReader.new
+part.SetFileName(VTK_DATA_ROOT + "/Data/42400-IDGH.stl")
+
+# The mapper is responsible for pushing the geometry into the graphics
+# library. It may also do color mapping, if scalars or other
+# attributes are defined.
+partMapper = Vtk::PolyDataMapper.new
+partMapper.SetInputConnection(part.GetOutputPort)
+
+# The LOD actor is a special type of actor. It will change appearance
+# in order to render faster. At the highest resolution, it renders
+# ewverything just like an actor. The middle level is a point cloud,
+# and the lowest level is a simple bounding box.
+partActor = Vtk::LODActor.new
+partActor.SetMapper(partMapper)
+partActor.GetProperty.SetColor(Vtk::Colors::Light_grey)
+partActor.RotateX(30.0)
+partActor.RotateY(-45.0)
+
+# Create the graphics structure. The renderer renders into the render
+# window. The render window interactor captures mouse events and will
+# perform appropriate camera or actor manipulation depending on the
+# nature of the events.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(partActor)
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin.SetSize(200, 200)
+
+# We'll zoom in a little by accessing the camera and invoking a "Zoom"
+# method on it.
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.5)
+
+# This starts the event loop.
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Rendering/Ruby/CSpline.rb VTK/Examples/Rendering/Ruby/CSpline.rb
--- VTK_org/Examples/Rendering/Ruby/CSpline.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Rendering/Ruby/CSpline.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,120 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of vtkCardinalSpline.
+# It creates random points and connects them with a spline
+
+require 'vtk'
+require 'vtk/util'
+
+# This will be used later to get random numbers.
+math = Vtk::Math.new
+
+# Total number of points.
+numberOfInputPoints = 10
+
+# One spline for each direction.
+aSplineX = Vtk::CardinalSpline.new
+aSplineY = Vtk::CardinalSpline.new
+aSplineZ = Vtk::CardinalSpline.new
+
+# Generate random (pivot) points and add the corresponding
+# coordinates to the splines.
+# aSplineX will interpolate the x values of the points
+# aSplineY will interpolate the y values of the points
+# aSplineZ will interpolate the z values of the points
+inputPoints = Vtk::Points.new
+for i in 0...numberOfInputPoints
+  x = math.Random(0, 1)
+  y = math.Random(0, 1)
+  z = math.Random(0, 1)
+  aSplineX.AddPoint(i, x)
+  aSplineY.AddPoint(i, y)
+  aSplineZ.AddPoint(i, z)
+  inputPoints.InsertPoint(i, x, y, z)
+end
+ 
+
+# The following section will create glyphs for the pivot points
+# in order to make the effect of the spline more clear.
+
+# Create a polydata to be glyphed.
+inputData = Vtk::PolyData.new
+inputData.SetPoints(inputPoints)
+
+# Use sphere as glyph source.
+balls = Vtk::SphereSource.new
+balls.SetRadius(0.01)
+balls.SetPhiResolution(10)
+balls.SetThetaResolution(10)
+
+glyphPoints = Vtk::Glyph3D.new
+glyphPoints.SetInput(inputData)
+glyphPoints.SetSource(balls.GetOutput)
+
+glyphMapper = Vtk::PolyDataMapper.new
+glyphMapper.SetInputConnection(glyphPoints.GetOutputPort)
+
+glyph = Vtk::Actor.new
+glyph.SetMapper(glyphMapper)
+glyph.GetProperty.SetDiffuseColor(Vtk::Colors::Tomato)
+glyph.GetProperty.SetSpecular(0.3)
+glyph.GetProperty.SetSpecularPower(30)
+
+# Generate the polyline for the spline.
+points = Vtk::Points.new
+profileData = Vtk::PolyData.new
+
+# Number of points on the spline
+numberOfOutputPoints = 400
+
+# Interpolate x, y and z by using the three spline filters and
+# create new points
+for i in 0...numberOfOutputPoints
+  t = (numberOfInputPoints-1.0)/(numberOfOutputPoints-1.0)*i
+  points.InsertPoint(i, aSplineX.Evaluate(t), aSplineY.Evaluate(t),
+                     aSplineZ.Evaluate(t))
+end
+ 
+
+# Create the polyline.
+lines = Vtk::CellArray.new
+lines.InsertNextCell(numberOfOutputPoints)
+for i in 0...numberOfOutputPoints
+  lines.InsertCellPoint(i)
+end
+ 
+profileData.SetPoints(points)
+profileData.SetLines(lines)
+
+# Add thickness to the resulting line.
+profileTubes = Vtk::TubeFilter.new
+profileTubes.SetNumberOfSides(8)
+profileTubes.SetInput(profileData)
+profileTubes.SetRadius(0.005)
+
+profileMapper = Vtk::PolyDataMapper.new
+profileMapper.SetInputConnection(profileTubes.GetOutputPort)
+
+profile = Vtk::Actor.new
+profile.SetMapper(profileMapper)
+profile.GetProperty.SetDiffuseColor(Vtk::Colors::Banana)
+profile.GetProperty.SetSpecular(0.3)
+profile.GetProperty.SetSpecularPower(30)
+
+# Now create the RenderWindow, Renderer and Interactor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors
+ren.AddActor(glyph)
+ren.AddActor(profile)
+
+renWin.SetSize(500, 500)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Rendering/Ruby/Cylinder.rb VTK/Examples/Rendering/Ruby/Cylinder.rb
--- VTK_org/Examples/Rendering/Ruby/Cylinder.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Rendering/Ruby/Cylinder.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,55 @@
+#!/usr/bin/env ruby
+
+# This simple example shows how to do basic rendering and pipeline
+# creation.
+
+require 'vtk'
+require 'vtk/util'
+
+# This creates a polygonal cylinder model with eight circumferential
+# facets.
+cylinder = Vtk::CylinderSource.new
+cylinder.SetResolution(8)
+
+# The mapper is responsible for pushing the geometry into the graphics
+# library. It may also do color mapping, if scalars or other
+# attributes are defined.
+cylinderMapper = Vtk::PolyDataMapper.new
+cylinderMapper.SetInputConnection(cylinder.GetOutputPort)
+
+# The actor is a grouping mechanism: besides the geometry (mapper), it
+# also has a property, transformation matrix, and/or texture map.
+# Here we set its color and rotate it -22.5 degrees.
+cylinderActor = Vtk::Actor.new
+cylinderActor.SetMapper(cylinderMapper)
+cylinderActor.GetProperty.SetColor(Vtk::Colors::Tomato)
+cylinderActor.RotateX(30.0)
+cylinderActor.RotateY(-45.0)
+
+# Create the graphics structure. The renderer renders into the render
+# window. The render window interactor captures mouse events and will
+# perform appropriate camera or actor manipulation depending on the
+# nature of the events.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(cylinderActor)
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin.SetSize(200, 200)
+
+# This allows the interactor to initalize itself. It has to be
+# called before an event loop. 
+iren.Initialize
+
+# We'll zoom in a little by accessing the camera and invoking a "Zoom"
+# method on it.
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.5)
+renWin.Render
+
+# Start the event loop.
+iren.Start
diff -uNr VTK_org/Examples/Rendering/Ruby/FilterCADPart.rb VTK/Examples/Rendering/Ruby/FilterCADPart.rb
--- VTK_org/Examples/Rendering/Ruby/FilterCADPart.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Rendering/Ruby/FilterCADPart.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,65 @@
+#!/usr/bin/env ruby
+
+# This simple example shows how to do simple filtering in a pipeline.
+# See CADPart.rb and Cylinder.rb for related information.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# This creates a polygonal cylinder model with eight circumferential
+# facets.
+part = Vtk::STLReader.new
+part.SetFileName(VTK_DATA_ROOT + "/Data/42400-IDGH.stl")
+
+# A filter is a module that takes at least one input and produces at
+# least one output. The SetInput and GetOutput methods are used to do
+# the connection. What is returned by GetOutput is a particulat
+# dataset type. If the type is compatible with the SetInput method,
+# then the filters can be connected together.
+#
+# Here we add a filter that computes surface normals from the geometry.
+shrink = Vtk::ShrinkPolyData.new
+shrink.SetInputConnection(part.GetOutputPort)
+shrink.SetShrinkFactor(0.85)
+
+# The mapper is responsible for pushing the geometry into the graphics
+# library. It may also do color mapping, if scalars or other
+# attributes are defined.
+partMapper = Vtk::PolyDataMapper.new
+partMapper.SetInputConnection(shrink.GetOutputPort)
+
+# The LOD actor is a special type of actor. It will change appearance
+# in order to render faster. At the highest resolution, it renders
+# ewverything just like an actor. The middle level is a point cloud,
+# and the lowest level is a simple bounding box.
+partActor = Vtk::LODActor.new
+partActor.SetMapper(partMapper)
+partActor.GetProperty.SetColor(Vtk::Colors::Light_grey)
+partActor.RotateX(30.0)
+partActor.RotateY(-45.0)
+
+# Create the graphics structure. The renderer renders into the
+# render window. The render window interactor captures mouse events
+# and will perform appropriate camera or actor manipulation
+# depending on the nature of the events.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(partActor)
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin.SetSize(200, 200)
+
+# We'll zoom in a little by accessing the camera and invoking a "Zoom"
+# method on it.
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.5)
+
+iren.Initialize
+renWin.Render
+# Start the event loop.
+iren.Start
diff -uNr VTK_org/Examples/Rendering/Ruby/rainbow.rb VTK/Examples/Rendering/Ruby/rainbow.rb
--- VTK_org/Examples/Rendering/Ruby/rainbow.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Rendering/Ruby/rainbow.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,97 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use and manipulation of lookup tables.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# First create pipeline a simple pipeline that reads a structure grid
+# and then extracts a plane from the grid. The plane will be colored
+# differently by using different lookup tables.
+#
+# Note: the Update method is manually invoked because it causes the
+# reader to read; later on we use the output of the reader to set
+# a range for the scalar values.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+plane = Vtk::StructuredGridGeometryFilter.new
+plane.SetInputConnection(pl3d.GetOutputPort)
+plane.SetExtent(1, 100, 1, 100, 7, 7)
+lut = Vtk::LookupTable.new
+planeMapper = Vtk::PolyDataMapper.new
+planeMapper.SetLookupTable(lut)
+planeMapper.SetInputConnection(plane.GetOutputPort)
+planeMapper.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+planeActor = Vtk::Actor.new
+planeActor.SetMapper(planeMapper)
+
+# This creates an outline around the data.
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+
+# Much of the following is commented out. To try different lookup tables,
+# uncommented the appropriate portions.
+
+# This creates a black to white lut.
+##lut.SetHueRange(0, 0)
+##lut.SetSaturationRange(0, 0)
+##lut.SetValueRange(0.2, 1.0)
+
+# This creates a red to blue lut.
+##lut.SetHueRange(0.0, 0.667)
+
+# This creates a blue to red lut.
+##lut.SetHueRange(0.667, 0.0)
+
+# This creates a wierd effect. The Build() method causes the lookup
+# table to allocate memory and create a table based on the currect
+# hue, saturation, value, and alpha (transparency) range. Here we then
+# manually overwrite the values generated by the Build() method.
+lut.SetNumberOfColors(256)
+lut.Build
+red = Vtk::Colors::Red
+green = Vtk::Colors::Green
+blue = Vtk::Colors::Blue
+black = Vtk::Colors::Black
+for i in 0...16
+  lut.SetTableValue(i*16, red[0], red[1], red[2], 1)
+  lut.SetTableValue(i*16+1, green[0], green[1], green[2], 1)
+  lut.SetTableValue(i*16+2, blue[0], blue[1], blue[2], 1)
+  lut.SetTableValue(i*16+3, black[0], black[1], black[2], 1)
+end
+
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(outlineActor)
+ren.AddActor(planeActor)
+
+ren.SetBackground(0.1, 0.2, 0.4)
+ren.TwoSidedLightingOff
+
+renWin.SetSize(250, 250)
+
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(3.95297, 50)
+cam1.SetFocalPoint(8.88908, 0.595038, 29.3342)
+cam1.SetPosition(-12.3332, 31.7479, 41.2387)
+cam1.SetViewUp(0.060772, -0.319905, 0.945498)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Rendering/Ruby/RenderLargeImage.rb VTK/Examples/Rendering/Ruby/RenderLargeImage.rb
--- VTK_org/Examples/Rendering/Ruby/RenderLargeImage.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Rendering/Ruby/RenderLargeImage.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,47 @@
+#!/usr/bin/env ruby
+
+# This simple example shows how to render a very large image (i.e.
+# one that cannot fit on the screen).
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# We'll import some data to start. Since we are using an importer,
+# we've got to give it a render window and such. Note that the render
+# window size is set fairly small.
+ren = Vtk::Renderer.new
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+renWin.SetSize(125, 125)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+importer = Vtk::3DSImporter.new
+importer.SetRenderWindow(renWin)
+importer.SetFileName(VTK_DATA_ROOT + "/Data/Viewpoint/iflamigm.3ds")
+importer.ComputeNormalsOn
+importer.Read
+
+# We'll set up the view we want.
+ren.GetActiveCamera.SetPosition(0, 1, 0)
+ren.GetActiveCamera.SetFocalPoint(0, 0, 0)
+ren.GetActiveCamera.SetViewUp(0, 0, 1)
+
+# Let the renderer compute a good position and focal point.
+ren.ResetCamera
+ren.GetActiveCamera.Dolly(1.4)
+ren.ResetCameraClippingRange
+
+renderLarge = Vtk::RenderLargeImage.new
+renderLarge.SetInput(ren)
+renderLarge.SetMagnification(4)
+
+# We write out the image which causes the rendering to occur. If you
+# watch your screen you might see the pieces being rendered right
+# after one another.
+writer = Vtk::PNGWriter.new
+writer.SetInputConnection(renderLarge.GetOutputPort)
+writer.SetFileName("largeImage.png")
+writer.Write
diff -uNr VTK_org/Examples/Rendering/Ruby/TPlane.rb VTK/Examples/Rendering/Ruby/TPlane.rb
--- VTK_org/Examples/Rendering/Ruby/TPlane.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Rendering/Ruby/TPlane.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,47 @@
+#!/usr/bin/env ruby
+
+# This simple example shows how to do basic texture mapping.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Load in the texture map. A texture is any unsigned char image. If it
+# is not of this type, you will have to map it through a lookup table
+# or by using vtkImageShiftScale.
+bmpReader = Vtk::BMPReader.new
+bmpReader.SetFileName(VTK_DATA_ROOT + "/Data/masonry.bmp")
+atext = Vtk::Texture.new
+atext.SetInputConnection(bmpReader.GetOutputPort)
+atext.InterpolateOn
+
+# Create a plane source and actor. The vtkPlanesSource generates
+# texture coordinates.
+plane = Vtk::PlaneSource.new
+planeMapper = Vtk::PolyDataMapper.new
+planeMapper.SetInputConnection(plane.GetOutputPort)
+planeActor = Vtk::Actor.new
+planeActor.SetMapper(planeMapper)
+planeActor.SetTexture(atext)
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(planeActor)
+ren.SetBackground(0.1, 0.2, 0.4)
+renWin.SetSize(500, 500)
+
+ren.ResetCamera
+cam1 = ren.GetActiveCamera
+cam1.Elevation(-30)
+cam1.Roll(-20)
+ren.ResetCameraClippingRange
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/Tutorial/Step1/Ruby/Cone.rb VTK/Examples/Tutorial/Step1/Ruby/Cone.rb
--- VTK_org/Examples/Tutorial/Step1/Ruby/Cone.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Tutorial/Step1/Ruby/Cone.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,60 @@
+require "vtk"
+
+# 
+# Next we create an instance of vtkConeSource and set some of its
+# properties. The instance of vtkConeSource "cone" is part of a visualization
+# pipeline (it is a source process object); it produces data (output type is
+# vtkPolyData) which other filters may process.
+#
+cone = Vtk::ConeSource.new
+cone.SetHeight( 3.0 )
+cone.SetRadius( 1.0 )
+cone.SetResolution( 10 )
+  
+# 
+# In this example we terminate the pipeline with a mapper process object.
+# (Intermediate filters such as vtkShrinkPolyData could be inserted in
+# between the source and the mapper.)  We create an instance of
+# vtkPolyDataMapper to map the polygonal data into graphics primitives. We
+# connect the output of the cone souece to the input of this mapper.
+#
+coneMapper = Vtk::PolyDataMapper.new
+coneMapper.SetInputConnection( cone.GetOutputPort )
+
+# 
+# Create an actor to represent the cone. The actor orchestrates rendering of
+# the mapper's graphics primitives. An actor also refers to properties via a
+# vtkProperty instance, and includes an internal transformation matrix. We
+# set this actor's mapper to be coneMapper which we created above.
+#
+coneActor = Vtk::Actor.new
+coneActor.SetMapper( coneMapper )
+
+#
+# Create the Renderer and assign actors to it. A renderer is like a
+# viewport. It is part or all of a window on the screen and it is
+# responsible for drawing the actors it has.  We also set the background
+# color here
+#
+ren1= Vtk::Renderer.new
+ren1.AddActor( coneActor )
+ren1.SetBackground( 0.1, 0.2, 0.4 )
+
+#
+# Finally we create the render window which will show up on the screen
+# We put our renderer into the render window using AddRenderer. We also
+# set the size to be 300 pixels by 300
+#
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer( ren1 )
+renWin.SetSize( 300, 300 )
+
+#
+# now we loop over 360 degreeees and render the cone each time
+#
+for i in 0...360
+    sleep 0.03
+
+    renWin.Render
+    ren1.GetActiveCamera.Azimuth( 1 )
+end
diff -uNr VTK_org/Examples/Tutorial/Step2/Ruby/Cone2.rb VTK/Examples/Tutorial/Step2/Ruby/Cone2.rb
--- VTK_org/Examples/Tutorial/Step2/Ruby/Cone2.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Tutorial/Step2/Ruby/Cone2.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,59 @@
+#!/usr/bin/env ruby
+#
+#
+# This example shows how to add an observer to a Ruby program. It extends
+# the Step1/Ruby/Cone.rb Ruby example (see that example for information on
+# the basic setup). 
+#
+# VTK uses a command/observer design pattern. That is, observers watch for
+# particular events that any vtkObject (or subclass) may invoke on
+# itself. For example, the vtkRenderer invokes a "StartEvent" as it begins
+# to render. Here we add an observer that invokes a command when this event
+# is observed.
+#
+
+require 'vtk'
+
+#
+# define the callback
+#
+myCallback = Proc.new {|obj,string|
+    print "Starting a render\n"
+}
+
+
+#
+# create the basic pipeline as in Step1
+#
+cone = Vtk::ConeSource.new
+cone.SetHeight( 3.0 )
+cone.SetRadius( 1.0 )
+cone.SetResolution( 10 )
+
+coneMapper = Vtk::PolyDataMapper.new
+coneMapper.SetInputConnection( cone.GetOutputPort )
+coneActor = Vtk::Actor.new
+coneActor.SetMapper( coneMapper )
+
+ren1= Vtk::Renderer.new
+ren1.AddActor( coneActor )
+ren1.SetBackground( 0.1, 0.2, 0.4 )
+
+#
+# Add the observer here
+#
+ren1.AddObserver("StartEvent", myCallback)
+
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer( ren1 )
+renWin.SetSize( 300, 300 )
+
+#
+# now we loop over 360 degreeees and render the cone each time
+#
+for i in 0...360
+  sleep 0.03
+  renWin.Render
+  ren1.GetActiveCamera.Azimuth( 1 )
+end
+  
diff -uNr VTK_org/Examples/Tutorial/Step3/Ruby/Cone3.rb VTK/Examples/Tutorial/Step3/Ruby/Cone3.rb
--- VTK_org/Examples/Tutorial/Step3/Ruby/Cone3.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Tutorial/Step3/Ruby/Cone3.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,83 @@
+#!/usr/bin/env ruby
+#
+# This example demonstrates how to use multiple renderers within a
+# render window. It is a variation of the Cone.rb example. Please
+# refer to that example for additional documentation.
+#
+
+require 'vtk'
+
+# 
+# Next we create an instance of vtkConeSource and set some of its
+# properties. The instance of vtkConeSource "cone" is part of a visualization
+# pipeline (it is a source process object); it produces data (output type is
+# vtkPolyData) which other filters may process.
+#
+cone = Vtk::ConeSource.new
+cone.SetHeight( 3.0 )
+cone.SetRadius( 1.0 )
+cone.SetResolution( 10 )
+
+# 
+# In this example we terminate the pipeline with a mapper process object.
+# (Intermediate filters such as vtkShrinkPolyData could be inserted in
+# between the source and the mapper.)  We create an instance of
+# vtkPolyDataMapper to map the polygonal data into graphics primitives. We
+# connect the output of the cone souece to the input of this mapper.
+#
+coneMapper = Vtk::PolyDataMapper.new
+coneMapper.SetInputConnection(cone.GetOutputPort)
+
+# 
+# Create an actor to represent the cone. The actor orchestrates rendering of
+# the mapper's graphics primitives. An actor also refers to properties via a
+# vtkProperty instance, and includes an internal transformation matrix. We
+# set this actor's mapper to be coneMapper which we created above.
+#
+coneActor = Vtk::Actor.new
+coneActor.SetMapper(coneMapper)
+
+# 
+# Create two renderers and assign actors to them. A renderer renders into a
+# viewport within the vtkRenderWindow. It is part or all of a window on the
+# screen and it is responsible for drawing the actors it has.  We also set
+# the background color here. In this example we are adding the same actor
+# to two different renderers; it is okay to add different actors to
+# different renderers as well.
+#
+ren1 = Vtk::Renderer.new
+ren1.AddActor(coneActor)
+ren1.SetBackground(0.1, 0.2, 0.4)
+ren1.SetViewport(0.0, 0.0, 0.5, 1.0)
+
+ren2 = Vtk::Renderer.new
+ren2.AddActor(coneActor)
+ren2.SetBackground(0.1, 0.2, 0.4)
+ren2.SetViewport(0.5, 0.0, 1.0, 1.0)
+
+#
+# Finally we create the render window which will show up on the screen.
+# We add our two renderers into the render window using AddRenderer. We also
+# set the size to be 600 pixels by 300.
+#
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer( ren1 )
+renWin.AddRenderer( ren2 )
+renWin.SetSize(600, 300)
+
+#
+# Make one camera view 90 degrees from other.
+#
+ren1.ResetCamera
+ren1.GetActiveCamera.Azimuth(90)
+
+#
+# Now we loop over 360 degreeees and render the cone each time.
+#
+for i in 0...360
+  sleep 0.03
+    
+  renWin.Render
+  ren1.GetActiveCamera().Azimuth( 1 )
+  ren2.GetActiveCamera().Azimuth( 1 )
+end
diff -uNr VTK_org/Examples/Tutorial/Step4/Ruby/Cone4.rb VTK/Examples/Tutorial/Step4/Ruby/Cone4.rb
--- VTK_org/Examples/Tutorial/Step4/Ruby/Cone4.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Tutorial/Step4/Ruby/Cone4.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,92 @@
+#!/usr/bin/env ruby
+#
+# This example demonstrates the creation of multiple actors and the
+# manipulation of their properties and transformations. It is a
+# derivative of Cone.rb, see that example for more information.
+#
+
+require 'vtk'
+
+# 
+# Next we create an instance of vtkConeSource and set some of its
+# properties. The instance of vtkConeSource "cone" is part of a visualization
+# pipeline (it is a source process object); it produces data (output type is
+# vtkPolyData) which other filters may process.
+#
+cone = Vtk::ConeSource.new
+cone.SetHeight( 3.0 )
+cone.SetRadius( 1.0 )
+cone.SetResolution( 10 )
+
+# 
+# In this example we terminate the pipeline with a mapper process object.
+# (Intermediate filters such as vtkShrinkPolyData could be inserted in
+# between the source and the mapper.)  We create an instance of
+# vtkPolyDataMapper to map the polygonal data into graphics primitives. We
+# connect the output of the cone souece to the input of this mapper.
+#
+coneMapper = Vtk::PolyDataMapper.new
+coneMapper.SetInputConnection(cone.GetOutputPort)
+
+# 
+# Create an actor to represent the first cone. The actor's properties are
+# modified to give it different surface properties. By default, an actor
+# is create with a property so the GetProperty() method can be used.
+#
+coneActor = Vtk::Actor.new
+coneActor.SetMapper(coneMapper)
+coneActor.GetProperty.SetColor(0.2, 0.63, 0.79)
+coneActor.GetProperty.SetDiffuse(0.7)
+coneActor.GetProperty.SetSpecular(0.4)
+coneActor.GetProperty.SetSpecularPower(20)
+
+#
+# Create a property and directly manipulate it. Assign it to the
+# second actor.
+#
+property = Vtk::Property.new
+property.SetColor(1.0, 0.3882, 0.2784)
+property.SetDiffuse(0.7)
+property.SetSpecular(0.4)
+property.SetSpecularPower(20)
+
+#
+# Create a second actor and a property. The property is directly
+# manipulated and then assigned to the actor. In this way, a single
+# property can be shared among many actors. Note also that we use the
+# same mapper as the first actor did. This way we avoid duplicating
+# geometry, which may save lots of memory if the geoemtry is large.
+coneActor2 = Vtk::Actor.new
+coneActor2.SetMapper(coneMapper)
+coneActor2.GetProperty.SetColor(0.2, 0.63, 0.79)
+coneActor2.SetProperty(property)
+coneActor2.SetPosition(0, 2, 0)
+
+#
+# Create the Renderer and assign actors to it. A renderer is like a
+# viewport. It is part or all of a window on the screen and it is responsible
+# for drawing the actors it has.  We also set the background color here.
+#
+ren1 = Vtk::Renderer.new
+ren1.AddActor(coneActor)
+ren1.AddActor(coneActor2)
+ren1.SetBackground(0.1, 0.2, 0.4)
+
+#
+# Finally we create the render window which will show up on the screen
+# We put our renderer into the render window using AddRenderer. We also
+# set the size to be 300 pixels by 300.
+#
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren1)
+renWin.SetSize(300, 300)
+
+#
+# Now we loop over 360 degreeees and render the cone each time.
+#
+for i in 0...360
+  sleep 0.03
+    
+  renWin.Render
+  ren1.GetActiveCamera.Azimuth( 1 )
+end
diff -uNr VTK_org/Examples/Tutorial/Step5/Ruby/Cone5.rb VTK/Examples/Tutorial/Step5/Ruby/Cone5.rb
--- VTK_org/Examples/Tutorial/Step5/Ruby/Cone5.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Tutorial/Step5/Ruby/Cone5.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,93 @@
+#!/usr/bin/env ruby
+
+#
+# This example introduces the concepts of user interaction with VTK.
+# First, a different interaction style (than the default) is defined.
+# Second, the interaction is started. 
+#
+#
+
+require 'vtk'
+
+# 
+# Next we create an instance of vtkConeSource and set some of its
+# properties. The instance of vtkConeSource "cone" is part of a visualization
+# pipeline (it is a source process object); it produces data (output type is
+# vtkPolyData) which other filters may process.
+#
+cone = Vtk::ConeSource.new
+cone.SetHeight( 3.0 )
+cone.SetRadius( 1.0 )
+cone.SetResolution( 10 )
+
+# 
+# In this example we terminate the pipeline with a mapper process object.
+# (Intermediate filters such as vtkShrinkPolyData could be inserted in
+# between the source and the mapper.)  We create an instance of
+# vtkPolyDataMapper to map the polygonal data into graphics primitives. We
+# connect the output of the cone souece to the input of this mapper.
+#
+coneMapper = Vtk::PolyDataMapper.new
+coneMapper.SetInputConnection(cone.GetOutputPort)
+
+# 
+# Create an actor to represent the cone. The actor orchestrates rendering of
+# the mapper's graphics primitives. An actor also refers to properties via a
+# vtkProperty instance, and includes an internal transformation matrix. We
+# set this actor's mapper to be coneMapper which we created above.
+#
+coneActor = Vtk::Actor.new
+coneActor.SetMapper(coneMapper)
+
+#
+# Create the Renderer and assign actors to it. A renderer is like a
+# viewport. It is part or all of a window on the screen and it is responsible
+# for drawing the actors it has.  We also set the background color here.
+#
+ren1 = Vtk::Renderer.new
+ren1.AddActor(coneActor)
+ren1.SetBackground(0.1, 0.2, 0.4)
+
+#
+# Finally we create the render window which will show up on the screen
+# We put our renderer into the render window using AddRenderer. We also
+# set the size to be 300 pixels by 300.
+#
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren1)
+renWin.SetSize(300, 300)
+
+# 
+# The vtkRenderWindowInteractor class watches for events (e.g., keypress,
+# mouse) in the vtkRenderWindow. These events are translated into
+# event invocations that VTK understands (see VTK/Common/vtkCommand.h
+# for all events that VTK processes). Then observers of these VTK
+# events can process them as appropriate.
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+#
+# By default the vtkRenderWindowInteractor instantiates an instance
+# of vtkInteractorStyle. vtkInteractorStyle translates a set of events
+# it observes into operations on the camera, actors, and/or properties
+# in the vtkRenderWindow associated with the vtkRenderWinodwInteractor. 
+# Here we specify a particular interactor style.
+style = Vtk::InteractorStyleTrackballCamera.new
+iren.SetInteractorStyle(style)
+
+#
+# Unlike the previous scripts where we performed some operations and then
+# exited, here we leave an event loop running. The user can use the mouse
+# and keyboard to perform the operations on the scene according to the
+# current interaction style.
+#
+
+#
+# Initialize and start the event loop. Once the render window appears, mouse
+# in the window to move the camera. The Start() method executes an event
+# loop which listens to user mouse and keyboard events. Note that keypress-e
+# exits the event loop. (Look in vtkInteractorStyle.h for a summary of events, or
+# the appropriate Doxygen documentation.)
+#
+iren.Initialize
+iren.Start
diff -uNr VTK_org/Examples/Tutorial/Step6/Ruby/Cone6.rb VTK/Examples/Tutorial/Step6/Ruby/Cone6.rb
--- VTK_org/Examples/Tutorial/Step6/Ruby/Cone6.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/Tutorial/Step6/Ruby/Cone6.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,118 @@
+#!/usr/bin/env ruby
+#
+# This example introduces 3D widgets. 3D widgets take advantage of the
+# event/observer design pattern introduced previously. They typically
+# have a particular representation in the scene which can be interactively
+# selected and manipulated using the mouse and keyboard. As the widgets
+# are manipulated, they in turn invoke events such as StartInteractionEvent,
+# InteractionEvent, and EndInteractionEvent which can be used to manipulate
+# the scene that the widget is embedded in. 3D widgets work in the context
+# of the event loop which was set up in the previous example.
+#
+# Note: there are more 3D widget examples in VTK/Examples/GUI/.
+#
+
+# First we import the VTK Ruby package that will make available all
+# of the VTK commands to Ruby.
+require 'vtk'
+
+# Next we create an instance of vtkConeSource and set some of its
+# properties. The instance of vtkConeSource "cone" is part of a
+# visualization pipeline (it is a source process object); it produces
+# data (output type is vtkPolyData) which other filters may process.
+cone = Vtk::ConeSource.new
+cone.SetHeight(3.0)
+cone.SetRadius(1.0)
+cone.SetResolution(10)
+
+# In this example we terminate the pipeline with a mapper process object.
+# (Intermediate filters such as vtkShrinkPolyData could be inserted in
+# between the source and the mapper.)  We create an instance of
+# vtkPolyDataMapper to map the polygonal data into graphics primitives. We
+# connect the output of the cone souece to the input of this mapper.
+coneMapper = Vtk::PolyDataMapper.new
+coneMapper.SetInputConnection(cone.GetOutputPort)
+
+# Create an actor to represent the cone. The actor orchestrates rendering of
+# the mapper's graphics primitives. An actor also refers to properties via a
+# vtkProperty instance, and includes an internal transformation matrix. We
+# set this actor's mapper to be coneMapper which we created above.
+coneActor = Vtk::Actor.new
+coneActor.SetMapper(coneMapper)
+
+# Create the Renderer and assign actors to it. A renderer is like a
+# viewport. It is part or all of a window on the screen and it is
+# responsible for drawing the actors it has.  We also set the
+# background color here.
+ren1 = Vtk::Renderer.new
+ren1.AddActor(coneActor)
+ren1.SetBackground(0.1, 0.2, 0.4)
+
+# Finally we create the render window which will show up on the screen
+# We put our renderer into the render window using AddRenderer. We
+# also set the size to be 300 pixels by 300.
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren1)
+renWin.SetSize(300, 300)
+
+# The vtkRenderWindowInteractor class watches for events (e.g., keypress,
+# mouse) in the vtkRenderWindow. These events are translated into
+# event invocations that VTK understands (see VTK/Common/vtkCommand.h
+# for all events that VTK processes). Then observers of these VTK
+# events can process them as appropriate.
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# By default the vtkRenderWindowInteractor instantiates an instance
+# of vtkInteractorStyle. vtkInteractorStyle translates a set of events
+# it observes into operations on the camera, actors, and/or properties
+# in the vtkRenderWindow associated with the vtkRenderWinodwInteractor. 
+# Here we specify a particular interactor style.
+style = Vtk::InteractorStyleTrackballCamera.new
+iren.SetInteractorStyle(style)
+
+
+# Here we use a vtkBoxWidget to transform the underlying coneActor (by
+# manipulating its transformation matrix). Many other types of widgets
+# are available for use, see the documentation for more details.
+#
+# The SetInteractor method is how 3D widgets are associated with the render
+# window interactor. Internally, SetInteractor sets up a bunch of callbacks
+# using the Command/Observer mechanism (AddObserver()). The place factor 
+# controls the initial size of the widget with respect to the bounding box
+# of the input to the widget.
+boxWidget = Vtk::BoxWidget.new
+boxWidget.SetInteractor(iren)
+boxWidget.SetPlaceFactor(1.25)
+
+# Place the interactor initially. The input to a 3D widget is used to
+# initially position and scale the widget. The EndInteractionEvent is
+# observed which invokes the SelectPolygons callback.
+boxWidget.SetProp3D(coneActor)
+boxWidget.PlaceWidget
+
+# Similar to Step2/Python/Cone2.py, we define a callback for
+# interaction.  As can be seen the callback takes two arguments.  The
+# first being the object that generates the event and the second
+# argument the event name (which is a string).
+myCallback = Proc.new{|widget, event_string|
+    t = Vtk::Transform.new
+    boxWidget.GetTransform(t)
+    boxWidget.GetProp3D.SetUserTransform(t)
+}
+        
+
+# Now for every interaction event that is generated by the boxWidget,
+# call our callback function.
+boxWidget.AddObserver("InteractionEvent", myCallback)
+
+# Normally the user presses the "i" key to bring a 3D widget to
+# life. Here we will manually enable it so it appears with the cone.
+boxWidget.On
+
+# Start the event loop.
+iren.Initialize
+iren.Start
+
+# There is no explicit need to free any objects at this point.
+# Once Python exits, memory is automatically freed.
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/BandContourTerrain.rb VTK/Examples/VisualizationAlgorithms/Ruby/BandContourTerrain.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/BandContourTerrain.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/BandContourTerrain.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,151 @@
+#!/usr/bin/env ruby
+
+# In this example we show the use of the
+# vtkBandedPolyDataContourFilter.  This filter creates separate,
+# constant colored bands for a range of scalar values. Each band is
+# bounded by two scalar values, and the cell data lying within the
+# value has the same cell scalar value.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+
+# The lookup table is similar to that used by maps. Two hues are used:
+# a brown for land, and a blue for water. The value of the hue is
+# changed to give the effect of elevation.
+Scale = 5
+lutWater = Vtk::LookupTable.new
+lutWater.SetNumberOfColors(10)
+lutWater.SetHueRange(0.58, 0.58)
+lutWater.SetSaturationRange(0.5, 0.1)
+lutWater.SetValueRange(0.5, 1.0)
+lutWater.Build
+lutLand = Vtk::LookupTable.new
+lutLand.SetNumberOfColors(10)
+lutLand.SetHueRange(0.1, 0.1)
+lutLand.SetSaturationRange(0.4, 0.1)
+lutLand.SetValueRange(0.55, 0.9)
+lutLand.Build
+
+
+# The DEM reader reads data and creates an output image.
+demModel = Vtk::DEMReader.new
+demModel.SetFileName(VTK_DATA_ROOT + "/Data/SainteHelens.dem")
+demModel.Update
+
+# We shrink the terrain data down a bit to yield better performance for 
+# this example.
+shrinkFactor = 4
+shrink = Vtk::ImageShrink3D.new
+shrink.SetShrinkFactors(shrinkFactor, shrinkFactor, 1)
+shrink.SetInputConnection(demModel.GetOutputPort)
+shrink.AveragingOn
+
+# Convert the image into polygons.
+geom = Vtk::ImageDataGeometryFilter.new
+geom.SetInputConnection(shrink.GetOutputPort)
+
+# Warp the polygons based on elevation.
+warp = Vtk::WarpScalar.new
+warp.SetInputConnection(geom.GetOutputPort)
+warp.SetNormal(0, 0, 1)
+warp.UseNormalOn
+warp.SetScaleFactor(Scale)
+
+# Create the contour bands.
+bcf = Vtk::BandedPolyDataContourFilter.new
+bcf.SetInput(warp.GetPolyDataOutput)
+bcf.GenerateValues(15, demModel.GetOutput.GetScalarRange)
+bcf.SetScalarModeToIndex
+bcf.GenerateContourEdgesOn
+
+# Compute normals to give a better look.
+normals = Vtk::PolyDataNormals.new
+normals.SetInputConnection(bcf.GetOutputPort)
+normals.SetFeatureAngle(60)
+normals.ConsistencyOff
+normals.SplittingOff
+
+demMapper = Vtk::PolyDataMapper.new
+demMapper.SetInputConnection(normals.GetOutputPort)
+demMapper.SetScalarRange(0, 10)
+demMapper.SetLookupTable(lutLand)
+demMapper.SetScalarModeToUseCellData
+
+demActor = Vtk::LODActor.new
+demActor.SetMapper(demMapper)
+
+## Create contour edges
+edgeMapper = Vtk::PolyDataMapper.new
+edgeMapper.SetInput(bcf.GetContourEdgesOutput)
+edgeMapper.SetResolveCoincidentTopologyToPolygonOffset
+edgeActor = Vtk::Actor.new
+edgeActor.SetMapper(edgeMapper)
+edgeActor.GetProperty.SetColor(0, 0, 0)
+
+## Test clipping
+# Create the contour bands.
+bcf2 = Vtk::BandedPolyDataContourFilter.new
+bcf2.SetInput(warp.GetPolyDataOutput)
+bcf2.ClippingOn
+bcf2.GenerateValues(10, 1000, 2000)
+bcf2.SetScalarModeToValue
+
+# Compute normals to give a better look.
+normals2 = Vtk::PolyDataNormals.new
+normals2.SetInputConnection(bcf2.GetOutputPort)
+normals2.SetFeatureAngle(60)
+normals2.ConsistencyOff
+normals2.SplittingOff
+
+lut = Vtk::LookupTable.new
+lut.SetNumberOfColors(10)
+demMapper2 = Vtk::PolyDataMapper.new
+demMapper2.SetInputConnection(normals2.GetOutputPort)
+demMapper2.SetScalarRange(demModel.GetOutput.GetScalarRange)
+demMapper2.SetLookupTable(lut)
+demMapper2.SetScalarModeToUseCellData
+
+demActor2 = Vtk::LODActor.new
+demActor2.SetMapper(demMapper2)
+demActor2.AddPosition(0, 15000, 0)
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(demActor)
+ren.AddActor(demActor2)
+ren.AddActor(edgeActor)
+
+ren.SetBackground(0.4, 0.4, 0.4)
+renWin.SetSize(375, 200)
+
+cam = Vtk::Camera.new
+cam.SetPosition(-17438.8, 2410.62, 25470.8)
+cam.SetFocalPoint(3985.35, 11930.6, 5922.14)
+cam.SetViewUp(0, 0, 1)
+ren.SetActiveCamera(cam)
+ren.ResetCamera
+cam.Zoom(2)
+
+iren.Initialize
+iren.SetDesiredUpdateRate(1)
+
+CheckAbort = Proc.new{|obj, event|
+  foo = renWin.GetEventPending
+  if foo != 0
+    renWin.SetAbortRender(1)
+  end
+}
+
+renWin.AddObserver("AbortCheckEvent", CheckAbort)
+renWin.Render
+
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/ClipCow.rb VTK/Examples/VisualizationAlgorithms/Ruby/ClipCow.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/ClipCow.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/ClipCow.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,120 @@
+#!/usr/bin/env ruby
+
+# In this example vtkClipPolyData is used to cut a polygonal model
+# of a cow in half. In addition, the open clip is closed by triangulating
+# the resulting complex polygons.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# First start by reading a cow model. We also generate surface normals for
+# prettier rendering.
+cow = Vtk::BYUReader.new
+cow.SetGeometryFileName(VTK_DATA_ROOT + "/Data/Viewpoint/cow.g")
+cowNormals = Vtk::PolyDataNormals.new
+cowNormals.SetInputConnection(cow.GetOutputPort)
+
+# We clip with an implicit function. Here we use a plane positioned near
+# the center of the cow model and oriented at an arbitrary angle.
+plane = Vtk::Plane.new
+plane.SetOrigin(0.25, 0, 0)
+plane.SetNormal(-1, -1, 0)
+
+# vtkClipPolyData requires an implicit function to define what it is to
+# clip with. Any implicit function, including complex boolean combinations
+# can be used. Notice that we can specify the value of the implicit function
+# with the SetValue method.
+@clipper = Vtk::ClipPolyData.new
+@clipper.SetInputConnection(cowNormals.GetOutputPort)
+@clipper.SetClipFunction(plane)
+@clipper.GenerateClipScalarsOn
+@clipper.GenerateClippedOutputOn
+@clipper.SetValue(0.5)
+clipMapper = Vtk::PolyDataMapper.new
+clipMapper.SetInputConnection(@clipper.GetOutputPort)
+clipMapper.ScalarVisibilityOff
+backProp = Vtk::Property.new
+backProp.SetDiffuseColor(Vtk::Colors::Tomato)
+clipActor = Vtk::Actor.new
+clipActor.SetMapper(clipMapper)
+clipActor.GetProperty.SetColor(Vtk::Colors::Peacock)
+clipActor.SetBackfaceProperty(backProp)
+
+# Here we are cutting the cow. Cutting creates lines where the cut
+# function intersects the model. (Clipping removes a portion of the
+# model but the dimension of the data does not change.)
+#
+# The reason we are cutting is to generate a closed polygon at the
+# boundary of the clipping process. The cutter generates line
+# segments, the stripper then puts them together into polylines. We
+# then pull a trick and define polygons using the closed line
+# segements that the stripper created.
+@cutEdges = Vtk::Cutter.new
+@cutEdges.SetInputConnection(cowNormals.GetOutputPort)
+@cutEdges.SetCutFunction(plane)
+@cutEdges.GenerateCutScalarsOn
+@cutEdges.SetValue(0, 0.5)
+@cutStrips = Vtk::Stripper.new
+@cutStrips.SetInputConnection(@cutEdges.GetOutputPort)
+@cutStrips.Update
+@cutPoly = Vtk::PolyData.new
+@cutPoly.SetPoints(@cutStrips.GetOutput.GetPoints)
+@cutPoly.SetPolys(@cutStrips.GetOutput.GetLines)
+
+# Triangle filter is robust enough to ignore the duplicate point at
+# the beginning and end of the polygons and triangulate them.
+cutTriangles = Vtk::TriangleFilter.new
+cutTriangles.SetInput(@cutPoly)
+@cutMapper = Vtk::PolyDataMapper.new
+@cutMapper.SetInput(@cutPoly)
+@cutMapper.SetInputConnection(cutTriangles.GetOutputPort)
+cutActor = Vtk::Actor.new
+cutActor.SetMapper(@cutMapper)
+cutActor.GetProperty.SetColor(Vtk::Colors::Peacock)
+
+# The clipped part of the cow is rendered wireframe.
+restMapper = Vtk::PolyDataMapper.new
+restMapper.SetInput(@clipper.GetClippedOutput)
+restMapper.ScalarVisibilityOff
+restActor = Vtk::Actor.new
+restActor.SetMapper(restMapper)
+restActor.GetProperty.SetRepresentationToWireframe
+
+# Create graphics stuff
+ren = Vtk::Renderer.new
+@renWin = Vtk::RenderWindow.new
+@renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(@renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(clipActor)
+ren.AddActor(cutActor)
+ren.AddActor(restActor)
+ren.SetBackground(1, 1, 1)
+ren.ResetCamera
+ren.GetActiveCamera.Azimuth(30)
+ren.GetActiveCamera.Elevation(30)
+ren.GetActiveCamera.Dolly(1.5)
+ren.ResetCameraClippingRange
+
+@renWin.SetSize(300, 300)
+iren.Initialize
+
+# Lets you move the cut plane back and forth by invoking the function
+# Cut with the appropriate plane value (essentially a distance from
+# the original plane).  This is not used in this code but should give
+# you an idea of how to define a function to do this.
+def Cut(v)
+  @clipper.SetValue(v)
+  @cutEdges.SetValue(0, v)
+  @cutStrips.Update
+  @cutPoly.SetPoints(@cutStrips.GetOutput.GetPoints)
+  @cutPoly.SetPolys(@cutStrips.GetOutput.GetLines)
+  @cutMapper.Update
+  @renWin.Render
+end
+ 
+@renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/ColorIsosurface.rb VTK/Examples/VisualizationAlgorithms/Ruby/ColorIsosurface.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/ColorIsosurface.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/ColorIsosurface.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,77 @@
+#!/usr/bin/env ruby
+
+# This example shows how to color an isosurface with other
+# data. Basically an isosurface is generated, and a data array is
+# selected and used by the mapper to color the surface.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Read some data. The important thing here is to read a function as a
+# data array as well as the scalar and vector.  (here function 153 is
+# named "Velocity Magnitude").Later this data array will be used to
+# color the isosurface.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.AddFunction(153)
+pl3d.Update
+pl3d.DebugOn
+    
+# The contour filter uses the labeled scalar (function number 100
+# above to generate the contour surface; all other data is
+# interpolated during the contouring process.
+iso = Vtk::ContourFilter.new
+iso.SetInputConnection(pl3d.GetOutputPort)
+iso.SetValue(0, 0.24)
+
+normals = Vtk::PolyDataNormals.new
+normals.SetInputConnection(iso.GetOutputPort)
+normals.SetFeatureAngle(45)
+
+# We indicate to the mapper to use the velcoity magnitude, which is a
+# vtkDataArray that makes up part of the point attribute data.
+isoMapper = Vtk::PolyDataMapper.new
+isoMapper.SetInputConnection(normals.GetOutputPort)
+isoMapper.ScalarVisibilityOn
+isoMapper.SetScalarRange(0, 1500)
+isoMapper.SetScalarModeToUsePointFieldData
+isoMapper.ColorByArrayComponent("VelocityMagnitude", 0)
+
+isoActor = Vtk::LODActor.new
+isoActor.SetMapper(isoMapper)
+isoActor.SetNumberOfCloudPoints(1000)
+
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+
+# Create the usual rendering stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(outlineActor)
+ren.AddActor(isoActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(500, 500)
+ren.SetBackground(0.1, 0.2, 0.4)
+
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(3.95297, 50)
+cam1.SetFocalPoint(9.71821, 0.458166, 29.3999)
+cam1.SetPosition(2.7439, -37.3196, 38.7167)
+cam1.SetViewUp(-0.16123, 0.264271, 0.950876)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/CutCombustor.rb VTK/Examples/VisualizationAlgorithms/Ruby/CutCombustor.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/CutCombustor.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/CutCombustor.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,79 @@
+#!/usr/bin/env ruby
+
+# This example shows how to use cutting (vtkCutter) and how it
+# compares with extracting a plane from a computational grid.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Read some data.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# The cutter uses an implicit function to perform the cutting.
+# Here we define a plane, specifying its center and normal.
+# Then we assign the plane to the cutter.
+plane = Vtk::Plane.new
+plane.SetOrigin(pl3d.GetOutput.GetCenter)
+plane.SetNormal(-0.287, 0, 0.9579)
+planeCut = Vtk::Cutter.new
+planeCut.SetInputConnection(pl3d.GetOutputPort)
+planeCut.SetCutFunction(plane)
+cutMapper = Vtk::PolyDataMapper.new
+cutMapper.SetInputConnection(planeCut.GetOutputPort)
+cutMapper.SetScalarRange(pl3d.GetOutput.GetPointData.GetScalars.GetRange)
+cutActor = Vtk::Actor.new
+cutActor.SetMapper(cutMapper)
+
+# Here we extract a computational plane from the structured grid.
+# We render it as wireframe.
+compPlane = Vtk::StructuredGridGeometryFilter.new
+compPlane.SetInputConnection(pl3d.GetOutputPort)
+compPlane.SetExtent(0, 100, 0, 100, 9, 9)
+planeMapper = Vtk::PolyDataMapper.new
+planeMapper.SetInputConnection(compPlane.GetOutputPort)
+planeMapper.ScalarVisibilityOff
+planeActor = Vtk::Actor.new
+planeActor.SetMapper(planeMapper)
+planeActor.GetProperty.SetRepresentationToWireframe
+planeActor.GetProperty.SetColor(0, 0, 0)
+
+# The outline of the data puts the data in context.
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineProp = outlineActor.GetProperty
+outlineProp.SetColor(0, 0, 0)
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(outlineActor)
+ren.AddActor(planeActor)
+ren.AddActor(cutActor)
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(400, 300)
+
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(11.1034, 59.5328)
+cam1.SetFocalPoint(9.71821, 0.458166, 29.3999)
+cam1.SetPosition(-2.95748, -26.7271, 44.5309)
+cam1.SetViewUp(0.0184785, 0.479657, 0.877262)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/deciFran.rb VTK/Examples/VisualizationAlgorithms/Ruby/deciFran.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/deciFran.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/deciFran.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+
+# This example shows how to use decimation to reduce a polygonal
+# mesh. We also use mesh smoothing and generate surface normals to
+# give a pleasing result.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# We start by reading some data that was originally captured from a
+# Cyberware laser digitizing system.
+fran = Vtk::PolyDataReader.new
+fran.SetFileName(VTK_DATA_ROOT + "/Data/fran_cut.vtk")
+
+# We want to preserve topology (not let any cracks form). This may
+# limit the total reduction possible, which we have specified at 90%.
+deci = Vtk::DecimatePro.new
+deci.SetInputConnection(fran.GetOutputPort)
+deci.SetTargetReduction(0.9)
+deci.PreserveTopologyOn
+normals = Vtk::PolyDataNormals.new
+normals.SetInputConnection(fran.GetOutputPort)
+normals.FlipNormalsOn
+franMapper = Vtk::PolyDataMapper.new
+franMapper.SetInputConnection(normals.GetOutputPort)
+franActor = Vtk::Actor.new
+franActor.SetMapper(franMapper)
+franActor.GetProperty.SetColor(1.0, 0.49, 0.25)
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(franActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(250, 250)
+
+cam1 = Vtk::Camera.new
+cam1.SetClippingRange(0.0475572, 2.37786)
+cam1.SetFocalPoint(0.052665, -0.129454, -0.0573973)
+cam1.SetPosition(0.327637, -0.116299, -0.256418)
+cam1.SetViewUp(-0.0225386, 0.999137, 0.034901)
+ren.SetActiveCamera(cam1)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/DepthSort.rb VTK/Examples/VisualizationAlgorithms/Ruby/DepthSort.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/DepthSort.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/DepthSort.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,90 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of vtkDepthSortPolyData. This is a
+# poor man's algorithm to sort polygons for proper transparent
+# blending.  It sorts polygons based on a single point (i.e.,
+# centroid) so the sorting may not work for overlapping or
+# intersection polygons.
+
+require 'vtk'
+
+# Create a bunch of spheres that overlap and cannot be easily arranged
+# so that the blending works without sorting. They are appended into a
+# single vtkPolyData because the filter only sorts within a single
+# vtkPolyData input.
+sphere = Vtk::SphereSource.new
+sphere.SetThetaResolution(80)
+sphere.SetPhiResolution(40)
+sphere.SetRadius(1)
+sphere.SetCenter(0, 0, 0)
+sphere2 = Vtk::SphereSource.new
+sphere2.SetThetaResolution(80)
+sphere2.SetPhiResolution(40)
+sphere2.SetRadius(0.5)
+sphere2.SetCenter(1, 0, 0)
+sphere3 = Vtk::SphereSource.new
+sphere3.SetThetaResolution(80)
+sphere3.SetPhiResolution(40)
+sphere3.SetRadius(0.5)
+sphere3.SetCenter(-1, 0, 0)
+sphere4 = Vtk::SphereSource.new
+sphere4.SetThetaResolution(80)
+sphere4.SetPhiResolution(40)
+sphere4.SetRadius(0.5)
+sphere4.SetCenter(0, 1, 0)
+sphere5 = Vtk::SphereSource.new
+sphere5.SetThetaResolution(80)
+sphere5.SetPhiResolution(40)
+sphere5.SetRadius(0.5)
+sphere5.SetCenter(0, -1, 0)
+appendData = Vtk::AppendPolyData.new
+appendData.AddInput(sphere.GetOutput)
+appendData.AddInput(sphere2.GetOutput)
+appendData.AddInput(sphere3.GetOutput)
+appendData.AddInput(sphere4.GetOutput)
+appendData.AddInput(sphere5.GetOutput)
+
+# The dephSort object is set up to generate scalars representing
+# the sort depth.  A camera is assigned for the sorting. The camera
+# define the sort vector (position and focal point).
+camera = Vtk::Camera.new
+depthSort = Vtk::DepthSortPolyData.new
+depthSort.SetInputConnection(appendData.GetOutputPort)
+depthSort.SetDirectionToBackToFront
+depthSort.SetVector(1, 1, 1)
+depthSort.SetCamera(camera)
+depthSort.SortScalarsOn
+depthSort.Update
+
+mapper = Vtk::PolyDataMapper.new
+mapper.SetInputConnection(depthSort.GetOutputPort)
+mapper.SetScalarRange(0, depthSort.GetOutput.GetNumberOfCells)
+actor = Vtk::Actor.new
+actor.SetMapper(mapper)
+actor.GetProperty.SetOpacity(0.5)
+actor.GetProperty.SetColor(1, 0, 0)
+actor.RotateX(-72)
+
+# If an Prop3D is supplied, then its transformation matrix is taken
+# into account during sorting.
+depthSort.SetProp3D(actor)
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+ren.SetActiveCamera(camera)
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(actor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(300, 200)
+
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(2.2)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/ExtractGeometry.rb VTK/Examples/VisualizationAlgorithms/Ruby/ExtractGeometry.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/ExtractGeometry.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/ExtractGeometry.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,73 @@
+#!/usr/bin/env ruby
+
+# This example shows how to extract a piece of a dataset using an
+# implicit function. In this case the implicit function is formed by
+# the boolean combination of two ellipsoids.
+
+require 'vtk'
+
+# Here we create two ellipsoidal implicit functions and boolean them
+# together tto form a "cross" shaped implicit function.
+quadric = Vtk::Quadric.new
+quadric.SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0)
+sample = Vtk::SampleFunction.new
+sample.SetSampleDimensions(50, 50, 50)
+sample.SetImplicitFunction(quadric)
+sample.ComputeNormalsOff
+trans = Vtk::Transform.new
+trans.Scale(1, 0.5, 0.333)
+sphere = Vtk::Sphere.new
+sphere.SetRadius(0.25)
+sphere.SetTransform(trans)
+trans2 = Vtk::Transform.new
+trans2.Scale(0.25, 0.5, 1.0)
+sphere2 = Vtk::Sphere.new
+sphere2.SetRadius(0.25)
+sphere2.SetTransform(trans2)
+union = Vtk::ImplicitBoolean.new
+union.AddFunction(sphere)
+union.AddFunction(sphere2)
+union.SetOperationType(0) #union
+
+# Here is where it gets interesting. The implicit function is used to
+# extract those cells completely inside the function. They are then 
+# shrunk to help show what was extracted.
+extract = Vtk::ExtractGeometry.new
+extract.SetInputConnection(sample.GetOutputPort)
+extract.SetImplicitFunction(union)
+shrink = Vtk::ShrinkFilter.new
+shrink.SetInputConnection(extract.GetOutputPort)
+shrink.SetShrinkFactor(0.5)
+dataMapper = Vtk::DataSetMapper.new
+dataMapper.SetInputConnection(shrink.GetOutputPort)
+dataActor = Vtk::Actor.new
+dataActor.SetMapper(dataMapper)
+
+# The outline gives context to the original data.
+outline = Vtk::OutlineFilter.new
+outline.SetInputConnection(sample.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineProp = outlineActor.GetProperty
+outlineProp.SetColor(0, 0, 0)
+
+# The usual rendering stuff is created.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(outlineActor)
+ren.AddActor(dataActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(500, 500)
+ren.ResetCamera
+ren.GetActiveCamera.Zoom(1.5)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/ExtractUGrid.rb VTK/Examples/VisualizationAlgorithms/Ruby/ExtractUGrid.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/ExtractUGrid.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/ExtractUGrid.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,92 @@
+#!/usr/bin/env ruby
+
+# This example shows how to extract portions of an unstructured grid
+# using vtkExtractUnstructuredGrid. vtkConnectivityFilter is also used
+# to extract connected components.
+#
+# The data found here represents a blow molding process. Blow molding
+# requires a mold and parison (hot, viscous plastic) which is shaped
+# by the mold into the final form. The data file contains several steps
+# in time for the analysis.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create a reader to read the unstructured grid data. We use a
+# vtkDataSetReader which means the type of the output is unknown until
+# the data file is read. So we follow the reader with a
+# vtkCastToConcrete and cast the output to vtkUnstructuredGrid.
+reader = Vtk::DataSetReader.new
+reader.SetFileName(VTK_DATA_ROOT + "/Data/blow.vtk")
+reader.SetScalarsName("thickness9")
+reader.SetVectorsName("displacement9")
+castToUnstructuredGrid = Vtk::CastToConcrete.new
+castToUnstructuredGrid.SetInputConnection(reader.GetOutputPort)
+warp = Vtk::WarpVector.new
+warp.SetInput(castToUnstructuredGrid.GetUnstructuredGridOutput)
+
+# The connectivity filter extracts the first two regions. These are
+# know to represent the mold.
+connect = Vtk::ConnectivityFilter.new
+connect.SetInputConnection(warp.GetOutputPort)
+connect.SetExtractionModeToSpecifiedRegions
+connect.AddSpecifiedRegion(0)
+connect.AddSpecifiedRegion(1)
+moldMapper = Vtk::DataSetMapper.new
+moldMapper.SetInputConnection(reader.GetOutputPort)
+moldMapper.ScalarVisibilityOff
+moldActor = Vtk::Actor.new
+moldActor.SetMapper(moldMapper)
+moldActor.GetProperty.SetColor(0.2, 0.2, 0.2)
+moldActor.GetProperty.SetRepresentationToWireframe
+
+# Another connectivity filter is used to extract the parison.
+connect2 = Vtk::ConnectivityFilter.new
+connect2.SetInputConnection(warp.GetOutputPort)
+connect2.SetExtractionModeToSpecifiedRegions
+connect2.AddSpecifiedRegion(2)
+
+# We use vtkExtractUnstructuredGrid because we are interested in
+# looking at just a few cells. We use cell clipping via cell id to
+# extract the portion of the grid we are interested in.
+extractGrid = Vtk::ExtractUnstructuredGrid.new
+extractGrid.SetInputConnection(connect2.GetOutputPort)
+extractGrid.CellClippingOn
+extractGrid.SetCellMinimum(0)
+extractGrid.SetCellMaximum(23)
+parison = Vtk::GeometryFilter.new
+parison.SetInputConnection(extractGrid.GetOutputPort)
+normals2 = Vtk::PolyDataNormals.new
+normals2.SetInputConnection(parison.GetOutputPort)
+normals2.SetFeatureAngle(60)
+lut = Vtk::LookupTable.new
+lut.SetHueRange(0.0, 0.66667)
+parisonMapper = Vtk::PolyDataMapper.new
+parisonMapper.SetInputConnection(normals2.GetOutputPort)
+parisonMapper.SetLookupTable(lut)
+parisonMapper.SetScalarRange(0.12, 1.0)
+parisonActor = Vtk::Actor.new
+parisonActor.SetMapper(parisonMapper)
+
+# graphics stuff
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(parisonActor)
+ren.AddActor(moldActor)
+ren.SetBackground(1, 1, 1)
+ren.ResetCamera
+ren.GetActiveCamera.Azimuth(60)
+ren.GetActiveCamera.Roll(-90)
+ren.GetActiveCamera.Dolly(2)
+ren.ResetCameraClippingRange
+renWin.SetSize(500, 375)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/GenerateTextureCoords.rb VTK/Examples/VisualizationAlgorithms/Ruby/GenerateTextureCoords.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/GenerateTextureCoords.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/GenerateTextureCoords.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,65 @@
+#!/usr/bin/env ruby
+
+# This example shows how to generate and manipulate texture coordinates.
+# A random cloud of points is generated and then triangulated with 
+# vtkDelaunay3D. Since these points do not have texture coordinates,
+# we generate them with vtkTextureMapToCylinder.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Begin by generating 25 random points in the unit sphere.
+sphere = Vtk::PointSource.new
+sphere.SetNumberOfPoints(25)
+
+# Triangulate the points with vtkDelaunay3D. This generates a convex hull
+# of tetrahedron.
+delny = Vtk::Delaunay3D.new
+delny.SetInputConnection(sphere.GetOutputPort)
+delny.SetTolerance(0.01)
+    
+# The triangulation has texture coordinates generated so we can map
+# a texture onto it.
+tmapper = Vtk::TextureMapToCylinder.new
+tmapper.SetInputConnection(delny.GetOutputPort)
+tmapper.PreventSeamOn
+
+# We scale the texture coordinate to get some repeat patterns.
+xform = Vtk::TransformTextureCoords.new
+xform.SetInputConnection(tmapper.GetOutputPort)
+xform.SetScale(4, 4, 1)
+
+# vtkDataSetMapper internally uses a vtkGeometryFilter to extract the
+# surface from the triangulation. The output (which is vtkPolyData) is
+# then passed to an internal vtkPolyDataMapper which does the
+# rendering.
+mapper = Vtk::DataSetMapper.new
+mapper.SetInputConnection(xform.GetOutputPort)
+
+# A texture is loaded using an image reader. Textures are simply images.
+# The texture is eventually associated with an actor.
+bmpReader = Vtk::BMPReader.new
+bmpReader.SetFileName(VTK_DATA_ROOT + "/Data/masonry.bmp")
+atext = Vtk::Texture.new
+atext.SetInputConnection(bmpReader.GetOutputPort)
+atext.InterpolateOn
+triangulation = Vtk::Actor.new
+triangulation.SetMapper(mapper)
+triangulation.SetTexture(atext)
+
+# Create the standard rendering stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(triangulation)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(300, 300)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/imageWarp.rb VTK/Examples/VisualizationAlgorithms/Ruby/imageWarp.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/imageWarp.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/imageWarp.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,58 @@
+#!/usr/bin/env ruby
+
+# This example shows how to combine data from both the imaging and
+# graphics pipelines. The vtkMergeFilter is used to merge the data
+# from each together.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Read in an image and compute a luminance value. The image is
+# extracted as a set of polygons (vtkImageDataGeometryFilter). We then
+# will warp the plane using the scalar (luminance) values.
+reader = Vtk::BMPReader.new
+reader.SetFileName(VTK_DATA_ROOT + "/Data/masonry.bmp")
+luminance = Vtk::ImageLuminance.new
+luminance.SetInputConnection(reader.GetOutputPort)
+geometry = Vtk::ImageDataGeometryFilter.new
+geometry.SetInputConnection(luminance.GetOutputPort)
+warp = Vtk::WarpScalar.new
+warp.SetInputConnection(geometry.GetOutputPort)
+warp.SetScaleFactor(-0.1)
+
+# Use vtkMergeFilter to combine the original image with the warped
+# geometry.
+merge = Vtk::MergeFilter.new
+merge.SetGeometry(warp.GetOutput)
+merge.SetScalars(reader.GetOutput)
+mapper = Vtk::DataSetMapper.new
+mapper.SetInputConnection(merge.GetOutputPort)
+mapper.SetScalarRange(0, 255)
+mapper.ImmediateModeRenderingOff
+actor = Vtk::Actor.new
+actor.SetMapper(mapper)
+
+# Create renderer stuff
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(actor)
+ren.ResetCamera
+ren.GetActiveCamera.Azimuth(20)
+ren.GetActiveCamera.Elevation(30)
+ren.SetBackground(0.1, 0.2, 0.4)
+ren.ResetCameraClippingRange
+
+renWin.SetSize(250, 250)
+
+cam1 = ren.GetActiveCamera
+cam1.Zoom(1.4)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/officeTube.rb VTK/Examples/VisualizationAlgorithms/Ruby/officeTube.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/officeTube.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/officeTube.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,302 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of a single streamline and the
+# tube filter to create a streamtube.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# We read a data file the is a CFD analysis of airflow in an office
+# (with ventilation and a burning cigarette). We force an update so
+# that we can query the output for its length, i.e., the length of the
+# diagonal of the bounding box. This is useful for normalizing the
+# data.
+reader = Vtk::StructuredGridReader.new
+reader.SetFileName(VTK_DATA_ROOT + "/Data/office.binary.vtk")
+reader.Update
+
+length = reader.GetOutput.GetLength
+
+maxVelocity =reader.GetOutput.GetPointData.GetVectors.GetMaxNorm
+maxTime = 35.0*length/maxVelocity
+
+# Now we will generate a single streamline in the data. We select the
+# integration order to use (RungeKutta order 4) and associate it with
+# the streamer. The start position is the position in world space
+# where we want to begin streamline integration; and we integrate in
+# both directions. The step length is the length of the line segments
+# that make up the streamline (i.e., related to display). The
+# IntegrationStepLength specifies the integration step length as a
+# fraction of the cell size that the streamline is in.
+integ = Vtk::RungeKutta4.new
+streamer = Vtk::StreamLine.new
+streamer.SetInputConnection(reader.GetOutputPort)
+streamer.SetStartPosition(0.1, 2.1, 0.5)
+streamer.SetMaximumPropagationTime(500)
+streamer.SetStepLength(0.5)
+streamer.SetIntegrationStepLength(0.05)
+streamer.SetIntegrationDirectionToIntegrateBothDirections
+streamer.SetIntegrator(integ)
+
+# The tube is wrapped around the generated streamline. By varying the
+# radius by the inverse of vector magnitude, we are creating a tube
+# whose radius is proportional to mass flux (in incompressible flow).
+streamTube = Vtk::TubeFilter.new
+streamTube.SetInputConnection(streamer.GetOutputPort)
+streamTube.SetRadius(0.02)
+streamTube.SetNumberOfSides(12)
+streamTube.SetVaryRadiusToVaryRadiusByVector
+mapStreamTube = Vtk::PolyDataMapper.new
+mapStreamTube.SetInputConnection(streamTube.GetOutputPort)
+mapStreamTube.SetScalarRange(reader.GetOutput.GetPointData.GetScalars.GetRange)
+streamTubeActor = Vtk::Actor.new
+streamTubeActor.SetMapper(mapStreamTube)
+streamTubeActor.GetProperty.BackfaceCullingOn
+
+# From here on we generate a whole bunch of planes which correspond to
+# the geometry in the analysis; tables, bookshelves and so on.
+table1 = Vtk::StructuredGridGeometryFilter.new
+table1.SetInputConnection(reader.GetOutputPort)
+table1.SetExtent(11, 15, 7, 9, 8, 8)
+mapTable1 = Vtk::PolyDataMapper.new
+mapTable1.SetInputConnection(table1.GetOutputPort)
+mapTable1.ScalarVisibilityOff
+table1Actor = Vtk::Actor.new
+table1Actor.SetMapper(mapTable1)
+table1Actor.GetProperty.SetColor(0.59, 0.427, 0.392)
+
+table2 = Vtk::StructuredGridGeometryFilter.new
+table2.SetInputConnection(reader.GetOutputPort)
+table2.SetExtent(11, 15, 10, 12, 8, 8)
+mapTable2 = Vtk::PolyDataMapper.new
+mapTable2.SetInputConnection(table2.GetOutputPort)
+mapTable2.ScalarVisibilityOff
+table2Actor = Vtk::Actor.new
+table2Actor.SetMapper(mapTable2)
+table2Actor.GetProperty.SetColor(0.59, 0.427, 0.392)
+
+FilingCabinet1 = Vtk::StructuredGridGeometryFilter.new
+FilingCabinet1.SetInputConnection(reader.GetOutputPort)
+FilingCabinet1.SetExtent(15, 15, 7, 9, 0, 8)
+mapFilingCabinet1 = Vtk::PolyDataMapper.new
+mapFilingCabinet1.SetInputConnection(FilingCabinet1.GetOutputPort)
+mapFilingCabinet1.ScalarVisibilityOff
+FilingCabinet1Actor = Vtk::Actor.new
+FilingCabinet1Actor.SetMapper(mapFilingCabinet1)
+FilingCabinet1Actor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+FilingCabinet2 = Vtk::StructuredGridGeometryFilter.new
+FilingCabinet2.SetInputConnection(reader.GetOutputPort)
+FilingCabinet2.SetExtent(15, 15, 10, 12, 0, 8)
+mapFilingCabinet2 = Vtk::PolyDataMapper.new
+mapFilingCabinet2.SetInputConnection(FilingCabinet2.GetOutputPort)
+mapFilingCabinet2.ScalarVisibilityOff
+FilingCabinet2Actor = Vtk::Actor.new
+FilingCabinet2Actor.SetMapper(mapFilingCabinet2)
+FilingCabinet2Actor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1Top = Vtk::StructuredGridGeometryFilter.new
+bookshelf1Top.SetInputConnection(reader.GetOutputPort)
+bookshelf1Top.SetExtent(13, 13, 0, 4, 0, 11)
+mapBookshelf1Top = Vtk::PolyDataMapper.new
+mapBookshelf1Top.SetInputConnection(bookshelf1Top.GetOutputPort)
+mapBookshelf1Top.ScalarVisibilityOff
+bookshelf1TopActor = Vtk::Actor.new
+bookshelf1TopActor.SetMapper(mapBookshelf1Top)
+bookshelf1TopActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1Bottom = Vtk::StructuredGridGeometryFilter.new
+bookshelf1Bottom.SetInputConnection(reader.GetOutputPort)
+bookshelf1Bottom.SetExtent(20, 20, 0, 4, 0, 11)
+mapBookshelf1Bottom = Vtk::PolyDataMapper.new
+mapBookshelf1Bottom.SetInputConnection(bookshelf1Bottom.GetOutputPort)
+mapBookshelf1Bottom.ScalarVisibilityOff
+bookshelf1BottomActor = Vtk::Actor.new
+bookshelf1BottomActor.SetMapper(mapBookshelf1Bottom)
+bookshelf1BottomActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1Front = Vtk::StructuredGridGeometryFilter.new
+bookshelf1Front.SetInputConnection(reader.GetOutputPort)
+bookshelf1Front.SetExtent(13, 20, 0, 0, 0, 11)
+mapBookshelf1Front = Vtk::PolyDataMapper.new
+mapBookshelf1Front.SetInputConnection(bookshelf1Front.GetOutputPort)
+mapBookshelf1Front.ScalarVisibilityOff
+bookshelf1FrontActor = Vtk::Actor.new
+bookshelf1FrontActor.SetMapper(mapBookshelf1Front)
+bookshelf1FrontActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1Back = Vtk::StructuredGridGeometryFilter.new
+bookshelf1Back.SetInputConnection(reader.GetOutputPort)
+bookshelf1Back.SetExtent(13, 20, 4, 4, 0, 11)
+mapBookshelf1Back = Vtk::PolyDataMapper.new
+mapBookshelf1Back.SetInputConnection(bookshelf1Back.GetOutputPort)
+mapBookshelf1Back.ScalarVisibilityOff
+bookshelf1BackActor = Vtk::Actor.new
+bookshelf1BackActor.SetMapper(mapBookshelf1Back)
+bookshelf1BackActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1LHS = Vtk::StructuredGridGeometryFilter.new
+bookshelf1LHS.SetInputConnection(reader.GetOutputPort)
+bookshelf1LHS.SetExtent(13, 20, 0, 4, 0, 0)
+mapBookshelf1LHS = Vtk::PolyDataMapper.new
+mapBookshelf1LHS.SetInputConnection(bookshelf1LHS.GetOutputPort)
+mapBookshelf1LHS.ScalarVisibilityOff
+bookshelf1LHSActor = Vtk::Actor.new
+bookshelf1LHSActor.SetMapper(mapBookshelf1LHS)
+bookshelf1LHSActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1RHS = Vtk::StructuredGridGeometryFilter.new
+bookshelf1RHS.SetInputConnection(reader.GetOutputPort)
+bookshelf1RHS.SetExtent(13, 20, 0, 4, 11, 11)
+mapBookshelf1RHS = Vtk::PolyDataMapper.new
+mapBookshelf1RHS.SetInputConnection(bookshelf1RHS.GetOutputPort)
+mapBookshelf1RHS.ScalarVisibilityOff
+bookshelf1RHSActor = Vtk::Actor.new
+bookshelf1RHSActor.SetMapper(mapBookshelf1RHS)
+bookshelf1RHSActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2Top = Vtk::StructuredGridGeometryFilter.new
+bookshelf2Top.SetInputConnection(reader.GetOutputPort)
+bookshelf2Top.SetExtent(13, 13, 15, 19, 0, 11)
+mapBookshelf2Top = Vtk::PolyDataMapper.new
+mapBookshelf2Top.SetInputConnection(bookshelf2Top.GetOutputPort)
+mapBookshelf2Top.ScalarVisibilityOff
+bookshelf2TopActor = Vtk::Actor.new
+bookshelf2TopActor.SetMapper(mapBookshelf2Top)
+bookshelf2TopActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2Bottom = Vtk::StructuredGridGeometryFilter.new
+bookshelf2Bottom.SetInputConnection(reader.GetOutputPort)
+bookshelf2Bottom.SetExtent(20, 20, 15, 19, 0, 11)
+mapBookshelf2Bottom = Vtk::PolyDataMapper.new
+mapBookshelf2Bottom.SetInputConnection(bookshelf2Bottom.GetOutputPort)
+mapBookshelf2Bottom.ScalarVisibilityOff
+bookshelf2BottomActor = Vtk::Actor.new
+bookshelf2BottomActor.SetMapper(mapBookshelf2Bottom)
+bookshelf2BottomActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2Front = Vtk::StructuredGridGeometryFilter.new
+bookshelf2Front.SetInputConnection(reader.GetOutputPort)
+bookshelf2Front.SetExtent(13, 20, 15, 15, 0, 11)
+mapBookshelf2Front = Vtk::PolyDataMapper.new
+mapBookshelf2Front.SetInputConnection(bookshelf2Front.GetOutputPort)
+mapBookshelf2Front.ScalarVisibilityOff
+bookshelf2FrontActor = Vtk::Actor.new
+bookshelf2FrontActor.SetMapper(mapBookshelf2Front)
+bookshelf2FrontActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2Back = Vtk::StructuredGridGeometryFilter.new
+bookshelf2Back.SetInputConnection(reader.GetOutputPort)
+bookshelf2Back.SetExtent(13, 20, 19, 19, 0, 11)
+mapBookshelf2Back = Vtk::PolyDataMapper.new
+mapBookshelf2Back.SetInputConnection(bookshelf2Back.GetOutputPort)
+mapBookshelf2Back.ScalarVisibilityOff
+bookshelf2BackActor = Vtk::Actor.new
+bookshelf2BackActor.SetMapper(mapBookshelf2Back)
+bookshelf2BackActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2LHS = Vtk::StructuredGridGeometryFilter.new
+bookshelf2LHS.SetInputConnection(reader.GetOutputPort)
+bookshelf2LHS.SetExtent(13, 20, 15, 19, 0, 0)
+mapBookshelf2LHS = Vtk::PolyDataMapper.new
+mapBookshelf2LHS.SetInputConnection(bookshelf2LHS.GetOutputPort)
+mapBookshelf2LHS.ScalarVisibilityOff
+bookshelf2LHSActor = Vtk::Actor.new
+bookshelf2LHSActor.SetMapper(mapBookshelf2LHS)
+bookshelf2LHSActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2RHS = Vtk::StructuredGridGeometryFilter.new
+bookshelf2RHS.SetInputConnection(reader.GetOutputPort)
+bookshelf2RHS.SetExtent(13, 20, 15, 19, 11, 11)
+mapBookshelf2RHS = Vtk::PolyDataMapper.new
+mapBookshelf2RHS.SetInputConnection(bookshelf2RHS.GetOutputPort)
+mapBookshelf2RHS.ScalarVisibilityOff
+bookshelf2RHSActor = Vtk::Actor.new
+bookshelf2RHSActor.SetMapper(mapBookshelf2RHS)
+bookshelf2RHSActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+window = Vtk::StructuredGridGeometryFilter.new
+window.SetInputConnection(reader.GetOutputPort)
+window.SetExtent(20, 20, 6, 13, 10, 13)
+mapWindow = Vtk::PolyDataMapper.new
+mapWindow.SetInputConnection(window.GetOutputPort)
+mapWindow.ScalarVisibilityOff
+windowActor = Vtk::Actor.new
+windowActor.SetMapper(mapWindow)
+windowActor.GetProperty.SetColor(0.3, 0.3, 0.5)
+
+outlet = Vtk::StructuredGridGeometryFilter.new
+outlet.SetInputConnection(reader.GetOutputPort)
+outlet.SetExtent(0, 0, 9, 10, 14, 16)
+mapOutlet = Vtk::PolyDataMapper.new
+mapOutlet.SetInputConnection(outlet.GetOutputPort)
+mapOutlet.ScalarVisibilityOff
+outletActor = Vtk::Actor.new
+outletActor.SetMapper(mapOutlet)
+outletActor.GetProperty.SetColor(0, 0, 0)
+
+inlet = Vtk::StructuredGridGeometryFilter.new
+inlet.SetInputConnection(reader.GetOutputPort)
+inlet.SetExtent(0, 0, 9, 10, 0, 6)
+mapInlet = Vtk::PolyDataMapper.new
+mapInlet.SetInputConnection(inlet.GetOutputPort)
+mapInlet.ScalarVisibilityOff
+inletActor = Vtk::Actor.new
+inletActor.SetMapper(mapInlet)
+inletActor.GetProperty.SetColor(0, 0, 0)
+
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(reader.GetOutputPort)
+mapOutline = Vtk::PolyDataMapper.new
+mapOutline.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(mapOutline)
+outlineActor.GetProperty.SetColor(0, 0, 0)
+
+# Now create the usual graphics stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+ren.AddActor(table1Actor)
+ren.AddActor(table2Actor)
+ren.AddActor(FilingCabinet1Actor)
+ren.AddActor(FilingCabinet2Actor)
+ren.AddActor(bookshelf1TopActor)
+ren.AddActor(bookshelf1BottomActor)
+ren.AddActor(bookshelf1FrontActor)
+ren.AddActor(bookshelf1BackActor)
+ren.AddActor(bookshelf1LHSActor)
+ren.AddActor(bookshelf1RHSActor)
+ren.AddActor(bookshelf2TopActor)
+ren.AddActor(bookshelf2BottomActor)
+ren.AddActor(bookshelf2FrontActor)
+ren.AddActor(bookshelf2BackActor)
+ren.AddActor(bookshelf2LHSActor)
+ren.AddActor(bookshelf2RHSActor)
+ren.AddActor(windowActor)
+ren.AddActor(outletActor)
+ren.AddActor(inletActor)
+ren.AddActor(outlineActor)
+ren.AddActor(streamTubeActor)
+
+ren.SetBackground(Vtk::Colors::Slate_grey)
+
+# Here we specify a particular view.
+aCamera = Vtk::Camera.new
+aCamera.SetClippingRange(0.726079, 36.3039)
+aCamera.SetFocalPoint(2.43584, 2.15046, 1.11104)
+aCamera.SetPosition(-4.76183, -10.4426, 3.17203)
+aCamera.SetViewUp(0.0511273, 0.132773, 0.989827)
+aCamera.SetViewAngle(18.604)
+aCamera.Zoom(1.2)
+
+ren.SetActiveCamera(aCamera)
+renWin.SetSize(500, 300)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/officeTubes.rb VTK/Examples/VisualizationAlgorithms/Ruby/officeTubes.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/officeTubes.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/officeTubes.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,310 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of streamlines generated from seeds, 
+# combined with a tube filter to create several streamtubes.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# We read a data file the is a CFD analysis of airflow in an office
+# (with ventilation and a burning cigarette). We force an update so
+# that we can query the output for its length, i.e., the length of the
+# diagonal of the bounding box. This is useful for normalizing the
+# data.
+reader = Vtk::StructuredGridReader.new
+reader.SetFileName(VTK_DATA_ROOT + "/Data/office.binary.vtk")
+reader.Update
+
+length = reader.GetOutput.GetLength
+
+maxVelocity =reader.GetOutput.GetPointData.GetVectors.GetMaxNorm
+maxTime = 35.0*length/maxVelocity
+
+# Now we will generate multiple streamlines in the data. We create a
+# random cloud of points and then use those as integration seeds. We
+# select the integration order to use (RungeKutta order 4) and
+# associate it with the streamer. The start position is the position
+# in world space where we want to begin streamline integration; and we
+# integrate in both directions. The step length is the length of the
+# line segments that make up the streamline (i.e., related to
+# display). The IntegrationStepLength specifies the integration step
+# length as a fraction of the cell size that the streamline is in.
+
+# Create source for streamtubes
+seeds = Vtk::PointSource.new
+seeds.SetRadius(0.15)
+seeds.SetCenter(0.1, 2.1, 0.5)
+seeds.SetNumberOfPoints(6)
+
+integ = Vtk::RungeKutta4.new
+streamer = Vtk::StreamLine.new
+streamer.SetInputConnection(reader.GetOutputPort)
+streamer.SetSource(seeds.GetOutput)
+streamer.SetMaximumPropagationTime(500)
+streamer.SetStepLength(0.5)
+streamer.SetIntegrationStepLength(0.05)
+streamer.SetIntegrationDirectionToIntegrateBothDirections
+streamer.SetIntegrator(integ)
+
+# The tube is wrapped around the generated streamline. By varying the
+# radius by the inverse of vector magnitude, we are creating a tube
+# whose radius is proportional to mass flux (in incompressible flow).
+streamTube = Vtk::TubeFilter.new
+streamTube.SetInputConnection(streamer.GetOutputPort)
+streamTube.SetRadius(0.02)
+streamTube.SetNumberOfSides(12)
+streamTube.SetVaryRadiusToVaryRadiusByVector
+mapStreamTube = Vtk::PolyDataMapper.new
+mapStreamTube.SetInputConnection(streamTube.GetOutputPort)
+mapStreamTube.SetScalarRange(reader.GetOutput.GetPointData.GetScalars.GetRange)
+streamTubeActor = Vtk::Actor.new
+streamTubeActor.SetMapper(mapStreamTube)
+streamTubeActor.GetProperty.BackfaceCullingOn
+
+# From here on we generate a whole bunch of planes which correspond to
+# the geometry in the analysis; tables, bookshelves and so on.
+table1 = Vtk::StructuredGridGeometryFilter.new
+table1.SetInputConnection(reader.GetOutputPort)
+table1.SetExtent(11, 15, 7, 9, 8, 8)
+mapTable1 = Vtk::PolyDataMapper.new
+mapTable1.SetInputConnection(table1.GetOutputPort)
+mapTable1.ScalarVisibilityOff
+table1Actor = Vtk::Actor.new
+table1Actor.SetMapper(mapTable1)
+table1Actor.GetProperty.SetColor(0.59, 0.427, 0.392)
+
+table2 = Vtk::StructuredGridGeometryFilter.new
+table2.SetInputConnection(reader.GetOutputPort)
+table2.SetExtent(11, 15, 10, 12, 8, 8)
+mapTable2 = Vtk::PolyDataMapper.new
+mapTable2.SetInputConnection(table2.GetOutputPort)
+mapTable2.ScalarVisibilityOff
+table2Actor = Vtk::Actor.new
+table2Actor.SetMapper(mapTable2)
+table2Actor.GetProperty.SetColor(0.59, 0.427, 0.392)
+
+FilingCabinet1 = Vtk::StructuredGridGeometryFilter.new
+FilingCabinet1.SetInputConnection(reader.GetOutputPort)
+FilingCabinet1.SetExtent(15, 15, 7, 9, 0, 8)
+mapFilingCabinet1 = Vtk::PolyDataMapper.new
+mapFilingCabinet1.SetInputConnection(FilingCabinet1.GetOutputPort)
+mapFilingCabinet1.ScalarVisibilityOff
+FilingCabinet1Actor = Vtk::Actor.new
+FilingCabinet1Actor.SetMapper(mapFilingCabinet1)
+FilingCabinet1Actor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+FilingCabinet2 = Vtk::StructuredGridGeometryFilter.new
+FilingCabinet2.SetInputConnection(reader.GetOutputPort)
+FilingCabinet2.SetExtent(15, 15, 10, 12, 0, 8)
+mapFilingCabinet2 = Vtk::PolyDataMapper.new
+mapFilingCabinet2.SetInputConnection(FilingCabinet2.GetOutputPort)
+mapFilingCabinet2.ScalarVisibilityOff
+FilingCabinet2Actor = Vtk::Actor.new
+FilingCabinet2Actor.SetMapper(mapFilingCabinet2)
+FilingCabinet2Actor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1Top = Vtk::StructuredGridGeometryFilter.new
+bookshelf1Top.SetInputConnection(reader.GetOutputPort)
+bookshelf1Top.SetExtent(13, 13, 0, 4, 0, 11)
+mapBookshelf1Top = Vtk::PolyDataMapper.new
+mapBookshelf1Top.SetInputConnection(bookshelf1Top.GetOutputPort)
+mapBookshelf1Top.ScalarVisibilityOff
+bookshelf1TopActor = Vtk::Actor.new
+bookshelf1TopActor.SetMapper(mapBookshelf1Top)
+bookshelf1TopActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1Bottom = Vtk::StructuredGridGeometryFilter.new
+bookshelf1Bottom.SetInputConnection(reader.GetOutputPort)
+bookshelf1Bottom.SetExtent(20, 20, 0, 4, 0, 11)
+mapBookshelf1Bottom = Vtk::PolyDataMapper.new
+mapBookshelf1Bottom.SetInputConnection(bookshelf1Bottom.GetOutputPort)
+mapBookshelf1Bottom.ScalarVisibilityOff
+bookshelf1BottomActor = Vtk::Actor.new
+bookshelf1BottomActor.SetMapper(mapBookshelf1Bottom)
+bookshelf1BottomActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1Front = Vtk::StructuredGridGeometryFilter.new
+bookshelf1Front.SetInputConnection(reader.GetOutputPort)
+bookshelf1Front.SetExtent(13, 20, 0, 0, 0, 11)
+mapBookshelf1Front = Vtk::PolyDataMapper.new
+mapBookshelf1Front.SetInputConnection(bookshelf1Front.GetOutputPort)
+mapBookshelf1Front.ScalarVisibilityOff
+bookshelf1FrontActor = Vtk::Actor.new
+bookshelf1FrontActor.SetMapper(mapBookshelf1Front)
+bookshelf1FrontActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1Back = Vtk::StructuredGridGeometryFilter.new
+bookshelf1Back.SetInputConnection(reader.GetOutputPort)
+bookshelf1Back.SetExtent(13, 20, 4, 4, 0, 11)
+mapBookshelf1Back = Vtk::PolyDataMapper.new
+mapBookshelf1Back.SetInputConnection(bookshelf1Back.GetOutputPort)
+mapBookshelf1Back.ScalarVisibilityOff
+bookshelf1BackActor = Vtk::Actor.new
+bookshelf1BackActor.SetMapper(mapBookshelf1Back)
+bookshelf1BackActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1LHS = Vtk::StructuredGridGeometryFilter.new
+bookshelf1LHS.SetInputConnection(reader.GetOutputPort)
+bookshelf1LHS.SetExtent(13, 20, 0, 4, 0, 0)
+mapBookshelf1LHS = Vtk::PolyDataMapper.new
+mapBookshelf1LHS.SetInputConnection(bookshelf1LHS.GetOutputPort)
+mapBookshelf1LHS.ScalarVisibilityOff
+bookshelf1LHSActor = Vtk::Actor.new
+bookshelf1LHSActor.SetMapper(mapBookshelf1LHS)
+bookshelf1LHSActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf1RHS = Vtk::StructuredGridGeometryFilter.new
+bookshelf1RHS.SetInputConnection(reader.GetOutputPort)
+bookshelf1RHS.SetExtent(13, 20, 0, 4, 11, 11)
+mapBookshelf1RHS = Vtk::PolyDataMapper.new
+mapBookshelf1RHS.SetInputConnection(bookshelf1RHS.GetOutputPort)
+mapBookshelf1RHS.ScalarVisibilityOff
+bookshelf1RHSActor = Vtk::Actor.new
+bookshelf1RHSActor.SetMapper(mapBookshelf1RHS)
+bookshelf1RHSActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2Top = Vtk::StructuredGridGeometryFilter.new
+bookshelf2Top.SetInputConnection(reader.GetOutputPort)
+bookshelf2Top.SetExtent(13, 13, 15, 19, 0, 11)
+mapBookshelf2Top = Vtk::PolyDataMapper.new
+mapBookshelf2Top.SetInputConnection(bookshelf2Top.GetOutputPort)
+mapBookshelf2Top.ScalarVisibilityOff
+bookshelf2TopActor = Vtk::Actor.new
+bookshelf2TopActor.SetMapper(mapBookshelf2Top)
+bookshelf2TopActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2Bottom = Vtk::StructuredGridGeometryFilter.new
+bookshelf2Bottom.SetInputConnection(reader.GetOutputPort)
+bookshelf2Bottom.SetExtent(20, 20, 15, 19, 0, 11)
+mapBookshelf2Bottom = Vtk::PolyDataMapper.new
+mapBookshelf2Bottom.SetInputConnection(bookshelf2Bottom.GetOutputPort)
+mapBookshelf2Bottom.ScalarVisibilityOff
+bookshelf2BottomActor = Vtk::Actor.new
+bookshelf2BottomActor.SetMapper(mapBookshelf2Bottom)
+bookshelf2BottomActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2Front = Vtk::StructuredGridGeometryFilter.new
+bookshelf2Front.SetInputConnection(reader.GetOutputPort)
+bookshelf2Front.SetExtent(13, 20, 15, 15, 0, 11)
+mapBookshelf2Front = Vtk::PolyDataMapper.new
+mapBookshelf2Front.SetInputConnection(bookshelf2Front.GetOutputPort)
+mapBookshelf2Front.ScalarVisibilityOff
+bookshelf2FrontActor = Vtk::Actor.new
+bookshelf2FrontActor.SetMapper(mapBookshelf2Front)
+bookshelf2FrontActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2Back = Vtk::StructuredGridGeometryFilter.new
+bookshelf2Back.SetInputConnection(reader.GetOutputPort)
+bookshelf2Back.SetExtent(13, 20, 19, 19, 0, 11)
+mapBookshelf2Back = Vtk::PolyDataMapper.new
+mapBookshelf2Back.SetInputConnection(bookshelf2Back.GetOutputPort)
+mapBookshelf2Back.ScalarVisibilityOff
+bookshelf2BackActor = Vtk::Actor.new
+bookshelf2BackActor.SetMapper(mapBookshelf2Back)
+bookshelf2BackActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2LHS = Vtk::StructuredGridGeometryFilter.new
+bookshelf2LHS.SetInputConnection(reader.GetOutputPort)
+bookshelf2LHS.SetExtent(13, 20, 15, 19, 0, 0)
+mapBookshelf2LHS = Vtk::PolyDataMapper.new
+mapBookshelf2LHS.SetInputConnection(bookshelf2LHS.GetOutputPort)
+mapBookshelf2LHS.ScalarVisibilityOff
+bookshelf2LHSActor = Vtk::Actor.new
+bookshelf2LHSActor.SetMapper(mapBookshelf2LHS)
+bookshelf2LHSActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+bookshelf2RHS = Vtk::StructuredGridGeometryFilter.new
+bookshelf2RHS.SetInputConnection(reader.GetOutputPort)
+bookshelf2RHS.SetExtent(13, 20, 15, 19, 11, 11)
+mapBookshelf2RHS = Vtk::PolyDataMapper.new
+mapBookshelf2RHS.SetInputConnection(bookshelf2RHS.GetOutputPort)
+mapBookshelf2RHS.ScalarVisibilityOff
+bookshelf2RHSActor = Vtk::Actor.new
+bookshelf2RHSActor.SetMapper(mapBookshelf2RHS)
+bookshelf2RHSActor.GetProperty.SetColor(0.8, 0.8, 0.6)
+
+window = Vtk::StructuredGridGeometryFilter.new
+window.SetInputConnection(reader.GetOutputPort)
+window.SetExtent(20, 20, 6, 13, 10, 13)
+mapWindow = Vtk::PolyDataMapper.new
+mapWindow.SetInputConnection(window.GetOutputPort)
+mapWindow.ScalarVisibilityOff
+windowActor = Vtk::Actor.new
+windowActor.SetMapper(mapWindow)
+windowActor.GetProperty.SetColor(0.3, 0.3, 0.5)
+
+outlet = Vtk::StructuredGridGeometryFilter.new
+outlet.SetInputConnection(reader.GetOutputPort)
+outlet.SetExtent(0, 0, 9, 10, 14, 16)
+mapOutlet = Vtk::PolyDataMapper.new
+mapOutlet.SetInputConnection(outlet.GetOutputPort)
+mapOutlet.ScalarVisibilityOff
+outletActor = Vtk::Actor.new
+outletActor.SetMapper(mapOutlet)
+outletActor.GetProperty.SetColor(0, 0, 0)
+
+inlet = Vtk::StructuredGridGeometryFilter.new
+inlet.SetInputConnection(reader.GetOutputPort)
+inlet.SetExtent(0, 0, 9, 10, 0, 6)
+mapInlet = Vtk::PolyDataMapper.new
+mapInlet.SetInputConnection(inlet.GetOutputPort)
+mapInlet.ScalarVisibilityOff
+inletActor = Vtk::Actor.new
+inletActor.SetMapper(mapInlet)
+inletActor.GetProperty.SetColor(0, 0, 0)
+
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(reader.GetOutputPort)
+mapOutline = Vtk::PolyDataMapper.new
+mapOutline.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(mapOutline)
+outlineActor.GetProperty.SetColor(0, 0, 0)
+
+# Now create the usual graphics stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+ren.AddActor(table1Actor)
+ren.AddActor(table2Actor)
+ren.AddActor(FilingCabinet1Actor)
+ren.AddActor(FilingCabinet2Actor)
+ren.AddActor(bookshelf1TopActor)
+ren.AddActor(bookshelf1BottomActor)
+ren.AddActor(bookshelf1FrontActor)
+ren.AddActor(bookshelf1BackActor)
+ren.AddActor(bookshelf1LHSActor)
+ren.AddActor(bookshelf1RHSActor)
+ren.AddActor(bookshelf2TopActor)
+ren.AddActor(bookshelf2BottomActor)
+ren.AddActor(bookshelf2FrontActor)
+ren.AddActor(bookshelf2BackActor)
+ren.AddActor(bookshelf2LHSActor)
+ren.AddActor(bookshelf2RHSActor)
+ren.AddActor(windowActor)
+ren.AddActor(outletActor)
+ren.AddActor(inletActor)
+ren.AddActor(outlineActor)
+ren.AddActor(streamTubeActor)
+
+ren.SetBackground(Vtk::Colors::Slate_grey)
+
+# Here we specify a particular view.
+aCamera = Vtk::Camera.new
+aCamera.SetClippingRange(0.726079, 36.3039)
+aCamera.SetFocalPoint(2.43584, 2.15046, 1.11104)
+aCamera.SetPosition(-4.76183, -10.4426, 3.17203)
+aCamera.SetViewUp(0.0511273, 0.132773, 0.989827)
+aCamera.SetViewAngle(18.604)
+aCamera.Zoom(1.2)
+
+ren.SetActiveCamera(aCamera)
+renWin.SetSize(500, 300)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/probeComb.rb VTK/Examples/VisualizationAlgorithms/Ruby/probeComb.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/probeComb.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/probeComb.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,123 @@
+#!/usr/bin/env ruby
+
+# This shows how to probe a dataset with a plane. The probed data is
+# then contoured.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Read data.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# We create three planes and position them in the correct position
+# using transform filters. They are then appended together and used as
+# a probe.
+plane = Vtk::PlaneSource.new
+plane.SetResolution(50, 50)
+transP1 = Vtk::Transform.new
+transP1.Translate(3.7, 0.0, 28.37)
+transP1.Scale(5, 5, 5)
+transP1.RotateY(90)
+tpd1 = Vtk::TransformPolyDataFilter.new
+tpd1.SetInputConnection(plane.GetOutputPort)
+tpd1.SetTransform(transP1)
+outTpd1 = Vtk::OutlineFilter.new
+outTpd1.SetInputConnection(tpd1.GetOutputPort)
+mapTpd1 = Vtk::PolyDataMapper.new
+mapTpd1.SetInputConnection(outTpd1.GetOutputPort)
+tpd1Actor = Vtk::Actor.new
+tpd1Actor.SetMapper(mapTpd1)
+tpd1Actor.GetProperty.SetColor(0, 0, 0)
+
+transP2 = Vtk::Transform.new
+transP2.Translate(9.2, 0.0, 31.20)
+transP2.Scale(5, 5, 5)
+transP2.RotateY(90)
+tpd2 = Vtk::TransformPolyDataFilter.new
+tpd2.SetInputConnection(plane.GetOutputPort)
+tpd2.SetTransform(transP2)
+outTpd2 = Vtk::OutlineFilter.new
+outTpd2.SetInputConnection(tpd2.GetOutputPort)
+mapTpd2 = Vtk::PolyDataMapper.new
+mapTpd2.SetInputConnection(outTpd2.GetOutputPort)
+tpd2Actor = Vtk::Actor.new
+tpd2Actor.SetMapper(mapTpd2)
+tpd2Actor.GetProperty.SetColor(0, 0, 0)
+
+transP3 = Vtk::Transform.new
+transP3.Translate(13.27, 0.0, 33.30)
+transP3.Scale(5, 5, 5)
+transP3.RotateY(90)
+tpd3 = Vtk::TransformPolyDataFilter.new
+tpd3.SetInputConnection(plane.GetOutputPort)
+tpd3.SetTransform(transP3)
+outTpd3 = Vtk::OutlineFilter.new
+outTpd3.SetInputConnection(tpd3.GetOutputPort)
+mapTpd3 = Vtk::PolyDataMapper.new
+mapTpd3.SetInputConnection(outTpd3.GetOutputPort)
+tpd3Actor = Vtk::Actor.new
+tpd3Actor.SetMapper(mapTpd3)
+tpd3Actor.GetProperty.SetColor(0, 0, 0)
+
+appendF = Vtk::AppendPolyData.new
+appendF.AddInput(tpd1.GetOutput)
+appendF.AddInput(tpd2.GetOutput)
+appendF.AddInput(tpd3.GetOutput)
+
+# The vtkProbeFilter takes two inputs. One is a dataset to use as the
+# probe geometry (SetInput); the other is the data to probe
+# (SetSource). The output dataset structure (geometry and topology) of
+# the probe is the same as the structure of the input. The probing
+# process generates new data values resampled from the source.
+probe = Vtk::ProbeFilter.new
+probe.SetInputConnection(appendF.GetOutputPort)
+probe.SetSource(pl3d.GetOutput)
+
+contour = Vtk::ContourFilter.new
+contour.SetInputConnection(probe.GetOutputPort)
+contour.GenerateValues(50, pl3d.GetOutput.GetScalarRange)
+contourMapper = Vtk::PolyDataMapper.new
+contourMapper.SetInputConnection(contour.GetOutputPort)
+contourMapper.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+planeActor = Vtk::Actor.new
+planeActor.SetMapper(contourMapper)
+
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineActor.GetProperty.SetColor(0, 0, 0)
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+ren.AddActor(outlineActor)
+ren.AddActor(planeActor)
+ren.AddActor(tpd1Actor)
+ren.AddActor(tpd2Actor)
+ren.AddActor(tpd3Actor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(400, 400)
+
+ren.ResetCamera
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(3.95297, 50)
+cam1.SetFocalPoint(8.88908, 0.595038, 29.3342)
+cam1.SetPosition(-12.3332, 31.7479, 41.2387)
+cam1.SetViewUp(0.060772, -0.319905, 0.945498)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/smoothFran.rb VTK/Examples/VisualizationAlgorithms/Ruby/smoothFran.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/smoothFran.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/smoothFran.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,55 @@
+#!/usr/bin/env ruby
+
+# This example shows how to use decimation to reduce a polygonal
+# mesh. We also use mesh smoothing and generate surface normals to
+# give a pleasing result.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# We start by reading some data that was originally captured from a
+# Cyberware laser digitizing system.
+fran = Vtk::PolyDataReader.new
+fran.SetFileName(VTK_DATA_ROOT + "/Data/fran_cut.vtk")
+
+# We want to preserve topology (not let any cracks form). This may
+# limit the total reduction possible, which we have specified at 90%.
+deci = Vtk::DecimatePro.new
+deci.SetInputConnection(fran.GetOutputPort)
+deci.SetTargetReduction(0.9)
+deci.PreserveTopologyOn
+smoother = Vtk::SmoothPolyDataFilter.new
+smoother.SetInputConnection(deci.GetOutputPort)
+smoother.SetNumberOfIterations(50)
+normals = Vtk::PolyDataNormals.new
+normals.SetInputConnection(smoother.GetOutputPort)
+normals.FlipNormalsOn
+franMapper = Vtk::PolyDataMapper.new
+franMapper.SetInputConnection(normals.GetOutputPort)
+franActor = Vtk::Actor.new
+franActor.SetMapper(franMapper)
+franActor.GetProperty.SetColor(1.0, 0.49, 0.25)
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(franActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(250, 250)
+
+cam1 = Vtk::Camera.new
+cam1.SetClippingRange(0.0475572, 2.37786)
+cam1.SetFocalPoint(0.052665, -0.129454, -0.0573973)
+cam1.SetPosition(0.327637, -0.116299, -0.256418)
+cam1.SetViewUp(-0.0225386, 0.999137, 0.034901)
+ren.SetActiveCamera(cam1)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/spikeF.rb VTK/Examples/VisualizationAlgorithms/Ruby/spikeF.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/spikeF.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/spikeF.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,82 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of glyphing. We also use a mask filter
+# to select a subset of points to glyph.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Read a data file. This originally was a Cyberware laser digitizer scan 
+# of Fran J.'s face. Surface normals are generated based on local geometry
+# (i.e., the polygon normals surrounding eash point are averaged). We flip
+# the normals because we want them to point out from Fran's face.
+fran = Vtk::PolyDataReader.new
+fran.SetFileName(VTK_DATA_ROOT + "/Data/fran_cut.vtk")
+normals = Vtk::PolyDataNormals.new
+normals.SetInputConnection(fran.GetOutputPort)
+normals.FlipNormalsOn
+franMapper = Vtk::PolyDataMapper.new
+franMapper.SetInputConnection(normals.GetOutputPort)
+franActor = Vtk::Actor.new
+franActor.SetMapper(franMapper)
+franActor.GetProperty.SetColor(1.0, 0.49, 0.25)
+
+# We subsample the dataset because we want to glyph just a subset of
+# the points. Otherwise the display is cluttered and cannot be easily
+# read. The RandonModeOn and SetOnRatio combine to random select one out
+# of every 10 points in the dataset.
+ptMask = Vtk::MaskPoints.new
+ptMask.SetInputConnection(normals.GetOutputPort)
+ptMask.SetOnRatio(10)
+ptMask.RandomModeOn
+
+# In this case we are using a cone as a glyph. We transform the cone so
+# its base is at 0,0,0. This is the point where glyph rotation occurs.
+cone = Vtk::ConeSource.new
+cone.SetResolution(6)
+transform = Vtk::Transform.new
+transform.Translate(0.5, 0.0, 0.0)
+transformF = Vtk::TransformPolyDataFilter.new
+transformF.SetInputConnection(cone.GetOutputPort)
+transformF.SetTransform(transform)
+
+# vtkGlyph3D takes two inputs: the input point set (SetInput) which can be
+# any vtkDataSet; and the glyph (SetSource) which must be a vtkPolyData.
+# We are interested in orienting the glyphs by the surface normals that
+# we previosuly generated.
+glyph = Vtk::Glyph3D.new
+glyph.SetInputConnection(ptMask.GetOutputPort)
+glyph.SetSource(transformF.GetOutput)
+glyph.SetVectorModeToUseNormal
+glyph.SetScaleModeToScaleByVector
+glyph.SetScaleFactor(0.004)
+spikeMapper = Vtk::PolyDataMapper.new
+spikeMapper.SetInputConnection(glyph.GetOutputPort)
+spikeActor = Vtk::Actor.new
+spikeActor.SetMapper(spikeMapper)
+spikeActor.GetProperty.SetColor(0.0, 0.79, 0.34)
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(franActor)
+ren.AddActor(spikeActor)
+
+renWin.SetSize(500, 500)
+ren.SetBackground(0.1, 0.2, 0.4)
+
+# Set a nice camera position.
+ren.ResetCamera
+cam1 = ren.GetActiveCamera
+cam1.Zoom(1.4)
+cam1.Azimuth(110)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/streamSurface.rb VTK/Examples/VisualizationAlgorithms/Ruby/streamSurface.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/streamSurface.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/streamSurface.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,81 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the generation of a streamsurface.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Read the data and specify which scalars and vectors to read.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# We use a rake to generate a series of streamline starting points
+# scattered along a line. Each point will generate a streamline. These
+# streamlines are then fed to the vtkRuledSurfaceFilter which stitches
+# the lines together to form a surface.
+rake = Vtk::LineSource.new
+rake.SetPoint1(15, -5, 32)
+rake.SetPoint2(15, 5, 32)
+rake.SetResolution(21)
+rakeMapper = Vtk::PolyDataMapper.new
+rakeMapper.SetInputConnection(rake.GetOutputPort)
+rakeActor = Vtk::Actor.new
+rakeActor.SetMapper(rakeMapper)
+
+integ = Vtk::RungeKutta4.new
+sl = Vtk::StreamLine.new
+sl.SetInputConnection(pl3d.GetOutputPort)
+sl.SetSource(rake.GetOutput)
+sl.SetIntegrator(integ)
+sl.SetMaximumPropagationTime(0.1)
+sl.SetIntegrationStepLength(0.1)
+sl.SetIntegrationDirectionToBackward
+sl.SetStepLength(0.001)
+
+# The ruled surface stiches together lines with triangle strips.
+# Note the SetOnRatio method. It turns on every other strip that
+# the filter generates (only when multiple lines are input).
+scalarSurface = Vtk::RuledSurfaceFilter.new
+scalarSurface.SetInputConnection(sl.GetOutputPort)
+scalarSurface.SetOffset(0)
+scalarSurface.SetOnRatio(2)
+scalarSurface.PassLinesOn
+scalarSurface.SetRuledModeToPointWalk
+scalarSurface.SetDistanceFactor(30)
+mapper = Vtk::PolyDataMapper.new
+mapper.SetInputConnection(scalarSurface.GetOutputPort)
+mapper.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+actor = Vtk::Actor.new
+actor.SetMapper(mapper)
+
+# Put an outline around for context.
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineActor.GetProperty.SetColor(0, 0, 0)
+
+# Now create the usual graphics stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+ren.AddActor(rakeActor)
+ren.AddActor(actor)
+ren.AddActor(outlineActor)
+ren.SetBackground(1, 1, 1)
+
+renWin.SetSize(300, 300)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/SubsampleGrid.rb VTK/Examples/VisualizationAlgorithms/Ruby/SubsampleGrid.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/SubsampleGrid.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/SubsampleGrid.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,67 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the subsampling of a structured grid.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Read some structured data.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# Here we subsample the grid. The SetVOI method requires six values
+# specifying (imin,imax, jmin,jmax, kmin,kmax) extents. In this
+# example we extracting a plane. Note that the VOI is clamped to zero
+# (min) and the maximum i-j-k value; that way we can use the
+# -1000,1000 specification and be sure the values are clamped. The
+# SampleRate specifies that we take every point in the i-direction;
+# every other point in the j-direction; and every third point in the
+# k-direction. IncludeBoundaryOn makes sure that we get the boundary
+# points even if the SampleRate does not coincident with the boundary.
+extract = Vtk::ExtractGrid.new
+extract.SetInputConnection(pl3d.GetOutputPort)
+extract.SetVOI(30, 30, -1000, 1000, -1000, 1000)
+extract.SetSampleRate(1, 2, 3)
+extract.IncludeBoundaryOn
+mapper = Vtk::DataSetMapper.new
+mapper.SetInputConnection(extract.GetOutputPort)
+mapper.SetScalarRange(0.18, 0.7)
+actor = Vtk::Actor.new
+actor.SetMapper(mapper)
+
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineActor.GetProperty.SetColor(0, 0, 0)
+
+# Add the usual rendering stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(outlineActor)
+ren.AddActor(actor)
+
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(300, 180)
+
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(2.64586, 47.905)
+cam1.SetFocalPoint(8.931, 0.358127, 31.3526)
+cam1.SetPosition(29.7111, -0.688615, 37.1495)
+cam1.SetViewUp(-0.268328, 0.00801595, 0.963294)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/TextureThreshold.rb VTK/Examples/VisualizationAlgorithms/Ruby/TextureThreshold.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/TextureThreshold.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/TextureThreshold.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,136 @@
+#!/usr/bin/env ruby
+
+# This example shows how to use a transparent texture map to perform
+# thresholding. The key is the vtkThresholdTextureCoords filter which
+# creates texture coordinates based on a threshold value. These
+# texture coordinates are used in conjuntion with a texture map with
+# varying opacity and intensity to create an inside, transition, and
+# outside region.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Begin by reading some structure grid data.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/bluntfinxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/bluntfinq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# Now extract surfaces from the grid corresponding to boundary
+# geometry.  First the wall.
+wall = Vtk::StructuredGridGeometryFilter.new
+wall.SetInputConnection(pl3d.GetOutputPort)
+wall.SetExtent(0, 100, 0, 0, 0, 100)
+wallMap = Vtk::PolyDataMapper.new
+wallMap.SetInputConnection(wall.GetOutputPort)
+wallMap.ScalarVisibilityOff
+wallActor = Vtk::Actor.new
+wallActor.SetMapper(wallMap)
+wallActor.GetProperty.SetColor(0.8, 0.8, 0.8)
+
+# Now the fin.
+fin = Vtk::StructuredGridGeometryFilter.new
+fin.SetInputConnection(pl3d.GetOutputPort)
+fin.SetExtent(0, 100, 0, 100, 0, 0)
+finMap = Vtk::PolyDataMapper.new
+finMap.SetInputConnection(fin.GetOutputPort)
+finMap.ScalarVisibilityOff
+finActor = Vtk::Actor.new
+finActor.SetMapper(finMap)
+finActor.GetProperty.SetColor(0.8, 0.8, 0.8)
+
+# Extract planes to threshold. Start by reading the specially designed
+# texture map that has three regions: an inside, boundary, and outside
+# region. The opacity and intensity of this texture map are varied.
+tmap = Vtk::StructuredPointsReader.new
+tmap.SetFileName(VTK_DATA_ROOT + "/Data/texThres2.vtk")
+texture = Vtk::Texture.new
+texture.SetInputConnection(tmap.GetOutputPort)
+texture.InterpolateOff
+texture.RepeatOff
+
+# Here are the three planes which will be texture thresholded.
+plane1 = Vtk::StructuredGridGeometryFilter.new
+plane1.SetInputConnection(pl3d.GetOutputPort)
+plane1.SetExtent(10, 10, 0, 100, 0, 100)
+thresh1 = Vtk::ThresholdTextureCoords.new
+thresh1.SetInputConnection(plane1.GetOutputPort)
+thresh1.ThresholdByUpper(1.5)
+plane1Map = Vtk::DataSetMapper.new
+plane1Map.SetInputConnection(thresh1.GetOutputPort)
+plane1Map.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+plane1Actor = Vtk::Actor.new
+plane1Actor.SetMapper(plane1Map)
+plane1Actor.SetTexture(texture)
+plane1Actor.GetProperty.SetOpacity(0.999)
+
+plane2 = Vtk::StructuredGridGeometryFilter.new
+plane2.SetInputConnection(pl3d.GetOutputPort)
+plane2.SetExtent(30, 30, 0, 100, 0, 100)
+thresh2 = Vtk::ThresholdTextureCoords.new
+thresh2.SetInputConnection(plane2.GetOutputPort)
+thresh2.ThresholdByUpper(1.5)
+plane2Map = Vtk::DataSetMapper.new
+plane2Map.SetInputConnection(thresh2.GetOutputPort)
+plane2Map.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+plane2Actor = Vtk::Actor.new
+plane2Actor.SetMapper(plane2Map)
+plane2Actor.SetTexture(texture)
+plane2Actor.GetProperty.SetOpacity(0.999)
+
+plane3 = Vtk::StructuredGridGeometryFilter.new
+plane3.SetInputConnection(pl3d.GetOutputPort)
+plane3.SetExtent(35, 35, 0, 100, 0, 100)
+thresh3 = Vtk::ThresholdTextureCoords.new
+thresh3.SetInputConnection(plane3.GetOutputPort)
+thresh3.ThresholdByUpper(1.5)
+plane3Map = Vtk::DataSetMapper.new
+plane3Map.SetInputConnection(thresh3.GetOutputPort)
+plane3Map.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+plane3Actor = Vtk::Actor.new
+plane3Actor.SetMapper(plane3Map)
+plane3Actor.SetTexture(texture)
+plane3Actor.GetProperty.SetOpacity(0.999)
+
+# For context create an outline around the data.
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineProp = outlineActor.GetProperty
+outlineProp.SetColor(0, 0, 0)
+
+# Create the RenderWindow, Renderer and both Actors
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(outlineActor)
+ren.AddActor(wallActor)
+ren.AddActor(finActor)
+ren.AddActor(plane1Actor)
+ren.AddActor(plane2Actor)
+ren.AddActor(plane3Actor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(500, 500)
+
+# Set up a nice view.
+cam1 = Vtk::Camera.new
+cam1.SetClippingRange(1.51176, 75.5879)
+cam1.SetFocalPoint(2.33749, 2.96739, 3.61023)
+cam1.SetPosition(10.8787, 5.27346, 15.8687)
+cam1.SetViewAngle(30)
+cam1.SetViewUp(-0.0610856, 0.987798, -0.143262)
+ren.SetActiveCamera(cam1)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/VisQuad.rb VTK/Examples/VisualizationAlgorithms/Ruby/VisQuad.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/VisQuad.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/VisQuad.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,59 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates the use of the contour filter, and the use of
+# the vtkSampleFunction to generate a volume of data samples from an
+# implicit function.
+
+require 'vtk'
+
+# VTK supports implicit functions of the form f(x,y,z)=constant. These 
+# functions can represent things spheres, cones, etc. Here we use a 
+# general form for a quadric to create an elliptical data field.
+quadric = Vtk::Quadric.new
+quadric.SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0)
+
+# vtkSampleFunction samples an implicit function over the x-y-z range
+# specified (here it defaults to -1,1 in the x,y,z directions).
+sample = Vtk::SampleFunction.new
+sample.SetSampleDimensions(30, 30, 30)
+sample.SetImplicitFunction(quadric)
+
+# Create five surfaces F(x,y,z) = constant between range specified. The
+# GenerateValues() method creates n isocontour values between the range
+# specified.
+contours = Vtk::ContourFilter.new
+contours.SetInputConnection(sample.GetOutputPort)
+contours.GenerateValues(5, 0.0, 1.2)
+
+contMapper = Vtk::PolyDataMapper.new
+contMapper.SetInputConnection(contours.GetOutputPort)
+contMapper.SetScalarRange(0.0, 1.2)
+
+contActor = Vtk::Actor.new
+contActor.SetMapper(contMapper)
+
+# We'll put a simple outline around the data.
+outline = Vtk::OutlineFilter.new
+outline.SetInputConnection(sample.GetOutputPort)
+
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineActor.GetProperty.SetColor(0,0,0)
+
+# The usual rendering stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+ren.SetBackground(1, 1, 1)
+ren.AddActor(contActor)
+ren.AddActor(outlineActor)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VisualizationAlgorithms/Ruby/warpComb.rb VTK/Examples/VisualizationAlgorithms/Ruby/warpComb.rb
--- VTK_org/Examples/VisualizationAlgorithms/Ruby/warpComb.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VisualizationAlgorithms/Ruby/warpComb.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,91 @@
+#!/usr/bin/env ruby
+
+# This example demonstrates how to extract "computational planes" from
+# a structured dataset. Structured data has a natural, logical
+# coordinate system based on i-j-k indices. Specifying imin,imax,
+# jmin,jmax, kmin,kmax pairs can indicate a point, line, plane, or
+# volume of data.
+#
+# In this example, we extract three planes and warp them using scalar
+# values in the direction of the local normal at each point. This
+# gives a sort of "velocity profile" that indicates the nature of the
+# flow.
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Here we read data from a annular combustor. A combustor burns fuel
+# and air in a gas turbine (e.g., a jet engine) and the hot gas
+# eventually makes its way to the turbine section.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# Planes are specified using a imin,imax, jmin,jmax, kmin,kmax
+# coordinate specification. Min and max i,j,k values are clamped to 0
+# and maximum value.
+plane = Vtk::StructuredGridGeometryFilter.new
+plane.SetInputConnection(pl3d.GetOutputPort)
+plane.SetExtent(10, 10, 1, 100, 1, 100)
+plane2 = Vtk::StructuredGridGeometryFilter.new
+plane2.SetInputConnection(pl3d.GetOutputPort)
+plane2.SetExtent(30, 30, 1, 100, 1, 100)
+plane3 = Vtk::StructuredGridGeometryFilter.new
+plane3.SetInputConnection(pl3d.GetOutputPort)
+plane3.SetExtent(45, 45, 1, 100, 1, 100)
+
+# We use an append filter because that way we can do the warping,
+# etc. just using a single pipeline and actor.
+appendF = Vtk::AppendPolyData.new
+appendF.AddInput(plane.GetOutput)
+appendF.AddInput(plane2.GetOutput)
+appendF.AddInput(plane3.GetOutput)
+warp = Vtk::WarpScalar.new
+warp.SetInputConnection(appendF.GetOutputPort)
+warp.UseNormalOn
+warp.SetNormal(1.0, 0.0, 0.0)
+warp.SetScaleFactor(2.5)
+normals = Vtk::PolyDataNormals.new
+normals.SetInput(warp.GetPolyDataOutput)
+normals.SetFeatureAngle(60)
+planeMapper = Vtk::PolyDataMapper.new
+planeMapper.SetInputConnection(normals.GetOutputPort)
+planeMapper.SetScalarRange(pl3d.GetOutput.GetScalarRange)
+planeActor = Vtk::Actor.new
+planeActor.SetMapper(planeMapper)
+
+# The outline provides context for the data and the planes.
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outline.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+outlineActor.GetProperty.SetColor(0, 0, 0)
+
+# Create the usual graphics stuff.
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+ren.AddActor(outlineActor)
+ren.AddActor(planeActor)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(500, 500)
+
+# Create an initial view.
+cam1 = ren.GetActiveCamera
+cam1.SetClippingRange(3.95297, 50)
+cam1.SetFocalPoint(8.88908, 0.595038, 29.3342)
+cam1.SetPosition(-12.3332, 31.7479, 41.2387)
+cam1.SetViewUp(0.060772, -0.319905, 0.945498)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VolumeRendering/Ruby/PseudoVolumeRendering.rb VTK/Examples/VolumeRendering/Ruby/PseudoVolumeRendering.rb
--- VTK_org/Examples/VolumeRendering/Ruby/PseudoVolumeRendering.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VolumeRendering/Ruby/PseudoVolumeRendering.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,122 @@
+#!/usr/bin/env ruby
+
+# Perform psuedo volume rendering in a structured grid by compositing
+# translucent cut planes. This same trick can be used for unstructured
+# grids. Note that for better results, more planes can be created. Also,
+# if your data is vtkImageData, there are much faster methods for volume
+# rendering.
+
+require 'vtk'
+require 'vtk/util'
+
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create pipeline. Read structured grid data.
+pl3d = Vtk::PLOT3DReader.new
+pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
+pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
+pl3d.SetScalarFunctionNumber(100)
+pl3d.SetVectorFunctionNumber(202)
+pl3d.Update
+
+# A convenience, use this filter to limit data for experimentation.
+extract = Vtk::ExtractGrid.new
+extract.SetVOI(1, 55, -1000, 1000, -1000, 1000)
+extract.SetInputConnection(pl3d.GetOutputPort)
+
+# The (implicit) plane is used to do the cutting
+@plane = Vtk::Plane.new
+@plane.SetOrigin(0, 4, 2)
+@plane.SetNormal(0, 1, 0)
+
+# The cutter is set up to process each contour value over all cells
+# (SetSortByToSortByCell). This results in an ordered output of polygons
+# which is key to the compositing.
+@cutter = Vtk::Cutter.new
+@cutter.SetInputConnection(extract.GetOutputPort)
+@cutter.SetCutFunction(@plane)
+@cutter.GenerateCutScalarsOff
+@cutter.SetSortByToSortByCell
+
+@clut = Vtk::LookupTable.new
+@clut.SetHueRange(0, 0.67)
+@clut.Build
+
+cutterMapper = Vtk::PolyDataMapper.new
+cutterMapper.SetInputConnection(@cutter.GetOutputPort)
+cutterMapper.SetScalarRange(0.18, 0.7)
+cutterMapper.SetLookupTable(@clut)
+
+cut = Vtk::Actor.new
+cut.SetMapper(cutterMapper)
+
+# Add in some surface geometry for interest.
+iso = Vtk::ContourFilter.new
+iso.SetInputConnection(pl3d.GetOutputPort)
+iso.SetValue(0, 0.22)
+normals = Vtk::PolyDataNormals.new
+normals.SetInputConnection(iso.GetOutputPort)
+normals.SetFeatureAngle(45)
+isoMapper = Vtk::PolyDataMapper.new
+isoMapper.SetInputConnection(normals.GetOutputPort)
+isoMapper.ScalarVisibilityOff
+isoActor = Vtk::Actor.new
+isoActor.SetMapper(isoMapper)
+isoActor.GetProperty.SetDiffuseColor(Vtk::Colors::Tomato)
+isoActor.GetProperty.SetSpecularColor(Vtk::Colors::White)
+isoActor.GetProperty.SetDiffuse(0.8)
+isoActor.GetProperty.SetSpecular(0.5)
+isoActor.GetProperty.SetSpecularPower(30)
+
+outline = Vtk::StructuredGridOutlineFilter.new
+outline.SetInputConnection(pl3d.GetOutputPort)
+outlineTubes = Vtk::TubeFilter.new
+outlineTubes.SetInputConnection(outline.GetOutputPort)
+outlineTubes.SetRadius(0.1)
+
+outlineMapper = Vtk::PolyDataMapper.new
+outlineMapper.SetInputConnection(outlineTubes.GetOutputPort)
+outlineActor = Vtk::Actor.new
+outlineActor.SetMapper(outlineMapper)
+
+# Create the RenderWindow, Renderer and Interactor
+ren = Vtk::Renderer.new
+@renWin = Vtk::RenderWindow.new
+@renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(@renWin)
+
+# Add the actors to the renderer, set the background and size
+ren.AddActor(outlineActor)
+outlineActor.GetProperty.SetColor(Vtk::Colors::Banana)
+ren.AddActor(isoActor)
+isoActor.VisibilityOn
+ren.AddActor(cut)
+@opacity = 0.1
+cut.GetProperty.SetOpacity(1)
+ren.SetBackground(1, 1, 1)
+@renWin.SetSize(640, 480)
+
+@cam1 = ren.GetActiveCamera
+@cam1.SetClippingRange(3.95297, 50)
+@cam1.SetFocalPoint(9.71821, 0.458166, 29.3999)
+@cam1.SetPosition(2.7439, -37.3196, 38.7167)
+@cam1.ComputeViewPlaneNormal
+@cam1.SetViewUp(-0.16123, 0.264271, 0.950876)
+
+# Cut: generates n cut planes normal to camera's view plane
+def Cut(n)
+  @plane.SetNormal(@cam1.GetViewPlaneNormal)
+  @plane.SetOrigin(@cam1.GetFocalPoint)
+  @cutter.GenerateValues(n, -5, 5)
+  @clut.SetAlphaRange(@opacity, @opacity)
+  @renWin.Render
+end
+ 
+
+# Generate 10 cut planes
+Cut(20)
+
+iren.Initialize
+@renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VolumeRendering/Ruby/SimpleRayCast.rb VTK/Examples/VolumeRendering/Ruby/SimpleRayCast.rb
--- VTK_org/Examples/VolumeRendering/Ruby/SimpleRayCast.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VolumeRendering/Ruby/SimpleRayCast.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,70 @@
+#!/usr/bin/env ruby
+
+# This is a simple volume rendering example that uses a
+# vtkVolumeRayCast mapper
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create the standard renderer, render window and interactor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Create the reader for the data
+reader = Vtk::StructuredPointsReader.new
+reader.SetFileName(VTK_DATA_ROOT + "/Data/ironProt.vtk")
+
+
+# Create transfer mapping scalar value to opacity
+opacityTransferFunction = Vtk::PiecewiseFunction.new
+opacityTransferFunction.AddPoint(20, 0.0)
+opacityTransferFunction.AddPoint(255, 0.2)
+
+# Create transfer mapping scalar value to color
+colorTransferFunction = Vtk::ColorTransferFunction.new
+colorTransferFunction.AddRGBPoint(0.0, 0.0, 0.0, 0.0)
+colorTransferFunction.AddRGBPoint(64.0, 1.0, 0.0, 0.0)
+colorTransferFunction.AddRGBPoint(128.0, 0.0, 0.0, 1.0)
+colorTransferFunction.AddRGBPoint(192.0, 0.0, 1.0, 0.0)
+colorTransferFunction.AddRGBPoint(255.0, 0.0, 0.2, 0.0)
+
+# The property describes how the data will look
+volumeProperty = Vtk::VolumeProperty.new
+volumeProperty.SetColor(colorTransferFunction)
+volumeProperty.SetScalarOpacity(opacityTransferFunction)
+volumeProperty.ShadeOn
+volumeProperty.SetInterpolationTypeToLinear
+
+# The mapper / ray cast function know how to render the data
+compositeFunction = Vtk::VolumeRayCastCompositeFunction.new
+volumeMapper = Vtk::VolumeRayCastMapper.new
+volumeMapper.SetVolumeRayCastFunction(compositeFunction)
+volumeMapper.SetInputConnection(reader.GetOutputPort)
+
+# The volume holds the mapper and the property and
+# can be used to position/orient the volume
+volume = Vtk::Volume.new
+volume.SetMapper(volumeMapper)
+volume.SetProperty(volumeProperty)
+
+ren.AddVolume(volume)
+ren.SetBackground(1, 1, 1)
+renWin.SetSize(600, 600)
+renWin.Render
+
+
+CheckAbort = Proc.new{|obj, event|
+  if obj.GetEventPending != 0
+    obj.SetAbortRender(1)
+  end
+}
+ 
+renWin.AddObserver("AbortCheckEvent", CheckAbort)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Examples/VolumeRendering/Ruby/SimpleTextureMap2D.rb VTK/Examples/VolumeRendering/Ruby/SimpleTextureMap2D.rb
--- VTK_org/Examples/VolumeRendering/Ruby/SimpleTextureMap2D.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Examples/VolumeRendering/Ruby/SimpleTextureMap2D.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,62 @@
+#!/usr/bin/env ruby
+
+# This is a simple volume rendering example that uses a
+# vtkVolumeTextureMapper2D mapper
+
+require 'vtk'
+require 'vtk/util'
+VTK_DATA_ROOT = vtkGetDataRoot
+
+# Create the standard renderer, render window and interactor
+ren = Vtk::Renderer.new
+renWin = Vtk::RenderWindow.new
+renWin.AddRenderer(ren)
+iren = Vtk::RenderWindowInteractor.new
+iren.SetRenderWindow(renWin)
+
+# Create the reader for the data
+reader = Vtk::StructuredPointsReader.new
+reader.SetFileName(VTK_DATA_ROOT + "/Data/ironProt.vtk")
+
+# Create transfer mapping scalar value to opacity
+opacityTransferFunction = Vtk::PiecewiseFunction.new
+opacityTransferFunction.AddPoint(20, 0.0)
+opacityTransferFunction.AddPoint(255, 0.2)
+
+# Create transfer mapping scalar value to color
+colorTransferFunction = Vtk::ColorTransferFunction.new
+colorTransferFunction.AddRGBPoint(0.0, 0.0, 0.0, 0.0)
+colorTransferFunction.AddRGBPoint(64.0, 1.0, 0.0, 0.0)
+colorTransferFunction.AddRGBPoint(128.0, 0.0, 0.0, 1.0)
+colorTransferFunction.AddRGBPoint(192.0, 0.0, 1.0, 0.0)
+colorTransferFunction.AddRGBPoint(255.0, 0.0, 0.2, 0.0)
+
+# The property describes how the data will look
+volumeProperty = Vtk::VolumeProperty.new
+volumeProperty.SetColor(colorTransferFunction)
+volumeProperty.SetScalarOpacity(opacityTransferFunction)
+
+# The mapper knows how to render the data
+volumeMapper = Vtk::VolumeTextureMapper2D.new
+volumeMapper.SetInputConnection(reader.GetOutputPort)
+
+# The volume holds the mapper and the property and can be used to
+# position/orient the volume
+volume = Vtk::Volume.new
+volume.SetMapper(volumeMapper)
+volume.SetProperty(volumeProperty)
+
+ren.AddVolume(volume)
+renWin.Render
+
+CheckAbort = Proc.new{|obj, event|
+  if obj.GetEventPending != 0
+    obj.SetAbortRender(1)
+  end
+}
+ 
+renWin.AddObserver("AbortCheckEvent", CheckAbort)
+
+iren.Initialize
+renWin.Render
+iren.Start
diff -uNr VTK_org/Filtering/CMakeLists.txt VTK/Filtering/CMakeLists.txt
--- VTK_org/Filtering/CMakeLists.txt	2006-04-19 23:34:57.000000000 +0900
+++ VTK/Filtering/CMakeLists.txt	2009-01-25 13:53:19.000000000 +0900
@@ -2,6 +2,7 @@
 SET(UKIT FILTERING)
 SET(KIT_TCL_LIBS vtkCommonTCL)
 SET(KIT_PYTHON_LIBS vtkCommonPythonD)
+SET(KIT_RUBY_LIBS vtkCommonRubyD)
 SET(KIT_JAVA_LIBS vtkCommonJava)
 SET(KIT_LIBS vtkCommon)
 
@@ -284,9 +285,11 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 #-----------------------------------------------------------------------------
diff -uNr VTK_org/GenericFiltering/CMakeLists.txt VTK/GenericFiltering/CMakeLists.txt
--- VTK_org/GenericFiltering/CMakeLists.txt	2005-08-13 04:56:23.000000000 +0900
+++ VTK/GenericFiltering/CMakeLists.txt	2009-01-25 13:53:16.000000000 +0900
@@ -2,6 +2,7 @@
 SET(UKIT GENERIC_FILTERING)
 SET(KIT_TCL_LIBS vtkFilteringTCL vtkGraphicsTCL)
 SET(KIT_PYTHON_LIBS vtkFilteringPythonD vtkGraphicsPythonD)
+SET(KIT_RUBY_LIBS vtkFilteringRubyD vtkGraphicsRubyD)
 SET(KIT_JAVA_LIBS vtkFilteringJava vtkGraphicsJava)
 SET(KIT_LIBS vtkFiltering vtkGraphics)
 
@@ -21,9 +22,11 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 #-----------------------------------------------------------------------------
diff -uNr VTK_org/Graphics/CMakeLists.txt VTK/Graphics/CMakeLists.txt
--- VTK_org/Graphics/CMakeLists.txt	2005-08-13 04:56:23.000000000 +0900
+++ VTK/Graphics/CMakeLists.txt	2009-01-25 13:53:18.000000000 +0900
@@ -2,6 +2,7 @@
 SET(UKIT GRAPHICS)
 SET(KIT_TCL_LIBS vtkFilteringTCL)
 SET(KIT_PYTHON_LIBS vtkFilteringPythonD)
+SET(KIT_RUBY_LIBS vtkFilteringRubyD)
 SET(KIT_JAVA_LIBS vtkFilteringJava)
 SET(KIT_LIBS vtkFiltering)
 
@@ -214,9 +215,11 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 #-----------------------------------------------------------------------------
diff -uNr VTK_org/Hybrid/CMakeLists.txt VTK/Hybrid/CMakeLists.txt
--- VTK_org/Hybrid/CMakeLists.txt	2005-08-30 07:15:54.000000000 +0900
+++ VTK/Hybrid/CMakeLists.txt	2009-01-25 13:53:15.000000000 +0900
@@ -3,6 +3,7 @@
 
 SET(KIT_TCL_LIBS vtkRenderingTCL vtkIOTCL)
 SET(KIT_PYTHON_LIBS vtkRenderingPythonD vtkIOPythonD)
+SET(KIT_RUBY_LIBS vtkRenderingRubyD vtkIORubyD)
 SET(KIT_JAVA_LIBS vtkRenderingJava vtkIOJava)
 SET(KIT_LIBS vtkRendering vtkIO)
 IF(VTK_HAS_EXODUS)
@@ -88,9 +89,11 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 #-----------------------------------------------------------------------------
diff -uNr VTK_org/Imaging/CMakeLists.txt VTK/Imaging/CMakeLists.txt
--- VTK_org/Imaging/CMakeLists.txt	2005-08-13 04:56:23.000000000 +0900
+++ VTK/Imaging/CMakeLists.txt	2009-01-25 13:53:15.000000000 +0900
@@ -2,6 +2,7 @@
 SET(UKIT IMAGING)
 SET(KIT_TCL_LIBS vtkFilteringTCL)
 SET(KIT_PYTHON_LIBS vtkFilteringPythonD)
+SET(KIT_RUBY_LIBS vtkFilteringRubyD)
 SET(KIT_JAVA_LIBS vtkFilteringJava)
 SET(KIT_LIBS vtkFiltering)
 
@@ -141,9 +142,11 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 #-----------------------------------------------------------------------------
diff -uNr VTK_org/IO/CMakeLists.txt VTK/IO/CMakeLists.txt
--- VTK_org/IO/CMakeLists.txt	2007-01-30 06:16:31.000000000 +0900
+++ VTK/IO/CMakeLists.txt	2009-01-25 13:53:15.000000000 +0900
@@ -2,6 +2,7 @@
 SET(UKIT IO)
 SET(KIT_TCL_LIBS vtkFilteringTCL)
 SET(KIT_PYTHON_LIBS vtkFilteringPythonD)
+SET(KIT_RUBY_LIBS vtkFilteringRubyD)
 SET(KIT_JAVA_LIBS vtkFilteringJava)
 SET(KIT_LIBS vtkFiltering vtkDICOMParser
   ${VTK_PNG_LIBRARIES} ${VTK_ZLIB_LIBRARIES} ${VTK_JPEG_LIBRARIES}
@@ -188,9 +189,11 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 #-----------------------------------------------------------------------------
diff -uNr VTK_org/Parallel/CMakeLists.txt VTK/Parallel/CMakeLists.txt
--- VTK_org/Parallel/CMakeLists.txt	2007-03-29 05:38:46.000000000 +0900
+++ VTK/Parallel/CMakeLists.txt	2009-01-25 13:53:15.000000000 +0900
@@ -2,6 +2,7 @@
 SET(UKIT PARALLEL)
 SET(KIT_TCL_LIBS vtkRenderingTCL vtkIOTCL )
 SET(KIT_PYTHON_LIBS vtkRenderingPythonD vtkIOPythonD)
+SET(KIT_RUBY_LIBS vtkRenderingRubyD vtkIORubyD)
 SET(KIT_JAVA_LIBS vtkRenderingJava vtkIOJava)
 SET(KIT_LIBS vtkRendering vtkIO)
 IF(VTK_HAS_EXODUS)
@@ -100,9 +101,11 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 #-----------------------------------------------------------------------------
diff -uNr VTK_org/Rendering/CMakeLists.txt VTK/Rendering/CMakeLists.txt
--- VTK_org/Rendering/CMakeLists.txt	2005-08-31 23:05:22.000000000 +0900
+++ VTK/Rendering/CMakeLists.txt	2009-01-25 13:53:16.000000000 +0900
@@ -2,6 +2,7 @@
 SET(UKIT RENDERING)
 SET(KIT_TCL_LIBS vtkGraphicsTCL vtkImagingTCL ${VTK_TK_LIBRARIES})
 SET(KIT_PYTHON_LIBS vtkGraphicsPythonD vtkImagingPythonD)
+SET(KIT_RUBY_LIBS vtkGraphicsRubyD vtkImagingRubyD)
 SET(KIT_JAVA_LIBS vtkGraphicsJava vtkImagingJava)
 IF (JAVA_AWT_LIBRARY)
   SET(KIT_JAVA_LIBS ${KIT_JAVA_LIBS} ${JAVA_AWT_LIBRARY})
@@ -352,10 +353,12 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(Kit_TCL_EXTRA_CMDS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 IF (TK_LIBRARY AND VTK_USE_TK)
@@ -429,6 +432,33 @@
    ENDIF(VTK_USE_TK)
 ENDIF (VTK_WRAP_PYTHON)
 
+IF (VTK_WRAP_RUBY)
+  IF(VTK_USE_TK)
+    IF (TK_LIBRARY)
+       SET(RenderingRubyTkWidgets_SRCS
+          vtkTkWidgetsInit.cxx
+          vtkTkRenderWidgetRuby.cxx
+          vtkTkImageViewerWidgetRuby.cxx
+          )
+       ADD_LIBRARY(vtkRenderingRubyTkWidgets SHARED
+                   ${RenderingRubyTkWidgets_SRCS})
+       TARGET_LINK_LIBRARIES (vtkRenderingRubyTkWidgets
+                              vtk${KIT}
+                              ${VTK_TK_LIBRARIES})
+
+       # Apply user-defined properties to the library target.
+       IF(VTK_LIBRARY_PROPERTIES)
+         SET_TARGET_PROPERTIES(vtkRenderingRubyTkWidgets PROPERTIES
+           ${VTK_LIBRARY_PROPERTIES})
+       ENDIF(VTK_LIBRARY_PROPERTIES)
+
+       IF(NOT VTK_INSTALL_NO_LIBRARIES)
+         INSTALL_TARGETS(${VTK_INSTALL_LIB_DIR} vtkRenderingRubyTkWidgets)
+       ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
+     ENDIF (TK_LIBRARY)
+   ENDIF(VTK_USE_TK)
+ENDIF (VTK_WRAP_RUBY)
+
 IF(VTK_USE_X)
   TARGET_LINK_LIBRARIES(vtk${KIT} -lXt ${X11_LIBRARIES})
 ENDIF(VTK_USE_X)
diff -uNr VTK_org/Rendering/vtkTkImageViewerWidget.cxx VTK/Rendering/vtkTkImageViewerWidget.cxx
--- VTK_org/Rendering/vtkTkImageViewerWidget.cxx	2005-09-01 07:55:26.000000000 +0900
+++ VTK/Rendering/vtkTkImageViewerWidget.cxx	2009-01-25 13:53:16.000000000 +0900
@@ -578,9 +578,11 @@
     // Make the ImageViewer window.
     self->ImageViewer = imgViewer = vtkImageViewer::New();
 #ifndef VTK_PYTHON_BUILD
+#ifndef VTK_RUBY_BUILD
     vtkTclGetObjectFromPointer(self->Interp, self->ImageViewer,
                                "vtkImageViewer");
 #endif
+#endif
     ckfree (self->IV);
     self->IV = strdup(self->Interp->result);
     self->Interp->result[0] = '\0';
@@ -598,12 +600,16 @@
     else
       {
 #ifndef VTK_PYTHON_BUILD
+#ifndef VTK_RUBY_BUILD
       imgViewer = (vtkImageViewer *)
         vtkTclGetPointerFromObject(self->IV, "vtkImageViewer", self->Interp,
                                    new_flag);
 #else
       imgViewer = 0;
 #endif
+#else
+      imgViewer = 0;
+#endif
       }
     if (imgViewer != self->ImageViewer)
       {
@@ -752,9 +758,11 @@
     // Make the ImageViewer window.
     self->ImageViewer = imgViewer = vtkImageViewer::New();
 #ifndef VTK_PYTHON_BUILD
+#ifndef VTK_RUBY_BUILD
     vtkTclGetObjectFromPointer(self->Interp, self->ImageViewer,
                                "vtkImageViewer");
 #endif
+#endif
     ckfree (self->IV);
     self->IV = strdup(self->Interp->result);
     self->Interp->result[0] = '\0';
@@ -772,11 +780,13 @@
     else
       {
 #ifndef VTK_PYTHON_BUILD
+#ifndef VTK_RUBY_BUILD
       int new_flag;
       imgViewer = (vtkImageViewer *)
         vtkTclGetPointerFromObject(self->IV, "vtkImageViewer", self->Interp,
                                    new_flag);
 #endif
+#endif
       }
     if (imgViewer != self->ImageViewer)
       {
@@ -879,9 +889,11 @@
     // Make the ImageViewer window.
     self->ImageViewer = imgViewer = vtkImageViewer::New();
 #ifndef VTK_PYTHON_BUILD
+#ifndef VTK_RUBY_BUILD
     vtkTclGetObjectFromPointer(self->Interp, self->ImageViewer,
                                "vtkImageViewer");
 #endif
+#endif
     self->IV = strdup(self->Interp->result);
     self->Interp->result[0] = '\0';
     }
@@ -898,11 +910,13 @@
     else
       {
 #ifndef VTK_PYTHON_BUILD
+#ifndef VTK_RUBY_BUILD
       int new_flag;
       imgViewer = (vtkImageViewer *)
         vtkTclGetPointerFromObject(self->IV, "vtkImageViewer", self->Interp,
                                    new_flag);
 #endif
+#endif
       }
     if (imgViewer != self->ImageViewer)
       {
diff -uNr VTK_org/Rendering/vtkTkImageViewerWidget.h VTK/Rendering/vtkTkImageViewerWidget.h
--- VTK_org/Rendering/vtkTkImageViewerWidget.h	2004-12-15 23:35:04.000000000 +0900
+++ VTK/Rendering/vtkTkImageViewerWidget.h	2009-01-25 13:53:16.000000000 +0900
@@ -32,8 +32,10 @@
 #include "vtkTcl.h"
 #include "vtkTk.h"
 #ifndef VTK_PYTHON_BUILD
+#ifndef VTK_RUBY_BUILD
 #include "vtkTclUtil.h"
 #endif
+#endif
 #include "vtkWindows.h"
 
 struct vtkTkImageViewerWidget
diff -uNr VTK_org/Rendering/vtkTkImageViewerWidgetRuby.cxx VTK/Rendering/vtkTkImageViewerWidgetRuby.cxx
--- VTK_org/Rendering/vtkTkImageViewerWidgetRuby.cxx	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Rendering/vtkTkImageViewerWidgetRuby.cxx	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,18 @@
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile: vtkTkImageViewerWidgetRuby.cxx,v $
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+
+#define VTK_RUBY_BUILD
+#include "vtkTkImageViewerWidget.cxx"
+
diff -uNr VTK_org/Rendering/vtkTkRenderWidget.cxx VTK/Rendering/vtkTkRenderWidget.cxx
--- VTK_org/Rendering/vtkTkRenderWidget.cxx	2006-05-11 02:52:08.000000000 +0900
+++ VTK/Rendering/vtkTkRenderWidget.cxx	2009-01-25 13:53:16.000000000 +0900
@@ -30,7 +30,8 @@
 #else
 #include "vtkXOpenGLRenderWindow.h"
 #endif
-#endif 
+#endif
+
 
 #define VTK_ALL_EVENTS_MASK \
     KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|      \
@@ -159,7 +160,7 @@
       }
 
     // Find the image
-#ifdef VTK_PYTHON_BUILD
+#if defined(VTK_PYTHON_BUILD) || defined(VTK_RUBY_BUILD)
     void *ptr;
     char typeCheck[128];
     sscanf ( argv[1], "_%lx_%s", (long *)&ptr, typeCheck);
@@ -902,7 +903,7 @@
     self->RenderWindow->Register(NULL);
     self->RenderWindow->Delete();
     renderWindow = (vtkWin32OpenGLRenderWindow *)(self->RenderWindow);
-#ifndef VTK_PYTHON_BUILD
+#if !defined(VTK_PYTHON_BUILD) && !defined(VTK_RUBY_BUILD)
     vtkTclGetObjectFromPointer(self->Interp, self->RenderWindow,
                                "vtkRenderWindow");
 #endif
@@ -922,7 +923,7 @@
       }
     else
       {
-#ifndef VTK_PYTHON_BUILD
+#if ! defined(VTK_PYTHON_BUILD) && ! defined(VTK_RUBY_BUILD)
       renderWindow = (vtkWin32OpenGLRenderWindow *)
         vtkTclGetPointerFromObject(self->RW, "vtkRenderWindow", self->Interp,
                                    new_flag);
@@ -1078,7 +1079,7 @@
     self->RenderWindow->Register(NULL);
     self->RenderWindow->Delete();
     renderWindow = (vtkCarbonRenderWindow *)(self->RenderWindow);
-#ifndef VTK_PYTHON_BUILD
+#if ! defined(VTK_PYTHON_BUILD) && ! defined(VTK_RUBY_BUILD)
     vtkTclGetObjectFromPointer(self->Interp, self->RenderWindow,
           "vtkRenderWindow");
 #endif
@@ -1098,7 +1099,7 @@
       }
     else
       {
-#ifndef VTK_PYTHON_BUILD
+#if ! defined(VTK_PYTHON_BUILD) && ! defined(VTK_RUBY_BUILD)
       int new_flag;
       renderWindow = (vtkCarbonRenderWindow *)
         vtkTclGetPointerFromObject(self->RW,"vtkRenderWindow",self->Interp, 
@@ -1250,7 +1251,7 @@
     self->RenderWindow->Register(NULL);
     self->RenderWindow->Delete();
     renderWindow = (vtkXOpenGLRenderWindow *)(self->RenderWindow);
-#ifndef VTK_PYTHON_BUILD
+#if ! defined(VTK_PYTHON_BUILD) && ! defined(VTK_RUBY_BUILD)
     vtkTclGetObjectFromPointer(self->Interp, self->RenderWindow,
           "vtkRenderWindow");
 #endif
@@ -1270,7 +1271,7 @@
       }
     else
       {
-#ifndef VTK_PYTHON_BUILD
+#if ! defined(VTK_PYTHON_BUILD) && ! defined(VTK_RUBY_BUILD)
       int new_flag;
       renderWindow = (vtkXOpenGLRenderWindow *)
         vtkTclGetPointerFromObject(self->RW,"vtkRenderWindow",self->Interp, 
diff -uNr VTK_org/Rendering/vtkTkRenderWidget.h VTK/Rendering/vtkTkRenderWidget.h
--- VTK_org/Rendering/vtkTkRenderWidget.h	2006-03-08 02:03:11.000000000 +0900
+++ VTK/Rendering/vtkTkRenderWidget.h	2009-01-25 13:53:16.000000000 +0900
@@ -40,8 +40,10 @@
 #include "vtkTk.h"
 
 #ifndef VTK_PYTHON_BUILD
+#ifndef VTK_RUBY_BUILD
 #include "vtkTclUtil.h"
 #endif
+#endif
 
 struct vtkTkRenderWidget
 {
diff -uNr VTK_org/Rendering/vtkTkRenderWidgetRuby.cxx VTK/Rendering/vtkTkRenderWidgetRuby.cxx
--- VTK_org/Rendering/vtkTkRenderWidgetRuby.cxx	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Rendering/vtkTkRenderWidgetRuby.cxx	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,17 @@
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile: vtkTkRenderWidgetRuby.cxx,v $
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+
+#define VTK_RUBY_BUILD
+#include "vtkTkRenderWidget.cxx"
diff -uNr VTK_org/Rendering/vtkTkWidgetsInit.cxx VTK/Rendering/vtkTkWidgetsInit.cxx
--- VTK_org/Rendering/vtkTkWidgetsInit.cxx	2005-09-01 07:55:26.000000000 +0900
+++ VTK/Rendering/vtkTkWidgetsInit.cxx	2009-01-25 13:53:16.000000000 +0900
@@ -24,6 +24,7 @@
 // Vtkrenderingpythontkwidgets_Init
 // Called upon system startup to create the widget commands.
 extern "C" {VTK_TK_EXPORT int Vtkrenderingpythontkwidgets_Init(Tcl_Interp *interp);}
+extern "C" {VTK_TK_EXPORT int Vtkrenderingrubytkwidgets_Init(Tcl_Interp *interp);}
 
 extern "C" {VTK_TK_EXPORT int Vtktkrenderwidget_Init(Tcl_Interp *interp);}
 extern "C" {VTK_TK_EXPORT int Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
@@ -49,3 +50,20 @@
     return TCL_ERROR;
     }
 }
+
+int Vtkrenderingrubytkwidgets_Init(Tcl_Interp *interp)
+{
+  // Forward the call to the real init functions.
+  if(Vtktkrenderwidget_Init(interp) == TCL_OK &&
+     Vtktkimageviewerwidget_Init(interp) == TCL_OK)
+    {
+    // Report that the package is provided.
+    return Tcl_PkgProvide(interp, (char*)"Vtkrenderingpythontkwidgets",
+                          (char*)VTKTK_VERSION);
+    }
+  else
+    {
+    // One of the widgets is not provided.
+    return TCL_ERROR;
+    }
+}
diff -uNr VTK_org/VolumeRendering/CMakeLists.txt VTK/VolumeRendering/CMakeLists.txt
--- VTK_org/VolumeRendering/CMakeLists.txt	2005-09-01 22:30:21.000000000 +0900
+++ VTK/VolumeRendering/CMakeLists.txt	2009-01-25 13:53:19.000000000 +0900
@@ -3,15 +3,18 @@
 
 SET(KIT_TCL_LIBS vtkRenderingTCL vtkIOTCL)
 SET(KIT_PYTHON_LIBS vtkRenderingPythonD vtkIOPythonD)
+SET(KIT_RUBY_LIBS vtkRenderingRubyD vtkIORubyD)
 SET(KIT_JAVA_LIBS vtkRenderingJava vtkIOJava)
 SET(KIT_LIBS vtkRendering vtkIO)
 SET(Kit_EXTRA_SRCS)
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 SET ( Kit_SRCS
diff -uNr VTK_org/VTKConfig.cmake.in VTK/VTKConfig.cmake.in
--- VTK_org/VTKConfig.cmake.in	2006-06-10 03:51:48.000000000 +0900
+++ VTK/VTKConfig.cmake.in	2009-01-25 13:53:16.000000000 +0900
@@ -83,6 +83,7 @@
 SET(VTK_USE_X "@VTK_USE_X@")
 SET(VTK_WRAP_JAVA "@VTK_WRAP_JAVA@")
 SET(VTK_WRAP_PYTHON "@VTK_WRAP_PYTHON@")
+SET(VTK_WRAP_RUBY "@VTK_WRAP_RUBY@")
 SET(VTK_WRAP_TCL "@VTK_WRAP_TCL@")
 SET(VTK_LEGACY_REMOVE "@VTK_LEGACY_REMOVE@")
 SET(VTK_LEGACY_SILENT "@VTK_LEGACY_SILENT@")
diff -uNr VTK_org/vtkGenerateVTKConfig.cmake VTK/vtkGenerateVTKConfig.cmake
--- VTK_org/vtkGenerateVTKConfig.cmake	2007-02-07 03:51:59.000000000 +0900
+++ VTK/vtkGenerateVTKConfig.cmake	2009-01-25 13:53:17.000000000 +0900
@@ -67,6 +67,8 @@
 SET(VTK_WRAP_JAVA_EXE_CONFIG "")
 SET(VTK_WRAP_PYTHON_EXE_CONFIG "")
 SET(VTK_WRAP_PYTHON_INIT_EXE_CONFIG "")
+SET(VTK_WRAP_RUBY_EXE_CONFIG "")
+SET(VTK_WRAP_RUBY_INIT_EXE_CONFIG "")
 SET(VTK_WRAP_TCL_EXE_CONFIG "")
 SET(VTK_WRAP_TCL_INIT_EXE_CONFIG "")
 IF(VTK_WRAP_TCL)
@@ -78,6 +80,10 @@
   SET(VTK_WRAP_PYTHON_EXE_CONFIG ${VTK_WRAP_PYTHON_EXE})
   SET(VTK_WRAP_PYTHON_INIT_EXE_CONFIG ${VTK_WRAP_PYTHON_INIT_EXE})
 ENDIF(VTK_WRAP_PYTHON)
+IF(VTK_WRAP_RUBY)
+  SET(VTK_WRAP_RUBY_EXE_CONFIG ${VTK_WRAP_RUBY_EXE})
+  SET(VTK_WRAP_RUBY_INIT_EXE_CONFIG ${VTK_WRAP_RUBY_INIT_EXE})
+ENDIF(VTK_WRAP_RUBY)
 IF(VTK_WRAP_JAVA)
   SET(VTK_PARSE_JAVA_EXE_CONFIG ${VTK_PARSE_JAVA_EXE})
   SET(VTK_WRAP_JAVA_EXE_CONFIG ${VTK_WRAP_JAVA_EXE})
@@ -187,6 +193,8 @@
 SET(VTK_WRAP_JAVA_EXE_CONFIG "")
 SET(VTK_WRAP_PYTHON_EXE_CONFIG "")
 SET(VTK_WRAP_PYTHON_INIT_EXE_CONFIG "")
+SET(VTK_WRAP_RUBY_EXE_CONFIG "")
+SET(VTK_WRAP_RUBY_INIT_EXE_CONFIG "")
 SET(VTK_WRAP_TCL_EXE_CONFIG "")
 SET(VTK_WRAP_TCL_INIT_EXE_CONFIG "")
 SET(VTK_DOXYGEN_HOME_CONFIG "")
@@ -199,6 +207,10 @@
   SET(VTK_WRAP_PYTHON_EXE_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_BIN_DIR}/vtkWrapPython${VTK_EXE_EXT})
   SET(VTK_WRAP_PYTHON_INIT_EXE_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_BIN_DIR}/vtkWrapPythonInit${VTK_EXE_EXT})
 ENDIF(VTK_WRAP_PYTHON)
+IF(VTK_WRAP_RUBY)
+  SET(VTK_WRAP_RUBY_EXE_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_BIN_DIR}/vtkWrapRuby${VTK_EXE_EXT})
+  SET(VTK_WRAP_RUBY_INIT_EXE_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_BIN_DIR}/vtkWrapRUBYInit${VTK_EXE_EXT})
+ENDIF(VTK_WRAP_RUBY)
 IF(VTK_WRAP_JAVA)
   SET(VTK_PARSE_JAVA_EXE_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_BIN_DIR}/vtkParseJava${VTK_EXE_EXT})
   SET(VTK_WRAP_JAVA_EXE_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_BIN_DIR}/vtkWrapJava${VTK_EXE_EXT})
diff -uNr VTK_org/vtkIncludeDirectories.cmake VTK/vtkIncludeDirectories.cmake
--- VTK_org/vtkIncludeDirectories.cmake	2005-08-30 04:01:14.000000000 +0900
+++ VTK/vtkIncludeDirectories.cmake	2009-01-25 13:53:16.000000000 +0900
@@ -50,6 +50,12 @@
       ${PYTHON_INCLUDE_PATH})
 ENDIF(VTK_WRAP_PYTHON)
 
+IF(VTK_WRAP_RUBY)
+  # Ruby include directory.
+  SET(VTK_INCLUDE_DIRS_SYSTEM ${VTK_INCLUDE_DIRS_SYSTEM}
+      ${RUBY_INCLUDE_PATH})
+ENDIF(VTK_WRAP_RUBY)
+
 # VTK_INCLUDE_NEED_TK is set in toplevel CMakeLists.txt file.
 IF(VTK_INCLUDE_NEED_TK)
   # Tcl/Tk include directories.
diff -uNr VTK_org/vtkMacros.cmake VTK/vtkMacros.cmake
--- VTK_org/vtkMacros.cmake	2004-08-20 10:04:54.000000000 +0900
+++ VTK/vtkMacros.cmake	2009-01-25 13:53:19.000000000 +0900
@@ -71,6 +71,33 @@
 
 
 #
+# generate Ruby wrappers etc
+#
+# takes arguments:
+#   KIT e.g. Common IO
+#   DEPENDS e.g. vtkCommonTCL41
+#
+MACRO(VTK_USE_RUBY KIT DEPEND)
+  IF (VTK_WRAP_RUBY)
+    VTK_WRAP_RUBY(vtk${KIT}Ruby${VTK_VERSION} 
+      ${KIT}Ruby_SRCS ${${KIT}_SRCS})
+    ADD_LIBRARY(vtk${KIT}Ruby${VTK_VERSION} MODULE ${${KIT}Ruby_SRCS})
+    IF (NOT APPLE)
+      TARGET_LINK_LIBRARIES (vtk${KIT}Ruby${VTK_VERSION} ${DEPEND})
+    ENDIF (NOT APPLE)
+    IF(WIN32)
+      TARGET_LINK_LIBRARIES (vtk${KIT}Ruby${VTK_VERSION}
+                             debug ${RUBY_DEBUG_LIBRARY}
+                             optimized ${RUBY_LIBRARY})
+    ENDIF(WIN32)
+    TARGET_LINK_LIBRARIES(vtk${KIT}Ruby${VTK_VERSION} 
+      vtk${KIT}${VTK_VERSION})
+    INSTALL_TARGETS(/lib vtk${KIT}Ruby${VTK_VERSION})
+  ENDIF (VTK_WRAP_RUBY)
+ENDMACRO(VTK_USE_RUBY)
+
+
+#
 # generate Python wrappers etc
 #
 # takes arguments:
diff -uNr VTK_org/vtkToolkits.h.in VTK/vtkToolkits.h.in
--- VTK_org/vtkToolkits.h.in	2007-01-30 06:16:24.000000000 +0900
+++ VTK/vtkToolkits.h.in	2009-01-25 13:53:17.000000000 +0900
@@ -44,6 +44,7 @@
 
 #cmakedefine VTK_WRAP_TCL
 #cmakedefine VTK_WRAP_PYTHON
+#cmakedefine VTK_WRAP_RUBY
 #cmakedefine VTK_WRAP_JAVA
 
 /*--------------------------------------------------------------------------*/
@@ -83,6 +84,9 @@
 /* Whether the user has linked in the MPEG2 library or not  */
 #cmakedefine VTK_USE_MPEG2_ENCODER
 
+/* Whether the real ruby debug library has been provided.  */
+#cmakedefine VTK_WINDOWS_RUBY_DEBUGGABLE
+
 /*--------------------------------------------------------------------------*/
 /* Setup VTK based on platform features and configuration.                  */
 
diff -uNr VTK_org/Widgets/CMakeLists.txt VTK/Widgets/CMakeLists.txt
--- VTK_org/Widgets/CMakeLists.txt	2005-08-13 04:56:24.000000000 +0900
+++ VTK/Widgets/CMakeLists.txt	2009-01-25 13:53:15.000000000 +0900
@@ -3,6 +3,7 @@
 
 SET(KIT_TCL_LIBS vtkRenderingTCL vtkHybridTCL)
 SET(KIT_PYTHON_LIBS vtkRenderingPythonD vtkHybridPythonD)
+SET(KIT_RUBY_LIBS vtkRenderingRubyD vtkHybridRubyD)
 SET(KIT_JAVA_LIBS vtkRenderingJava vtkHybridJava)
 SET(KIT_LIBS vtkRendering vtkHybrid)
 
@@ -33,9 +34,11 @@
 SET(Kit_EXTRA_CMDS)
 SET(Kit_TCL_EXTRA_SRCS)
 SET(Kit_PYTHON_EXTRA_SRCS)
+SET(Kit_RUBY_EXTRA_SRCS)
 SET(Kit_JAVA_EXTRA_SRCS)
 SET(KIT_TCL_DEPS)
 SET(KIT_PYTHON_DEPS)
+SET(KIT_RUBY_DEPS)
 SET(KIT_JAVA_DEPS)
 
 #-----------------------------------------------------------------------------
diff -uNr VTK_org/Wrapping/CMakeLists.txt VTK/Wrapping/CMakeLists.txt
--- VTK_org/Wrapping/CMakeLists.txt	2005-07-12 03:13:05.000000000 +0900
+++ VTK/Wrapping/CMakeLists.txt	2009-01-25 13:53:16.000000000 +0900
@@ -22,6 +22,15 @@
   ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
 ENDIF (VTK_WRAP_PYTHON)
 
+IF (VTK_WRAP_RUBY)
+  ADD_EXECUTABLE(vtkWrapRuby vtkWrapRuby.c vtkParse.tab.c)
+  ADD_EXECUTABLE(vtkWrapRubyInit vtkWrapRubyInit.c)
+  TARGET_LINK_LIBRARIES(vtkWrapRuby ${VTK_RUBY_LIBRARIES})
+  IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+    INSTALL_TARGETS(${VTK_INSTALL_BIN_DIR} vtkWrapRuby vtkWrapRubyInit)
+  ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+ENDIF (VTK_WRAP_RUBY)
+
 IF (VTK_WRAP_JAVA)
   ADD_EXECUTABLE(vtkParseJava vtkParseJava.c vtkParse.tab.c)
   ADD_EXECUTABLE(vtkWrapJava vtkWrapJava.c vtkParse.tab.c)
diff -uNr VTK_org/Wrapping/Ruby/CMakeLists.txt VTK/Wrapping/Ruby/CMakeLists.txt
--- VTK_org/Wrapping/Ruby/CMakeLists.txt	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/CMakeLists.txt	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,352 @@
+# create the VTK/Ruby  executable
+CONFIGURE_FILE(${VTK_SOURCE_DIR}/Wrapping/Ruby/vtkRubyAppInitConfigure.h.in
+               ${VTK_BINARY_DIR}/Wrapping/Ruby/vtkRubyAppInitConfigure.h)
+
+ADD_EXECUTABLE(vtkruby vtkRubyAppInit.cxx)
+IF(CMAKE_SYSTEM_NAME MATCHES "AIX")
+  GET_FILENAME_COMPONENT(CMAKE_RUBY_LIB_PREFIX "${RUBY_LIBRARY}" PATH)
+  FIND_FILE(CMAKE_RUBY_LIBRARY_EXPORT ruby.exp "${CMAKE_RUBY_LIB_PREFIX}")
+  SET_TARGET_PROPERTIES( vtkruby PROPERTIES LINK_FLAGS
+    "-Wl,-bE:${CMAKE_RUBY_LIBRARY_EXPORT}")
+ENDIF(CMAKE_SYSTEM_NAME MATCHES "AIX")
+
+IF(VTK_USE_CARBON)
+  FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools)
+  IF(VTK_APPLE_RESOURCE)
+    ADD_CUSTOM_COMMAND(
+      SOURCE vtkruby
+      COMMAND ${VTK_APPLE_RESOURCE}
+      ARGS Carbon.r -o ${VTK_EXECUTABLE_DIR}/vtkruby
+      TARGET vtkruby
+      )
+  ENDIF(VTK_APPLE_RESOURCE)
+ENDIF(VTK_USE_CARBON)
+
+
+IF (APPLE)
+  SET_TARGET_PROPERTIES(vtkruby PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress -u _RuMac_Error")
+ENDIF (APPLE)
+
+# Link against all the kit wrappers.
+TARGET_LINK_LIBRARIES(vtkruby
+  ${VTK_RUBY_LIBRARIES}
+  vtksys
+  vtkCommon
+  vtkFiltering
+  vtkIO
+  vtkGraphics
+  vtkImaging)
+
+SET (vtkruby_install_depends
+    vtkCommonRuby
+    vtkFilteringRuby
+    vtkIORuby
+    vtkGraphicsRuby
+    vtkImagingRuby
+    )
+
+IF(VTK_WRAP_TCL)
+  TARGET_LINK_LIBRARIES(vtkruby ${VTK_TK_LIBRARIES})
+ENDIF(VTK_WRAP_TCL)
+
+IF(BORLAND)
+  SET(KITS Common Filtering Graphics IO Imaging)
+  IF (VTK_USE_PARALLEL)
+    SET(KITS ${KITS} Parallel)
+  ENDIF(VTK_USE_PARALLEL)
+  IF (VTK_USE_RENDERING)
+    SET(KITS ${KITS} Widgets)
+    SET(KITS ${KITS} Hybrid)
+    SET(KITS ${KITS} VolumeRendering)
+    SET(KITS ${KITS} Rendering)
+  ENDIF(VTK_USE_RENDERING)
+  FOREACH(KIT ${KITS})
+    WRITE_FILE(${LIBRARY_OUTPUT_PATH}/vtk${KIT}Ruby.def
+               "EXPORTS\ninitvtk${KIT}Ruby=_initvtk${KIT}Ruby\n")
+  ENDFOREACH(KIT)
+ENDIF(BORLAND)
+
+
+IF (VTK_USE_RENDERING)
+  TARGET_LINK_LIBRARIES(vtkruby vtkRendering)
+  TARGET_LINK_LIBRARIES(vtkruby vtkVolumeRendering)
+  TARGET_LINK_LIBRARIES(vtkruby vtkHybrid)
+  TARGET_LINK_LIBRARIES(vtkruby vtkWidgets)
+   SET (vtkruby_install_depends
+       ${vtkruby_install_depends}
+       vtkRenderingRuby
+       vtkVolumeRenderingRuby
+       vtkHybridRuby
+       vtkWidgetsRuby
+       )
+ENDIF (VTK_USE_RENDERING)
+
+IF (VTK_USE_PARALLEL)
+  TARGET_LINK_LIBRARIES(vtkruby vtkParallel)
+   SET(vtkruby_install_depends
+      ${vtkruby_install_depends}
+      vtkParallelRuby
+      )
+ENDIF (VTK_USE_PARALLEL)
+
+# Link to rt to prevent undefined symbol 'fdatasync'
+
+IF(CMAKE_SYSTEM MATCHES "SunOS.*")
+  IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+    FIND_LIBRARY(VTK_SUNCC_RT_LIBRARY rt /usr/lib)
+    IF(VTK_SUNCC_RT_LIBRARY)
+      TARGET_LINK_LIBRARIES(vtkruby ${VTK_SUNCC_RT_LIBRARY})
+    ENDIF(VTK_SUNCC_RT_LIBRARY)
+  ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
+
+# Create the pvtkruby Ruby wrapper executable with MPI support.
+IF (VTK_USE_PARALLEL)
+  IF (VTK_USE_MPI)
+    ADD_EXECUTABLE(pvtkruby vtkParaRubyAppInit.cxx)
+    IF(CMAKE_SYSTEM_NAME MATCHES "AIX")
+      SET_TARGET_PROPERTIES( pvtkruby PROPERTIES LINK_FLAGS
+        "-Wl,-bE:${CMAKE_RUBY_LIBRARY_EXPORT}")
+    ENDIF(CMAKE_SYSTEM_NAME MATCHES "AIX")
+    IF(VTK_USE_CARBON)
+      FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools)
+      IF(VTK_APPLE_RESOURCE)
+        ADD_CUSTOM_COMMAND(
+          SOURCE pvtkruby
+          COMMAND ${VTK_APPLE_RESOURCE}
+          ARGS Carbon.r -o ${VTK_EXECUTABLE_DIR}/pvtkruby
+          TARGET pvtkruby
+          )
+      ENDIF(VTK_APPLE_RESOURCE)
+    ENDIF(VTK_USE_CARBON)
+
+    TARGET_LINK_LIBRARIES (pvtkruby
+      ${VTK_RUBY_LIBRARIES}
+      vtksys
+      vtkCommon
+      vtkFiltering
+      vtkIO
+      vtkGraphics
+      vtkImaging
+      vtkParallel
+    )
+    IF (VTK_USE_RENDERING)
+      TARGET_LINK_LIBRARIES(pvtkruby vtkVolumeRendering)
+      TARGET_LINK_LIBRARIES(pvtkruby vtkHybrid)
+      TARGET_LINK_LIBRARIES(pvtkruby vtkWidgets)
+    ENDIF (VTK_USE_RENDERING)
+    IF(NOT VTK_INSTALL_NO_RUNTIME)
+      INSTALL_TARGETS(${VTK_INSTALL_BIN_DIR} pvtkruby)
+    ENDIF(NOT VTK_INSTALL_NO_RUNTIME)
+  ENDIF (VTK_USE_MPI)
+ENDIF (VTK_USE_PARALLEL)
+
+IF(NOT VTK_INSTALL_NO_RUNTIME)
+  INSTALL_TARGETS(${VTK_INSTALL_BIN_DIR} vtkruby)
+ENDIF(NOT VTK_INSTALL_NO_RUNTIME)
+
+# Handle out-of-source builds correctly.
+#
+#  1. Create a list of Ruby files to be installed/copied.
+#  2. Copy them to ruby directory
+#
+# *** Step 1 has to be done carefully to avoid missing out files ***
+
+IF(RUBY_EXECUTABLE)
+# Make the necessary directories.
+  FOREACH(dir
+    ${VTK_BINARY_DIR}/Wrapping/Ruby/vtk/tk
+    ${VTK_BINARY_DIR}/Wrapping/Ruby/vtk/gtk
+    ${VTK_BINARY_DIR}/Wrapping/Ruby/vtk/util
+    )
+    MAKE_DIRECTORY(${dir})
+  ENDFOREACH(dir)
+
+# Now create a list of Ruby files.
+
+# vtk/util package
+  SET(VTK_RUBY_FILES
+    vtk
+    vtk/common
+    vtk/filtering
+    vtk/genericfiltering
+    vtk/graphics
+    vtk/hybrid
+    vtk/imaging
+    vtk/io
+    vtk/parallel
+    vtk/rendering
+    vtk/volumerendering
+    vtk/widgets
+  )
+
+  SET(VTK_RUBY_FILES
+    ${VTK_RUBY_FILES}
+    vtk/util
+    vtk/util/misc
+    vtk/util/vtkConstants
+    vtk/util/vtkImageExportToArray
+    vtk/util/vtkImageImportFromArray
+    vtk/util/colors
+    )
+
+# vtk/gtk package
+  SET(VTK_RUBY_FILES
+    ${VTK_RUBY_FILES}
+    vtk/gtk
+    vtk/gtk/GtkVTKRenderWindow
+    vtk/gtk/GtkVTKRenderWindowInteractor
+    vtk/gtk/GtkGLExtVTKRenderWindow
+    vtk/gtk/GtkGLExtVTKRenderWindowInteractor
+    )
+
+# vtk/ttk package
+  SET(VTK_RUBY_FILES
+    ${VTK_RUBY_FILES}
+    vtk/tk
+    vtk/tk/vtkLoadRubyTkWidgets
+    vtk/tk/vtkTkRenderWidget
+    vtk/tk/vtkTkRenderWindowInteractor
+    vtk/tk/vtkTkImageViewerWidget
+    vtk/tk/vtkTkPhotoImage
+    )
+
+# Done listing of files.
+
+# Now copy these files if necessary.
+  SET(VTK_RUBY_SOURCE_FILES)
+  SET(VTK_RUBY_OUTPUT_FILES)
+  FOREACH(file ${VTK_RUBY_FILES})
+    SET(src "${VTK_BINARY_DIR}/Wrapping/Ruby/${file}.rb")
+    SET(VTK_RUBY_SOURCE_FILES ${VTK_RUBY_SOURCE_FILES} ${src})
+  ENDFOREACH(file)
+
+  IF ("${VTK_BINARY_DIR}" MATCHES "^${VTK_SOURCE_DIR}$")
+    #MESSAGE("In source build -- no need to copy Ruby files")
+  ELSE ("${VTK_BINARY_DIR}" MATCHES "^${VTK_SOURCE_DIR}$")
+    FOREACH(file ${VTK_RUBY_FILES})
+      SET(src "${VTK_SOURCE_DIR}/Wrapping/Ruby/${file}.rb")
+      SET(tgt "${VTK_BINARY_DIR}/Wrapping/Ruby/${file}.rb")
+      ADD_CUSTOM_COMMAND(DEPENDS ${src}
+                         COMMAND ${CMAKE_COMMAND}
+                         ARGS -E copy ${src} ${tgt}
+                         OUTPUT ${tgt}
+                         COMMENT "source copy")
+    ENDFOREACH(file)
+  ENDIF ("${VTK_BINARY_DIR}" MATCHES "^${VTK_SOURCE_DIR}$")
+
+  # Dummy command
+  IF ("${VTK_BINARY_DIR}" MATCHES "^${VTK_SOURCE_DIR}$")
+  ELSE ("${VTK_BINARY_DIR}" MATCHES "^${VTK_SOURCE_DIR}$")
+    SET(src "${VTK_SOURCE_DIR}/Wrapping/Ruby/vtk_dummy.rb")
+    SET(tgt "${VTK_BINARY_DIR}/Wrapping/Ruby/vtk_dummy.rb")
+    ADD_CUSTOM_COMMAND(DEPENDS ${src}
+                       COMMAND ${CMAKE_COMMAND}
+                       ARGS -E copy ${src} ${tgt}
+                       OUTPUT ${tgt}
+                       COMMENT "vtk_dummy.rb copy")
+  ENDIF ("${VTK_BINARY_DIR}" MATCHES "^${VTK_SOURCE_DIR}$")
+  ADD_CUSTOM_COMMAND(
+    COMMAND ${RUBY_EXECUTABLE}
+    ARGS ${VTK_BINARY_DIR}/Wrapping/Ruby/vtk_dummy.rb
+    DEPENDS ${VTK_RUBY_SOURCE_FILES} ${VTK_BINARY_DIR}/Wrapping/Ruby/vtk_dummy.rb
+    OUTPUT "${VTK_BINARY_DIR}/Wrapping/Ruby/vtk_dummy_complete"
+    )
+  ADD_CUSTOM_TARGET(vtkruby_install ALL echo "..."
+    DEPENDS "${VTK_BINARY_DIR}/Wrapping/Ruby/vtk_dummy_complete")
+  ADD_DEPENDENCIES(vtkruby_install
+      vtkruby
+      ${vtkruby_install_depends})
+
+  # If no runtime is to be installed then do not install ruby modules.
+  IF(VTK_INSTALL_NO_RUNTIME)
+    SET(VTK_INSTALL_NO_RUBY 1)
+  ENDIF(VTK_INSTALL_NO_RUNTIME)
+
+  # Add a rule to use ruby distutils to install the ruby wrappers.
+  IF(NOT VTK_INSTALL_NO_RUBY)
+    SET(DOLLAR "$")
+
+    # Create default python setup arguments if they are not set.
+    IF(DEFINED VTK_RUBY_SETUP_ARGS)
+    ELSE(DEFINED VTK_RUBY_SETUP_ARGS)
+      SET(VTK_RUBY_SETUP_ARGS "--prefix=\"\""
+        CACHE STRING "Arguments passed to \"ruby setup.rb install ...\" during installation.")
+      MARK_AS_ADVANCED(VTK_RUBY_SETUP_ARGS)
+    ENDIF(DEFINED VTK_RUBY_SETUP_ARGS)
+
+    IF(DEFINED VTK_RUBY_LIB_DIR)
+    ELSE(DEFINED VTK_RUBY_LIB_DIR)
+      SET(VTK_RUBY_LIB_DIR "")
+      MARK_AS_ADVANCED(VTK_RUBY_LIB_DIR)
+    ENDIF(DEFINED VTK_RUBY_LIB_DIR)
+
+    IF(DEFINED VTK_RUBY_ARCH_DIR)
+    ELSE(DEFINED VTK_RUBY_ARCH_DIR)
+      SET(VTK_RUBY_ARCH_DIR "")
+      MARK_AS_ADVANCED(VTK_RUBY_ARCH_DIR)
+    ENDIF(DEFINED VTK_RUBY_ARCH_DIR)
+
+    # If there are multiple configurations then add a BUILD_TYPE=...
+    # argument to the ruby setup.rb call.  The build type to use is set
+    # in the CMake variable BUILD_TYPE while running the install script.
+    IF(CMAKE_CONFIGURATION_TYPES)
+      SET(VTK_RUBY_SETUP_BUILD_TYPE "BUILD_TYPE=${DOLLAR}{BUILD_TYPE}")
+    ELSE(CMAKE_CONFIGURATION_TYPES)
+      SET(VTK_RUBY_SETUP_BUILD_TYPE)
+    ENDIF(CMAKE_CONFIGURATION_TYPES)
+
+
+    # Configure the post-install script to run ruby on setup.rb.
+    CONFIGURE_FILE(${VTK_SOURCE_DIR}/Wrapping/Ruby/RubyInstall.cmake.in
+                   ${VTK_BINARY_DIR}/Wrapping/Ruby/RubyInstall.cmake
+                   @ONLY IMMEDIATE)
+    SET_TARGET_PROPERTIES(vtkruby_install PROPERTIES POST_INSTALL_SCRIPT
+      ${VTK_BINARY_DIR}/Wrapping/Ruby/RubyInstall.cmake
+      )
+
+
+
+  ENDIF(NOT VTK_INSTALL_NO_RUBY)
+ENDIF(RUBY_EXECUTABLE)
+
+
+# Create the setup.rb file.
+IF(CMAKE_CONFIGURATION_TYPES)
+  # The build has multiple configuration types.  If CMAKE_BUILD_TYPE
+  # is set use it as the default BUILD_TYPE for setup.rb to install.
+  SET(VTK_RUBY_HAS_CONFIG_TYPES 1)
+  IF(CMAKE_BUILD_TYPE)
+    SET(VTK_RUBY_BUILD_TYPE "\"${CMAKE_BUILD_TYPE}\"")
+  ELSE(CMAKE_BUILD_TYPE)
+    SET(VTK_RUBY_BUILD_TYPE "[]")
+  ENDIF(CMAKE_BUILD_TYPE)
+ELSE(CMAKE_CONFIGURATION_TYPES)
+  # The build has one configuration type.  The build type does not
+  # affect installation.
+  SET(VTK_RUBY_HAS_CONFIG_TYPES 0)
+  SET(VTK_RUBY_BUILD_TYPE "[]")
+ENDIF(CMAKE_CONFIGURATION_TYPES)
+IF(VTK_USE_RENDERING)
+  SET(VTK_RUBY_USE_RENDERING 1)
+ELSE(VTK_USE_RENDERING)
+  SET(VTK_RUBY_USE_RENDERING 0)
+ENDIF(VTK_USE_RENDERING)
+IF(VTK_USE_PARALLEL)
+  SET(VTK_RUBY_USE_PARALLEL 1)
+ELSE(VTK_USE_PARALLEL)
+  SET(VTK_RUBY_USE_PARALLEL 0)
+ENDIF(VTK_USE_PARALLEL)
+IF(VTK_USE_MPI)
+  SET(VTK_RUBY_USE_MPI 1)
+ELSE(VTK_USE_MPI)
+  SET(VTK_RUBY_USE_MPI 0)
+ENDIF(VTK_USE_MPI)
+CONFIGURE_FILE(${VTK_SOURCE_DIR}/Wrapping/Ruby/setup.rb.in
+               ${VTK_BINARY_DIR}/Wrapping/Ruby/setup.rb @ONLY IMMEDIATE)
+
+
+# Allow the user to customize their build with some local options
+#
+INCLUDE (${VTK_BINARY_DIR}/Wrapping/Tcl/LocalUserOptions.cmake OPTIONAL)
+INCLUDE (${VTK_SOURCE_DIR}/Wrapping/Tcl/LocalUserOptions.cmake OPTIONAL)
diff -uNr VTK_org/Wrapping/Ruby/conversionlist.in VTK/Wrapping/Ruby/conversionlist.in
--- VTK_org/Wrapping/Ruby/conversionlist.in	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/conversionlist.in	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1 @@
+@CONVERSIONLIST@
diff -uNr VTK_org/Wrapping/Ruby/.cvsignore VTK/Wrapping/Ruby/.cvsignore
--- VTK_org/Wrapping/Ruby/.cvsignore	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/.cvsignore	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1 @@
+*.pyc
diff -uNr VTK_org/Wrapping/Ruby/RubyInstall.cmake.in VTK/Wrapping/Ruby/RubyInstall.cmake.in
--- VTK_org/Wrapping/Ruby/RubyInstall.cmake.in	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/RubyInstall.cmake.in	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,9 @@
+# Configured file and directory locations.
+SET(RUBY_EXECUTABLE "@RUBY_EXECUTABLE@")
+SET(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
+SET(VTK_BINARY_DIR "@VTK_BINARY_DIR@")
+
+# Run ruby on setup.rb to install the ruby modules.
+EXEC_PROGRAM("${RUBY_EXECUTABLE}" "${VTK_BINARY_DIR}/Wrapping/Ruby" ARGS
+  "setup.rb" @VTK_RUBY_SETUP_BUILD_TYPE@ @VTK_RUBY_SETUP_ARGS@
+  )
diff -uNr VTK_org/Wrapping/Ruby/setup.rb.in VTK/Wrapping/Ruby/setup.rb.in
--- VTK_org/Wrapping/Ruby/setup.rb.in	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/setup.rb.in	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,104 @@
+#!/usr/bin/env ruby
+
+require 'rbconfig'
+require 'ftools'
+
+# VTK build configuration settings.
+vtk_version = "@VTK_MAJOR_VERSION@.@VTK_MINOR_VERSION@.@VTK_BUILD_VERSION@"
+vtk_lib_dir = "@LIBRARY_OUTPUT_PATH@"
+vtk_bin_dir = "@EXECUTABLE_OUTPUT_PATH@"
+vtk_use_rendering = @VTK_RUBY_USE_RENDERING@
+vtk_use_parallel = @VTK_RUBY_USE_PARALLEL@
+vtk_use_mpi = @VTK_RUBY_USE_MPI@
+vtk_has_configuration_types = @VTK_RUBY_HAS_CONFIG_TYPES@
+
+vtk_ruby_libdir = "@VTK_RUBY_LIB_DIR@"
+vtk_ruby_archdir = "@VTK_RUBY_ARCH_DIR@"
+
+# The build type ('Release', 'Debug' etc.).  If vtk_has_configuration_types
+# is true this must be set.  It may be set on the command line by something
+# like 'BUILD_TYPE=Release'.  For example::
+#   ruby setup.rb --prefix=D:\\Ruby18 BUILD_TYPE=Release
+vtk_build_type = @VTK_RUBY_BUILD_TYPE@
+
+# Construct the list of kit names to be installed.
+vtk_kit_names = ['Common', 'Filtering', 'IO', 'Graphics',
+                 'GenericFiltering', 'Imaging']
+if vtk_use_rendering==1
+  vtk_kit_names += ['Rendering', 'VolumeRendering', 'Hybrid', 'Widgets']
+end
+if vtk_use_parallel==1
+  vtk_kit_names += ['Parallel']
+end
+
+
+# List of extra ruby script names to be installed
+vtk_extra_names = %w(util gtk tk)
+
+
+# Get optional directory argument
+if vtk_ruby_libdir == ""
+  vtk_ruby_libdir = Config::CONFIG['sitelibdir']
+end
+if vtk_ruby_archdir == ""
+  vtk_ruby_archdir = Config::CONFIG['sitearchdir']
+end
+
+# Parse argument
+for x in ARGV
+  if x.include?('--prefix')
+    dir_prefix = x.split('=')[1]
+    dir_prefix = dir_prefix ? dir_prefix : ""
+    vtk_ruby_libdir = dir_prefix + vtk_ruby_libdir
+    vtk_ruby_archdir = dir_prefix + vtk_ruby_archdir
+    ARGV.delete(x)
+    break
+  end
+end
+for x in ARGV
+  if x.include?('BUILD_TYPE')
+    vtk_build_type = x.split('=')[1..-1]
+    ARGV.delete(x)
+    break
+  end
+end
+
+
+# Select platform-specific components of the module file names.
+if Config::CONFIG['host_os']=~/win32/
+#  dir = vtk_bin_dir.gsub('/', '\\')
+  dir = vtk_bin_dir
+  prefix = 'vtk'
+  suffix = 'Ruby.dll'
+else
+  dir = vtk_lib_dir
+  prefix = 'libvtk'
+  suffix = 'Ruby.so'
+end
+
+# If this build has configuration types append the selected configuration.
+if vtk_has_configuration_types == 1
+  dir = File.join(dir, *vtk_build_type)
+end
+
+# Generate scripts
+vtk_rb = File.expand_path('vtk.rb')
+
+# Install scripts to system path
+File.makedirs File.join(vtk_ruby_libdir, 'vtk')
+File.makedirs File.join(vtk_ruby_archdir, 'vtk')
+File.install vtk_rb, vtk_ruby_libdir
+for kit in vtk_kit_names
+  kit_rb = File.expand_path(File.join('vtk',kit.downcase+'.rb'))
+  File.install kit_rb, File.join(vtk_ruby_libdir, 'vtk')
+  File.install File.join(dir, prefix+kit+suffix), File.join(vtk_ruby_archdir, 'vtk')
+end
+
+# Install extra scripts to ruby path
+for ext in vtk_extra_names
+  File.install File.join('vtk', ext+'.rb'), File.join(vtk_ruby_libdir, 'vtk', ext+'.rb')
+  File.makedirs File.join(vtk_ruby_libdir, 'vtk', ext)
+  for file in Dir[File.join('vtk', ext, '*.rb')]
+    File.install file, File.join(vtk_ruby_libdir, 'vtk', ext)
+  end
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/common.rb VTK/Wrapping/Ruby/vtk/common.rb
--- VTK_org/Wrapping/Ruby/vtk/common.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/common.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkCommonRuby'
+else
+  require 'vtk/libvtkCommonRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/.cvsignore VTK/Wrapping/Ruby/vtk/.cvsignore
--- VTK_org/Wrapping/Ruby/vtk/.cvsignore	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/.cvsignore	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1 @@
+*.pyc
diff -uNr VTK_org/Wrapping/Ruby/vtk/filtering.rb VTK/Wrapping/Ruby/vtk/filtering.rb
--- VTK_org/Wrapping/Ruby/vtk/filtering.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/filtering.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkFilteringRuby'
+else
+  require 'vtk/libvtkFilteringRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/genericfiltering.rb VTK/Wrapping/Ruby/vtk/genericfiltering.rb
--- VTK_org/Wrapping/Ruby/vtk/genericfiltering.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/genericfiltering.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkGenericFilteringRuby'
+else
+  require 'vtk/libvtkGenericFilteringRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/graphics.rb VTK/Wrapping/Ruby/vtk/graphics.rb
--- VTK_org/Wrapping/Ruby/vtk/graphics.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/graphics.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkGraphicsRuby'
+else
+  require 'vtk/libvtkGraphicsRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/gtk/GtkGLExtVTKRenderWindowInteractor.rb VTK/Wrapping/Ruby/vtk/gtk/GtkGLExtVTKRenderWindowInteractor.rb
--- VTK_org/Wrapping/Ruby/vtk/gtk/GtkGLExtVTKRenderWindowInteractor.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/gtk/GtkGLExtVTKRenderWindowInteractor.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,355 @@
+=begin
+Description:
+
+  Provides a Gtk vtkRenderWindowInteractor widget.  This embeds a
+  vtkRenderWindow inside a GTK widget && uses the
+  vtkGenericRenderWindowInteractor for the event handling.  This is
+  vtkGenericRenderWindowInteractor end
+  similar to GtkVTKRenderWindowInteractor.rb.
+
+  The extensions here allow the use of gtkglext rather than gtkgl &&
+  ruby-gtk2 rather than ruby-gtk.  It requires ruby-gtk2.0.0 || later.
+
+  There is a working example at the bottom.
+
+Credits:
+
+License:
+
+  VTK license.
+
+=end
+
+require 'rbconfig'
+require 'gtk2'
+require 'gtkglext'
+require 'vtk'
+
+class GtkGLExtVTKRenderWindowInteractor < Gtk::DrawingArea
+=begin
+  Embeds a vtkRenderWindow into a pyGTK widget && uses
+  vtkGenericRenderWindowInteractor for the event handling.  This
+  class embeds the RenderWindow correctly.  A __getattr__ hook is
+  provided that makes the class behave like a
+  vtkGenericRenderWindowInteractor.
+=end
+  def initialize
+    super
+
+    glconfig = Gdk::GLConfig.new(Gdk::GLConfig::MODE_RGB|
+                                 Gdk::GLConfig::MODE_DEPTH)
+
+    set_gl_capability(glconfig)
+
+    @RenderWindow = Vtk::RenderWindow.new
+
+    # private attributes
+    @Created = false
+    @ActiveButton = nil
+
+    @Iren = Vtk::GenericRenderWindowInteractor.new
+    @Iren.SetRenderWindow(@RenderWindow)
+    @Iren.GetInteractorStyle.SetCurrentStyleToTrackballCamera
+
+    createTimer = Proc.new{|obj, event|
+      gtk.timeout_add(10, Proc.new{ @Iren.TimerEvent })
+    }
+
+    destroyTimer = Proc.new{|obj, event|
+=begin
+      The timer is a one shot timer so will expire automatically.
+=end
+      return 1
+    }
+
+    @Iren.AddObserver('CreateTimerEvent', createTimer)
+    @Iren.AddObserver('DestroyTimerEvent', destroyTimer)
+    self.ConnectSignals
+
+    # need this to be able to handle key_press events.
+    self.set_flags(Gtk::Window::CAN_FOCUS)
+  end
+
+  def set_size_request(w, h)
+    super(w,h)
+    @RenderWindow.SetSize(w, h)
+    @Iren.SetSize(w, h)
+    @Iren.ConfigureEvent
+  end
+
+  def ConnectSignals
+    self.signal_connect("realize"){|wid,event| OnRealize(wid,event) }
+    self.signal_connect("expose_event"){|wid,event| OnExpose(wid,event) }
+    self.signal_connect("configure_event"){|wid,event| OnConfigure(wid,event) }
+    self.signal_connect("button_press_event"){|wid,event| OnButtonDown(wid,event) }
+    self.signal_connect("button_release_event"){|wid,event| OnButtonUp(wid,event) }
+    self.signal_connect("motion_notify_event"){|wid,event| OnMouseMove(wid,event) }
+    self.signal_connect("enter_notify_event"){|wid,event| OnEnter(wid,event) }
+    self.signal_connect("leave_notify_event"){|wid,event| OnLeave(wid,event) }
+    self.signal_connect("key_press_event"){|wid,event| OnKeyPress(wid,event) }
+    self.signal_connect("delete_event"){|wid,event| OnDestroy(wid,event) }
+    self.add_events(Gdk::Event::EXPOSURE_MASK |
+                    Gdk::Event::BUTTON_PRESS_MASK |
+                    Gdk::Event::BUTTON_RELEASE_MASK |
+                    Gdk::Event::KEY_PRESS_MASK |
+                    Gdk::Event::POINTER_MOTION_MASK |
+                    Gdk::Event::POINTER_MOTION_HINT_MASK |
+                    Gdk::Event::ENTER_NOTIFY_MASK |
+                    Gdk::Event::LEAVE_NOTIFY_MASK)
+  end
+
+  def GetRenderWindow
+    return @RenderWindow
+  end
+
+  def Render
+    if @Created
+      @RenderWindow.Render
+    end
+  end
+
+  def OnRealize(wid, event)
+    unless @Created
+      # you can't get the xid without the window being realized.
+      self.realize
+      if Config::CONFIG["host_os"] =~ /win32/
+        win_id = self.window.handle.to_s
+      else
+        win_id =self.window.xid.to_s
+      end
+
+      @RenderWindow.SetWindowInfo(win_id)
+#      @Iren.Initialize
+      @Created = true
+    end
+    return true
+  end
+
+  def OnConfigure(widget, event)
+#    self.widget=widget
+    @Iren.SetSize(event.width, event.height)
+    @Iren.ConfigureEvent
+    self.Render
+    return true
+  end
+
+  def OnExpose(wid, event)
+    self.Render
+    return true
+  end
+
+  def OnDestroy(wid, event=nil)
+    self.hide
+    @RenderWindow = nil
+    self.destroy
+    return true
+  end
+
+  private
+  def _GetCtrlShift(event)
+    ctrl, shift = 0, 0        
+    if ((event.state & Gdk::Window::ModifierType::CONTROL_MASK) == Gdk::Window::ModifierType::CONTROL_MASK)
+      ctrl = 1
+    end
+    if ((event.state & Gdk::Window::ModifierType::SHIFT_MASK) == Gdk::Window::ModifierType::SHIFT_MASK)
+      shift = 1
+    end
+    return ctrl, shift
+  end
+
+
+  public
+  def OnButtonDown(wid, event)
+=begin
+    Mouse button pressed.
+=end
+    m = self.pointer
+    ctrl, shift = _GetCtrlShift(event)
+    @Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift, 0.chr, 0, nil)
+    button = event.button
+    if button == 3
+      @Iren.RightButtonPressEvent
+      return true
+    elsif button == 1
+      @Iren.LeftButtonPressEvent
+      return true
+    elsif button == 2
+      @Iren.MiddleButtonPressEvent
+      return true
+    else
+      return ralse
+    end
+  end
+
+  def OnButtonUp(wid, event)
+=begin
+    Mouse button released.
+=end
+    m = self.pointer
+    ctrl, shift = _GetCtrlShift(event)
+    @Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift, 0.chr, 0, nil)
+    button = event.button
+    if button == 3
+      @Iren.RightButtonReleaseEvent
+      return true
+    elsif button == 1
+      @Iren.LeftButtonReleaseEvent
+      return true
+    elsif button == 2
+      @Iren.MiddleButtonReleaseEvent
+      return true
+    end
+
+    return false
+  end
+
+  def OnMouseMove(wid, event)
+=begin
+    Mouse has moved.
+=end
+    m = self.pointer
+    ctrl, shift = _GetCtrlShift(event)
+    @Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift, 0.chr, 0, nil)
+    @Iren.MouseMoveEvent
+    return true
+  end
+
+  def OnEnter(wid, event)
+=begin
+    Entering the vtkRenderWindow.
+=end
+    self.grab_focus
+    m = self.pointer
+    ctrl, shift = _GetCtrlShift(event)
+    @Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift, 0.chr, 0, nil)
+    @Iren.EnterEvent
+    return true
+  end
+
+  def OnLeave(wid, event)
+=begin
+    Leaving the vtkRenderWindow.
+=end
+    m = self.pointer
+    ctrl, shift = _GetCtrlShift(event)
+    @Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift, 0.chr, 0, nil)
+    @Iren.LeaveEvent
+    return true
+  end
+
+  def OnKeyPress(wid, event)
+=begin
+    Key pressed.
+=end
+    m = self.pointer
+    ctrl, shift = _GetCtrlShift(event)
+#    keycode, keysym = event.keyval, event.string
+    keycode, keysym = event.keyval, nil
+    key = 0.chr
+    if keycode < 256
+      key = keycode.chr
+    end
+    @Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift, key, 0, keysym)
+    @Iren.KeyPressEvent
+    @Iren.CharEvent
+    return true
+  end
+
+  def OnKeyRelease(wid, event)
+=begin
+    Key released.
+=end
+    m = self.pointer
+    ctrl, shift = _GetCtrlShift(event)
+#    keycode, keysym = event.keyval, event.string
+    keycode, keysym = event.keyval, nil
+    key = 0.chr
+    if keycode < 256
+      key = keycode.chr
+    end
+    @Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift, key, 0, keysym)
+    @Iren.KeyReleaseEvent
+    return true
+  end
+
+  def Initialize
+    if @Created
+      @Iren.Initialize
+    end
+  end
+
+  def Start
+    if @Created
+      @Iren.Start
+    end
+  end
+
+  def SetPicker(picker)
+    @Iren.SetPicker(picker)
+  end
+
+  def GetPicker(picker)
+    return @Iren.GetPicker
+  end
+
+end
+
+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 = GtkGLExtVTKRenderWindowInteractor.new
+  #gvtk.SetDesiredUpdateRate(1000)
+  gvtk.set_size_request(400, 400)
+  vbox.pack_start(gvtk)
+  gvtk.show
+  gvtk.Initialize
+  gvtk.Start
+  # prevents 'q' from exiting the app.
+  exit = Proc.new{|obj, event, x|
+    x
+  }
+#  gvtk.AddObserver("ExitEvent", exit)
+
+  # 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
+
+
+if $0 == __FILE__
+  main
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/gtk/GtkGLExtVTKRenderWindow.rb VTK/Wrapping/Ruby/vtk/gtk/GtkGLExtVTKRenderWindow.rb
--- VTK_org/Wrapping/Ruby/vtk/gtk/GtkGLExtVTKRenderWindow.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/gtk/GtkGLExtVTKRenderWindow.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,635 @@
+=begin
+Description:
+
+  This provides a VTK widget for pyGtk.  This embeds a vtkRenderWindow
+  This provides a VTK widget end
+  inside a GTK widget.  This is based on GtkVTKRenderWindow.rb.
+
+  The extensions here allow the use of gtkglext rather than gtkgl &&
+  ruby-gtk2 rather than pygtk-0.  It requires ruby-gtk2.0.0 || later.
+
+  There is a working example at the bottom.
+
+Credits:
+
+License:
+
+  VTK license.
+
+=end
+
+require 'rbconfig'
+require 'gtk2'
+require 'gtkglext'
+require 'vtk'
+
+
+class GtkGLExtVTKRenderWindowBase < Gtk::DrawingArea
+
+=begin
+  A base class that enables one to embed a vtkRenderWindow into
+  a pyGTK widget.  This class embeds the RenderWindow correctly.
+  Provided are some empty methods that can be overloaded to provide
+  a user defined interaction behaviour.  The event handling
+  functions have names that are somewhat similar to the ones in the
+  vtkInteractorStyle class included with VTK.
+=end
+
+  def initialize
+    super
+
+    glconfig = Gdk::GLConfig.new(Gdk::GLConfig::MODE_RGB|
+                                   Gdk::GLConfig::MODE_DEPTH)
+
+    set_gl_capability(glconfig)
+
+    @RenderWindow = Vtk::RenderWindow.new
+    # private attributes
+    @Created = false
+
+    # used by the LOD actors
+    @DesiredUpdateRate = 15
+    @StillUpdateRate = 0.0001
+
+    self.ConnectSignals
+
+    # need this to be able to handle key_press events.
+    set_flags(Gtk::Window::CAN_FOCUS)
+    # default size
+    set_size_request(300, 300)
+  end
+
+  def ConnectSignals
+    signal_connect("realize"){|wid,event| OnRealize(wid,event)}
+    signal_connect("expose_event"){|wid,event| OnExpose(wid,event)}
+    signal_connect("configure_event"){|wid,event| OnConfigure(wid,event)}
+    signal_connect("button_press_event"){|wid,event| OnButtonDown(wid,event)}
+    signal_connect("button_release_event"){|wid,event| OnButtonUp(wid,event)}
+    signal_connect("motion_notify_event"){|wid,event| OnMouseMove(wid,event)}
+    signal_connect("enter_notify_event"){|wid,event| OnEnter(wid,event)}
+    signal_connect("leave_notify_event"){|wid,event| OnLeave(wid,event)}
+    signal_connect("key_press_event"){|wid,event| OnKeyPress(wid,event)}
+    signal_connect("delete_event"){|wid,event| OnDestroy(wid,event)}
+    add_events(Gdk::Event::EXPOSURE_MASK|
+               Gdk::Event::BUTTON_PRESS_MASK |
+               Gdk::Event::BUTTON_RELEASE_MASK |
+               Gdk::Event::KEY_PRESS_MASK |
+               Gdk::Event::POINTER_MOTION_MASK |
+               Gdk::Event::POINTER_MOTION_HINT_MASK |
+               Gdk::Event::ENTER_NOTIFY_MASK |
+               Gdk::Event::LEAVE_NOTIFY_MASK)
+  end
+
+  def GetRenderWindow
+    return @RenderWindow
+  end
+
+  def GetRenderer
+    @RenderWindow.GetRenderers.InitTraversal
+    return @RenderWindow.GetRenderers.GetNextItem
+  end
+
+  def SetDesiredUpdateRate(rate)
+=begin
+    Mirrors the method with the same name in vtkRenderWindowInteractor.
+=end
+    @DesiredUpdateRate = rate
+  end
+
+  def GetDesiredUpdateRate
+=begin
+    Mirrors the method with the same name in vtkRenderWindowInteractor.
+=end
+    return @DesiredUpdateRate 
+  end
+
+  def SetStillUpdateRate(rate)
+=begin
+    Mirrors the method with the same name in vtkRenderWindowInteractor.
+=end
+    @StillUpdateRate = rate
+  end
+
+  def GetStillUpdateRate
+=begin
+    Mirrors the method with the same name in vtkRenderWindowInteractor.
+=end
+    return @StillUpdateRate
+  end
+
+  def Render
+    if @Created
+      @RenderWindow.Render
+    end
+  end
+
+  def OnRealize(wid, event)
+    if !@Created
+      # you can't get the xid without the window being realized.
+      realize
+      if Config::CONFIG["host_os"] =~ /win32/
+#        win_id = @widget.window.handle.to_s
+        win_id = window.handle.to_s
+      else
+#        win_id = @widget.window.xid.to_s
+        win_id = window.xid.to_s
+      end
+      @RenderWindow.SetWindowInfo(win_id)
+      @Created = true
+    end
+    return true
+  end
+
+  def Created
+    return @Created
+  end
+
+  def OnConfigure(wid, event)
+#    @widget=widget
+    @RenderWindow.SetSize(event.width, event.height)
+    self.Render
+    return true
+  end
+
+  def OnExpose(wid, event)
+    self.Render
+    return true
+  end
+
+  def OnDestroy(wid, event)
+    self.hide
+    del(@RenderWindow)
+    self.destroy
+    return true
+  end
+
+  def OnButtonDown(wid, event)
+=begin
+    Mouse button pressed.
+=end
+    @RenderWindow.SetDesiredUpdateRate(@DesiredUpdateRate)
+    return true
+  end
+
+  def OnButtonUp(wid, event)
+=begin
+    Mouse button released.
+=end
+    @RenderWindow.SetDesiredUpdateRate(@StillUpdateRate)
+    return true
+  end
+
+  def OnMouseMove(wid, event)
+=begin
+    Mouse has moved.
+=end
+    return true
+  end
+
+  def OnEnter(wid, event)
+=begin
+    Entering the vtkRenderWindow.
+=end
+    return true
+  end
+
+  def OnLeave(wid, event)
+=begin
+    Leaving the vtkRenderWindow.
+=end
+    return true
+  end
+
+  def OnKeyPress(wid, event)
+=begin
+    Key pressed.
+=end
+    return true
+  end
+
+  def OnKeyRelease(wid, event)
+=begin
+    "Key released."
+=end
+    return true
+  end
+end
+
+
+class GtkGLExtVTKRenderWindow < GtkGLExtVTKRenderWindowBase
+
+=begin
+  An example of a fully functional GtkGLExtVTKRenderWindow that
+  is based on the vtkRenderWidget.py provided with the VTK
+  sources.
+=end
+
+  def initialize
+    super
+
+    @CurrentRenderer = nil
+    @CurrentCamera = nil
+    @CurrentZoom = 1.0
+    @CurrentLight = nil
+
+    @ViewportCenterX = 0
+    @ViewportCenterY = 0
+
+    @Picker = Vtk::CellPicker.new
+    @PickedAssembly = nil
+    @PickedProperty = Vtk::Property.new
+    @PickedProperty.SetColor(1, 0, 0)
+    @PrePickedProperty = nil
+
+    @OldFocus = nil
+
+    # these record the previous mouse position
+    @LastX = 0
+    @LastY = 0
+  end
+
+  def OnButtonDown(wid, event)
+    @RenderWindow.SetDesiredUpdateRate(@DesiredUpdateRate)
+    return self.StartMotion(wid, event)
+    return true
+  end
+
+  def OnButtonUp(wid, event)
+    @RenderWindow.SetDesiredUpdateRate(@StillUpdateRate)
+    return self.EndMotion(wid, event)
+    return true
+  end
+
+  def OnMouseMove(wid, event=nil)
+    if ((event.state & Gdk::Window::ModifierType::BUTTON1_MASK) == Gdk::Window::ModifierType::BUTTON1_MASK)
+      if ((event.state & Gdk::Window::ModifierType::SHIFT_MASK) == Gdk::Window::ModifierType::SHIFT_MASK)
+        m = self.pointer
+        self.Pan(m[0], m[1])
+      else
+        m = self.pointer
+        self.Rotate(m[0], m[1])
+      end
+    elsif ((event.state & Gdk::Window::ModifierType::BUTTON2_MASK) == Gdk::Window::ModifierType::BUTTON2_MASK)
+      m = self.pointer
+      self.Pan(m[0], m[1])
+    elsif ((event.state & Gdk::Window::ModifierType::BUTTON3_MASK) == Gdk::Window::ModifierType::BUTTON3_MASK)
+      m = self.pointer
+      self.Zoom(m[0], m[1])
+    else
+      return true
+    end
+
+    return true
+  end
+
+  def OnEnter(wid, event=nil)
+    # a render hack because grab_focus blanks the renderwin
+    self.grab_focus
+    w = self.pointer
+    self.UpdateRenderer(w[0], w[1])
+    return true
+  end
+
+  def OnKeyPress(wid, event=nil)
+    #if (event.keyval == Gdk::Keyval.from_name("q") ||
+    #    event.keyval == Gdk::Kyval.from_name("Q")):
+    #    Gtk.main_quit            
+
+    if (event.keyval == Gdk::Keyval.from_name('r') ||
+        event.keyval == Gdk::Keyval.from_name('R')):
+        self.Reset
+      return true
+    elsif (event.keyval == Gdk::Keyval.from_name('w') ||
+           event.keyval == Gdk::Keyval.from_name('W')):
+        self.Wireframe
+      return true
+    elsif (event.keyval == Gdk::Keyval.from_name('s') ||
+           event.keyval == Gdk::Keyval.from_name('S')):
+        self.Surface
+      return true
+    elsif (event.keyval == Gdk::Keyval.from_name('p') ||
+           event.keyval == Gdk::Keyval.from_name('P')):
+        m = self.pointer
+      self.PickActor(m[0], m[1])
+      return true
+    else
+      return true
+    end
+  end
+
+  def GetZoomFactor
+    return @CurrentZoom
+  end
+
+  def SetZoomFactor(zf)
+    @CurrentZoom = zf
+  end
+
+  def GetPicker
+    return @Picker
+  end
+
+  def Render
+    if (@CurrentLight)
+      light = @CurrentLight
+      light.SetPosition(@CurrentCamera.GetPosition)
+      light.SetFocalPoint(@CurrentCamera.GetFocalPoint)
+    end
+
+    super
+  end
+
+
+  def UpdateRenderer(x,y)
+=begin
+    UpdateRenderer will identify the renderer under the mouse && set
+    up @CurrentRenderer, @CurrentCamera, && @CurrentLight.
+=end
+#    windowX,windowY  = self.widget.window.get_size
+    windowX,windowY  = window.size
+
+    renderers = @RenderWindow.GetRenderers
+    numRenderers = renderers.GetNumberOfItems
+
+    @CurrentRenderer = nil
+    renderers.InitTraversal
+    for i in 0...numRenderers
+      renderer = renderers.GetNextItem
+      vx,vy = [0,0]
+      if (windowX > 1)
+        vx = x.to_f/(windowX-1)
+      end
+      if (windowY > 1)
+        vy = (windowY-y.to_f-1)/(windowY-1)
+      end
+      (vpxmin,vpymin,vpxmax,vpymax) = renderer.GetViewport
+
+      if (vx >= vpxmin && vx <= vpxmax && vy >= vpymin && vy <= vpymax)
+        @CurrentRenderer = renderer
+        @ViewportCenterX = windowX.to_f*(vpxmax-vpxmin)/2.0 +vpxmin
+        @ViewportCenterY = windowY.to_f*(vpymax-vpymin)/2.0 +vpymin
+        @CurrentCamera = @CurrentRenderer.GetActiveCamera
+        lights = @CurrentRenderer.GetLights
+        lights.InitTraversal
+        break if @CurrentLight = lights.GetNextItem
+      end
+    end
+
+    @LastX = x
+    @LastY = y
+  end
+
+  def GetCurrentRenderer
+    if @CurrentRenderer.nil?
+      renderers = @RenderWindow.GetRenderers
+      numRenderers = renderers.GetNumberOfItems
+
+      renderers.InitTraversal
+      for i in 0...numRenderers
+        break if renderer = renderers.GetNextItem
+      end
+      @CurrentRenderer = renderer
+    end
+    return @CurrentRenderer
+  end
+
+  def GetCurrentCamera
+    if @CurrentCamera.nil?
+      renderer = self.GetCurrentRenderer
+      @CurrentCamera = renderer.GetActiveCamera
+    end
+    return @CurrentCamera
+  end
+
+  def StartMotion(wid, event=nil)
+    x = event.x
+    y = event.y
+    self.UpdateRenderer(x,y)
+    return true
+  end
+
+  def EndMotion(wid, event=nil)
+    if @CurrentRenderer
+      self.Render
+    end
+    return true
+  end
+
+  def Rotate(x,y)
+    if @CurrentRenderer
+
+      @CurrentCamera.Azimuth(@LastX - x)
+      @CurrentCamera.Elevation(y - @LastY)
+      @CurrentCamera.OrthogonalizeViewUp
+
+      @LastX = x
+      @LastY = y
+
+      @CurrentRenderer.ResetCameraClippingRange
+      self.Render
+    end
+  end
+
+  def Pan(x,y)
+    if @CurrentRenderer
+
+      renderer = @CurrentRenderer
+      camera = @CurrentCamera
+      (pPoint0,pPoint1,pPoint2) = camera.GetPosition
+      (fPoint0,fPoint1,fPoint2) = camera.GetFocalPoint
+
+      if (camera.GetParallelProjection)
+        renderer.SetWorldPoint(fPoint0,fPoint1,fPoint2,1.0)
+        renderer.WorldToDisplay
+        fx,fy,fz = renderer.GetDisplayPoint
+        renderer.SetDisplayPoint(fx-x+@LastX,
+                                 fy+y-@LastY,
+                                 fz)
+        renderer.DisplayToWorld
+        fx,fy,fz,fw = renderer.GetWorldPoint
+        camera.SetFocalPoint(fx,fy,fz)
+
+        renderer.SetWorldPoint(pPoint0,pPoint1,pPoint2,1.0)
+        renderer.WorldToDisplay
+        fx,fy,fz = renderer.GetDisplayPoint
+        renderer.SetDisplayPoint(fx-x+@LastX,
+                                 fy+y-@LastY,
+                                 fz)
+        renderer.DisplayToWorld
+        fx,fy,fz,fw = renderer.GetWorldPoint
+        camera.SetPosition(fx,fy,fz)
+
+      else
+        (fPoint0,fPoint1,fPoint2) = camera.GetFocalPoint
+        # Specify a point location in world coordinates
+        renderer.SetWorldPoint(fPoint0,fPoint1,fPoint2,1.0)
+        renderer.WorldToDisplay
+        # Convert world point coordinates to display coordinates
+        dPoint = renderer.GetDisplayPoint
+        focalDepth = dPoint[2]
+
+        aPoint0 = @ViewportCenterX + (x - @LastX)
+        aPoint1 = @ViewportCenterY - (y - @LastY)
+
+        renderer.SetDisplayPoint(aPoint0,aPoint1,focalDepth)
+        renderer.DisplayToWorld
+
+        (rPoint0,rPoint1,rPoint2,rPoint3) = renderer.GetWorldPoint
+        if (rPoint3 != 0.0)
+          rPoint0 = rPoint0/rPoint3
+          rPoint1 = rPoint1/rPoint3
+          rPoint2 = rPoint2/rPoint3
+        end
+
+        camera.SetFocalPoint((fPoint0 - rPoint0) + fPoint0, 
+                             (fPoint1 - rPoint1) + fPoint1,
+                             (fPoint2 - rPoint2) + fPoint2) 
+
+        camera.SetPosition((fPoint0 - rPoint0) + pPoint0, 
+                           (fPoint1 - rPoint1) + pPoint1,
+                           (fPoint2 - rPoint2) + pPoint2)
+      end
+
+      @LastX = x
+      @LastY = y
+
+      self.Render
+    end
+  end
+
+  def Zoom(x,y)
+    if @CurrentRenderer
+
+      renderer = @CurrentRenderer
+      camera = @CurrentCamera
+
+      zoomFactor = 1.02**(0.5*(@LastY - y))
+      @CurrentZoom = @CurrentZoom * zoomFactor
+
+      if camera.GetParallelProjection
+        parallelScale = camera.GetParallelScale/zoomFactor
+        camera.SetParallelScale(parallelScale)
+      else
+        camera.Dolly(zoomFactor)
+        renderer.ResetCameraClippingRange
+      end
+
+      @LastX = x
+      @LastY = y
+
+      self.Render
+    end
+  end
+
+  def Reset
+    if @CurrentRenderer
+      @CurrentRenderer.ResetCamera
+    end
+
+    self.Render
+  end
+
+  def Wireframe
+    actors = @CurrentRenderer.GetActors
+    numActors = actors.GetNumberOfItems
+    actors.InitTraversal
+    for i in 0...numActors
+      actor = actors.GetNextItem
+      actor.GetProperty.SetRepresentationToWireframe
+    end
+
+    self.Render
+  end
+
+  def Surface
+    actors = @CurrentRenderer.GetActors
+    numActors = actors.GetNumberOfItems
+    actors.InitTraversal
+    for i in 0...numActors
+      actor = actors.GetNextItem
+      actor.GetProperty.SetRepresentationToSurface
+    end
+
+    self.Render
+  end
+
+  def PickActor(x,y)
+    if @CurrentRenderer
+
+      renderer = @CurrentRenderer
+      picker = @Picker
+
+      windowX,windowY  = window.size
+#      windowX,windowY  = self.widget.window.get_size
+      picker.Pick(x,(windowY - y - 1),0.0,renderer)
+      assembly = picker.GetAssembly
+
+      if (@PickedAssembly != nil && @PrePickedProperty != nil)
+        @PickedAssembly.SetProperty(@PrePickedProperty)
+        # release hold of the property
+        @PrePickedProperty.UnRegister(@PrePickedProperty)
+        @PrePickedProperty = nil
+      end
+
+      if (assembly != nil)
+        @PickedAssembly = assembly
+        @PrePickedProperty = @PickedAssembly.GetProperty
+        # hold onto the property
+        @PrePickedProperty.Register(@PrePickedProperty)
+        @PickedAssembly.SetProperty(@PickedProperty)
+      end
+
+      self.Render
+    end
+  end
+end
+
+
+def main
+
+  Gtk.init
+  Gtk::GL.init
+
+    # The main window
+  window = Gtk::Window.new
+  window.set_title("A GtkGLExtVTKRenderWindow Demo!")
+  window.signal_connect("destroy"){ Gtk.main_quit }
+  window.signal_connect("delete_event"){ Gtk.main_quit }
+  window.set_border_width(10)
+
+  vtkgtk = GtkGLExtVTKRenderWindow.new
+  vtkgtk.show
+
+  vbox = Gtk::VBox.new(false, 3)
+  vbox.show
+  vbox.pack_start(vtkgtk)
+
+  button = Gtk::Button.new('My Button')
+  button.show
+  vbox.pack_start(button)
+  window.add(vbox)
+
+  window.set_size_request(400, 400)
+
+  # 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
+  vtkgtk.GetRenderWindow.AddRenderer(ren)
+  ren.AddActor(coneActor)
+
+  # show the main window && start event processing.
+  window.show
+  Gtk.main
+end
+
+
+if $0 == __FILE__
+  main
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/gtk/GtkVTKRenderWindowInteractor.rb VTK/Wrapping/Ruby/vtk/gtk/GtkVTKRenderWindowInteractor.rb
--- VTK_org/Wrapping/Ruby/vtk/gtk/GtkVTKRenderWindowInteractor.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/gtk/GtkVTKRenderWindowInteractor.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,336 @@
+"""
+Description:
+
+  Provides a pyGtk vtkRenderWindowInteractor widget.  This embeds a
+  vtkRenderWindow inside a GTK widget && uses the
+  vtkGenericRenderWindowInteractor for the event handling.  This is
+  vtkGenericRenderWindowInteractor end
+  based on vtkTkRenderWindow.py.
+
+  The class uses the gtkgl.GtkGLArea widget (gtkglarea).  This avoids
+  The end
+  a lot of problems with flicker.
+
+  There is a working example at the bottom.
+
+Created by Prabhu Ramachandran, April 2002.
+
+Bugs:
+
+  (*) There is a focus related problem.  Tkinter has a focus object
+  that handles focus events.  I dont know of an equivalent object
+  under GTK.  So, when an 'enter_notify_event' is received on the
+  GtkVTKRenderWindow I grab the focus but I dont know what to do when
+  I get a 'leave_notify_event'.
+
+  (*) Will  !work under Win32 because it uses the XID of a window in
+  OnRealize.  Suggestions to fix this will be appreciated.
+
+"""
+
+require 'vtk'
+
+
+class GtkVTKRenderWindowInteractor(gtkgl.GtkGLArea)
+
+    """ Embeds a vtkRenderWindow into a pyGTK widget && uses
+    vtkGenericRenderWindowInteractor for the event handling.  This
+    vtkGenericRenderWindowInteractor end
+    class embeds the RenderWindow correctly.  A __getattr__ hook is
+    end
+    provided that makes the class behave like a
+    provided that makes the end
+    vtkGenericRenderWindowInteractor."""
+
+    def __init__(self, *args)
+        l = list(args)
+        attr = (gtkgl.RGBA, gtkgl.DOUBLEBUFFER)
+        l.insert(0, self)
+        l.insert(1, attr)
+        apply(gtkgl.GtkGLArea.__init__, l)
+        self._RenderWindow = Vtk::RenderWindow.new
+
+        # private attributes
+        self.__Created = 0
+        self._ActiveButton = 0
+
+        self._Iren = Vtk::GenericRenderWindowInteractor.new
+        self._Iren.SetRenderWindow(self._RenderWindow)
+
+        self._Iren.AddObserver('CreateTimerEvent', self.CreateTimer)
+        self._Iren.AddObserver('DestroyTimerEvent', self.DestroyTimer)
+        self.ConnectSignals
+
+        # need this to be able to handle key_press events.
+        self.set_flags(gtk.CAN_FOCUS)
+        # default size
+        self.set_usize(300, 300)
+    end
+
+    def set_usize(self, w, h)
+    end
+end
+	gtkgl.GtkGLArea.set_usize(self, w, h)
+	self._RenderWindow.SetSize(w, h)
+	self._Iren.SetSize(w, h)
+	self._Iren.ConfigureEvent
+
+    def ConnectSignals(self)
+        self.connect("realize", self.OnRealize)
+        self.connect("expose_event", self.OnExpose)
+        self.connect("configure_event", self.OnConfigure)
+        self.connect("button_press_event", self.OnButtonDown)
+        self.connect("button_release_event", self.OnButtonUp)
+        self.connect("motion_notify_event", self.OnMouseMove)
+        self.connect("enter_notify_event", self.OnEnter)
+        self.connect("leave_notify_event", self.OnLeave)
+        self.connect("key_press_event", self.OnKeyPress)
+        self.connect("delete_event", self.OnDestroy)
+        self.add_events(GDK.EXPOSURE_MASK| GDK.BUTTON_PRESS_MASK |
+                        GDK.BUTTON_RELEASE_MASK |
+                        GDK.KEY_PRESS_MASK |
+                        GDK.POINTER_MOTION_MASK |
+                        GDK.POINTER_MOTION_HINT_MASK |
+                        GDK.ENTER_NOTIFY_MASK | GDK.LEAVE_NOTIFY_MASK)
+    end
+
+    def __getattr__(self, attr)
+        """Makes the object behave like a
+        vtkGenericRenderWindowInteractor"""
+        if attr == '__vtk__'
+            return lambda t=self._Iren: t
+        elsif hasattr(self._Iren, attr)            return getattr(self._Iren, attr)
+        else            raise AttributeError, self.__class__.__name__ + \
+                  " has no attribute named " + attr
+        end
+    end
+
+    def CreateTimer(self, obj, event)
+        gtk.timeout_add(10, self._Iren.TimerEvent)
+    end
+
+    def DestroyTimer(self, obj, event)
+        """The timer is a one shot timer so will expire automatically."""
+        return 1
+    end
+
+    def GetRenderWindow(self)
+        return self._RenderWindow
+    end
+
+    def Render(self)
+        if self.__Created
+            self._RenderWindow.Render
+        end
+    end
+
+    def OnRealize(self, *args)
+        if self.__Created == 0
+            # you can't get the xid without the window being realized.
+            self.realize
+            win_id = str(self.get_window.xid)
+            self._RenderWindow.SetWindowInfo(win_id)
+        end
+    end
+	    self._Iren.Initialize
+	    self.__Created = 1
+        return gtk.TRUE    
+
+    def OnConfigure(self, wid, event=nil)
+        sz = self._RenderWindow.GetSize
+        if (event.width != sz[0]) || (event.height != sz[1])
+            self._Iren.SetSize(event.width, event.height)
+            self._Iren.ConfigureEvent
+        end
+        return gtk.TRUE
+    end
+
+    def OnExpose(self, *args)
+        self.Render
+        return gtk.TRUE
+    end
+
+    def OnDestroy(self, event=nil)
+        self.hide
+        del self._RenderWindow
+        self.destroy
+        return gtk.TRUE
+    end
+
+    def _GetCtrlShift(self, event)
+        ctrl, shift = 0, 0        
+        if ((event.state & GDK.CONTROL_MASK) == GDK.CONTROL_MASK)
+            ctrl = 1
+        end
+        if ((event.state & GDK.SHIFT_MASK) == GDK.SHIFT_MASK)
+            shift = 1
+        end
+        return ctrl, shift
+    end
+
+    def OnButtonDown(self, wid, event)
+        """Mouse button pressed."""
+        m = self.get_pointer
+        ctrl, shift = self._GetCtrlShift(event)
+        self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
+                                            chr(0), 0, nil)
+        button = event.button
+        if button == 3
+            self._Iren.RightButtonPressEvent
+            return gtk.TRUE
+        end
+    end
+	elif button == 1
+            self._Iren.LeftButtonPressEvent
+            return gtk.TRUE
+	elend
+	elif button == 2
+            self._Iren.MiddleButtonPressEvent
+            return gtk.TRUE
+        else:
+            return gtk.FALSE
+
+    def OnButtonUp(self, wid, event)
+        """Mouse button released."""
+        m = self.get_pointer
+        ctrl, shift = self._GetCtrlShift(event)
+        self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
+                                            chr(0), 0, nil)
+        button = event.button
+        if button == 3
+            self._Iren.RightButtonReleaseEvent
+            return gtk.TRUE
+        end
+    end
+	elend
+	elif button == 1
+            self._Iren.LeftButtonReleaseEvent
+            return gtk.TRUE
+	elend
+	elif button == 2
+            self._Iren.MiddleButtonReleaseEvent
+            return gtk.TRUE
+
+        return gtk.FALSE
+
+    def OnMouseMove(self, wid, event)
+        """Mouse has moved."""
+        m = self.get_pointer
+        ctrl, shift = self._GetCtrlShift(event)
+        self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
+                                            chr(0), 0, nil)
+        self._Iren.MouseMoveEvent
+        return gtk.TRUE
+    end
+
+    def OnEnter(self, wid, event)
+        """Entering the vtkRenderWindow."""
+        self.grab_focus
+        m = self.get_pointer
+        ctrl, shift = self._GetCtrlShift(event)
+        self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
+                                            chr(0), 0, nil)
+        self._Iren.EnterEvent
+        return gtk.TRUE
+    end
+
+    def OnLeave(self, wid, event)
+        """Leaving the vtkRenderWindow."""
+        m = self.get_pointer
+        ctrl, shift = self._GetCtrlShift(event)
+        self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
+                                            chr(0), 0, nil)
+        self._Iren.LeaveEvent
+        return gtk.TRUE
+    end
+
+    def OnKeyPress(self, wid, event)
+        """Key pressed."""
+        m = self.get_pointer
+        ctrl, shift = self._GetCtrlShift(event)
+    end
+	elend
+	keycode, keysym = event.keyval, event.string
+        key = chr(0)
+        if keycode < 256
+            key = chr(keycode)
+        end
+        self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
+                                            key, 0, keysym)
+        self._Iren.KeyPressEvent
+        self._Iren.CharEvent
+        return gtk.TRUE
+
+    def OnKeyRelease(self, wid, event)
+        "Key released."
+        m = self.get_pointer
+        ctrl, shift = self._GetCtrlShift(event)
+    end
+	keycode, keysym = event.keyval, event.string
+        key = chr(0)
+        if keycode < 256
+            key = chr(keycode)
+        end
+        self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
+                                            key, 0, keysym)
+        self._Iren.KeyReleaseEvent
+        return gtk.TRUE
+
+    def Initialize(self)
+    end
+	if self.__Created
+	end
+	    self._Iren.Initialize
+
+
+def main
+    # The main window
+    window = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL)
+    window.set_title("A GtkVTKRenderWindow Demo!")
+    window.connect("destroy", gtk.mainquit)
+    window.connect("delete_event", gtk.mainquit)
+    window.set_border_width(10)
+
+    # A VBox into which widgets are packed.
+    vbox = gtk.GtkVBox(spacing=3)
+    window.add(vbox)
+    vbox.show
+
+    # The GtkVTKRenderWindow
+    gvtk = GtkVTKRenderWindowInteractor
+    #gvtk.SetDesiredUpdateRate(1000)
+    gvtk.set_usize(400, 400)
+    vbox.pack_start(gvtk)
+    gvtk.show
+    gvtk.Initialize
+    gvtk.Start
+    # prevents 'q' from exiting the app.
+    gvtk.AddObserver("ExitEvent", lambda o,e,x=nil: x)
+
+    # 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.GtkButton("Quit!")
+    quit.connect("clicked", gtk.mainquit)
+    vbox.pack_start(quit)
+    quit.show
+
+    # show the main window && start event processing.
+    window.show
+    gtk.mainloop
+end
+
+
+if __name__ == "__main__"
+    main
diff -uNr VTK_org/Wrapping/Ruby/vtk/gtk/GtkVTKRenderWindow.rb VTK/Wrapping/Ruby/vtk/gtk/GtkVTKRenderWindow.rb
--- VTK_org/Wrapping/Ruby/vtk/gtk/GtkVTKRenderWindow.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/gtk/GtkVTKRenderWindow.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,615 @@
+=begin
+Description:
+
+  Provides a simple VTK widget for Gtk.  This embeds a
+  vtkRenderWindow inside a GTK widget.  This is based on
+  vtkTkRenderWidget.rb.  The GtkVTKRenderWindowBase class provides the
+  abstraction necessary for someone to use their own interaction
+  behaviour.  The method names are similar to those in
+  vtkInteractorStyle.h.
+
+  The class uses the gtkgl.GtkGLArea widget (gtkglarea).  This avoids
+  a lot of problems with flicker.
+
+  There is a working example at the bottom.
+
+Credits:
+
+
+Bugs:
+
+  (*) There is a focus related problem.  Tkinter has a focus object
+  that handles focus events.  I dont know of an equivalent object
+  under GTK.  So, when an 'enter_notify_event' is received on the
+  GtkVTKRenderWindow I grab the focus but I dont know what to do when
+  I get a 'leave_notify_event'.
+
+  (*) Will  !work under Win32 because it uses the XID of a window in
+  OnRealize.  Suggestions to fix this will be appreciated.
+
+=end
+
+require 'gtk2'
+require 'gtkglext'
+require 'vtk'
+
+
+class GtkVTKRenderWindowBase < Gtk::GL::Area
+
+=begin
+   A base class that enables one to embed a vtkRenderWindow into
+    a pyGTK widget.  This class embeds the RenderWindow correctly.
+    Provided are some empty methods that can be overloaded to provide
+    a user defined interaction behaviour.  The event handling
+    functions have names that are somewhat similar to the ones in the
+    vtkInteractorStyle class included with VTK.
+=end
+
+  def initialize
+    super
+
+    glconfig = Gdk::GLConfig.new(Gdk::GLConfig::MODE_RGB|
+                                 Gdk::GLConfig::MODE_DOUBLE)
+
+    set_gl_capability(glconfig)
+
+
+    @RenderWindow = Vtk::RenderWindow.new
+
+    # private attributes
+    @Created = false
+
+    # used by the LOD actors
+    @DesiredUpdateRate = 15
+    @StillUpdateRate = 0.0001
+
+    self.ConnectSignals
+
+    # need this to be able to handle key_press events.
+    self.set_flags(Gtk::Window::CAN_FOCUS)
+    # default size
+    self.set_usize(300, 300)
+  end
+
+  def ConnectSignals
+    self.signal_connect("realize"){|wid, event| OnRealize(wid,event) }
+    self.signal_connect("expose_event"){|wid, event| OnExpose(wid,event) }
+    self.signal_connect("configure_event"){|wid, event| OnConfigure(wid,event) }
+    self.signal_connect("button_press_event"){|wid, event| OnButtonDown(wid,event) }
+    self.signal_connect("button_release_event"){|wid, event| OnButtonUp(wid,event) }
+    self.signal_connect("motion_notify_event"){|wid, event| OnMouseMove(wid,event) }
+    self.signal_connect("enter_notify_event"){|wid, event| OnEnter(wid,event) }
+    self.signal_connect("leave_notify_event"){|wid, event| OnLeave(wid,event) }
+    self.signal_connect("key_press_event"){|wid, event| OnKeyPress(wid,event) }
+    self.signal_connect("delete_event"){|wid, event| OnDestroy(wid,event) }
+    self.add_events(Gdk::Event::EXPOSURE_MASK|
+                    Gdk::Event::BUTTON_PRESS_MASK |
+                    Gdk::Event::BUTTON_RELEASE_MASK |
+                    Gdk::Event::KEY_PRESS_MASK |
+                    Gdk::Event::POINTER_MOTION_MASK |
+                    Gdk::Event::POINTER_MOTION_HINT_MASK |
+                    Gdk::Event::ENTER_NOTIFY_MASK |
+                    Gdk::Event::LEAVE_NOTIFY_MASK)
+  end
+
+  def GetRenderWindow
+    return @RenderWindow
+  end
+
+  def GetRenderer
+    @RenderWindow.GetRenderers.InitTraversal
+    return @RenderWindow.GetRenderers.GetNextItem
+  end
+
+  def SetDesiredUpdateRate(rate)
+=begin
+    Mirrors the method with the same name in vtkRenderWindowInteractor.
+=end
+    @DesiredUpdateRate = rate
+  end
+
+  def GetDesiredUpdateRate
+=begin
+    Mirrors the method with the same name in vtkRenderWindowInteractor.
+=end
+    return @DesiredUpdateRate 
+  end
+
+  def SetStillUpdateRate(rate)
+=begin
+    Mirrors the method with the same name in vtkRenderWindowInteractor.
+=end
+    @StillUpdateRate = rate
+  end
+
+  def GetStillUpdateRate
+=begin
+    Mirrors the method with the same name in vtkRenderWindowInteractor.
+=end
+    return @StillUpdateRate
+  end
+
+  def Render
+    if @Created
+      @RenderWindow.Render
+    end
+  end
+
+  def OnRealize(wid, event)
+    if @Created == 0
+      # you can't get the xid without the window being realized.
+      self.realize
+      win_id = self.get_window.xid.to_s
+      @RenderWindow.SetWindowInfo(win_id)
+      @Created = true
+    end
+    return true
+  end
+
+  def OnConfigure(wid, event=nil)
+    sz = @RenderWindow.GetSize
+    if (event.width != sz[0]) || (event.height != sz[1])
+      @RenderWindow.SetSize(event.width, event.height)
+    end
+    return true
+  end
+
+  def OnExpose(wid, event)
+    self.Render
+    return true
+  end
+
+  def OnDestroy(wid, event=nil)
+    self.hide
+    @RenderWindow = nil
+    self.destroy
+    return true
+  end
+
+  def OnButtonDown(wid, event)
+=begin
+    Mouse button pressed.
+=end
+    @RenderWindow.SetDesiredUpdateRate(@DesiredUpdateRate)
+    return true
+  end
+
+  def OnButtonUp(wid, event)
+=begin
+    Mouse button released.
+=end
+    @RenderWindow.SetDesiredUpdateRate(@StillUpdateRate)
+    return true
+  end
+
+  def OnMouseMove(wid, event)
+=begin
+    Mouse has moved.
+=end
+    return true
+  end
+
+  def OnEnter(wid, event)
+=begin
+    Entering the vtkRenderWindow.
+=end
+    return true
+  end
+
+  def OnLeave(wid, event)
+=begin
+    Leaving the vtkRenderWindow.
+=end
+    return true
+  end
+
+  def OnKeyPress(wid, event)
+=begin
+    Key pressed.
+=end
+    return true
+  end
+
+  def OnKeyRelease(wid, event)
+=begin
+    Key released.
+=end
+    return true
+  end
+end
+
+
+class GtkVTKRenderWindow < GtkVTKRenderWindowBase
+=begin
+    An example of a fully functional GtkVTKRenderWindow that is
+    based on the vtkRenderWidget.py provided with the VTK sources.
+=end
+
+  def initialize
+    super
+
+    @CurrentRenderer = nil
+    @CurrentCamera = nil
+    @CurrentZoom = 1.0
+    @CurrentLight = nil
+
+    @ViewportCenterX = 0
+    @ViewportCenterY = 0
+
+    @Picker = Vtk::CellPicker.new
+    @PickedAssembly = nil
+    @PickedProperty = Vtk::Property.new
+    @PickedProperty.SetColor(1, 0, 0)
+    @PrePickedProperty = nil
+
+    @OldFocus = nil
+
+    # these record the previous mouse position
+    @LastX = 0
+    @LastY = 0
+  end
+
+  def OnButtonDown(wid, event)
+    @RenderWindow.SetDesiredUpdateRate(@DesiredUpdateRate)
+    return self.StartMotion(wid, event)
+  end
+
+  def OnButtonUp(wid, event)
+    @RenderWindow.SetDesiredUpdateRate(@StillUpdateRate)
+    return self.EndMotion(wid, event)
+  end
+
+  def OnMouseMove(wid, event=nil)
+    if ((event.state & Gdk::Window::ModifierType::BUTTON1_MASK) == Gdk::Window::ModifierType::BUTTON1_MASK)
+      if ((event.state & Gdk::Window::ModifierType::SHIFT_MASK) == Gdk::Window::ModifierType::SHIFT_MASK)
+        m = self.pointer
+        self.Pan(m[0], m[1])
+        return true
+      else
+        m = self.pointer
+        self.Rotate(m[0], m[1])
+        return true
+      end
+    elsif ((event.state & Gdk::Window::ModifierType::BUTTON2_MASK) == Gdk::Window::ModifierType::BUTTON2_MASK)
+      m = self.pointer
+      self.Pan(m[0], m[1])
+      return true
+    elsif ((event.state & Gdk::Window::ModifierType::BUTTON3_MASK) == Gdk::Window::ModifierType::BUTTON3_MASK)
+      m = self.pointer
+      self.Zoom(m[0], m[1])
+      return true
+    else
+      return false
+    end
+  end
+
+  def OnEnter(wid, event=nil)
+    self.grab_focus
+    w = self.pointer
+    self.UpdateRenderer(w[0], w[1])
+    return true
+  end
+
+  def OnLeave(wid, event)
+    return true
+  end
+
+  def OnKeyPress(wid, event=nil)
+    if (event.keyval == "r") || (event.keyval == "R")
+      self.Reset
+      return true
+    elsif (event.keyval == "w") || (event.keyval == "W")
+      self.Wireframe
+      return true
+    elsif (event.keyval == "s") || (event.keyval == "S")
+      self.Surface
+      return true
+    elsif (event.keyval == "p") || (event.keyval == "P")
+      m = self.pointer
+      self.PickActor(m[0], m[1])
+      return true
+    else
+      return false
+    end
+  end
+
+  def GetZoomFactor
+    return @CurrentZoom
+  end
+
+  def SetZoomFactor(zf)
+    @CurrentZoom = zf
+  end
+
+  def GetPicker
+    return @Picker
+  end
+
+  def Render
+    if (@CurrentLight)
+      light = @CurrentLight
+      light.SetPosition(@CurrentCamera.GetPosition)
+      light.SetFocalPoint(@CurrentCamera.GetFocalPoint)
+    end
+
+    GtkVTKRenderWindowBase.Render
+  end
+
+  def UpdateRenderer(x,y)
+=begin
+        UpdateRenderer will identify the renderer under the mouse && set
+        up _CurrentRenderer, _CurrentCamera, && _CurrentLight.
+=end
+    windowX = self.get_window.width
+    windowY = self.get_window.height
+
+    renderers = @RenderWindow.GetRenderers
+    numRenderers = renderers.GetNumberOfItems
+
+    @CurrentRenderer = nil
+    renderers.InitTraversal
+    for i in 0...numRenderers
+      renderer = renderers.GetNextItem
+      vx,vy = [0,0]
+      if (windowX > 1)
+        vx = x.to_f/(windowX-1)
+      end
+      if (windowY > 1)
+        vy = (windowY-y.to_f-1)/(windowY-1)
+      end
+      (vpxmin,vpymin,vpxmax,vpymax) = renderer.GetViewport
+
+      if (vx >= vpxmin && vx <= vpxmax && vy >= vpymin && vy <= vpymax)
+        @CurrentRenderer = renderer
+        @ViewportCenterX = windowX.to_f*(vpxmax-vpxmin)/2.0 +vpxmin
+        @ViewportCenterY = windowY.to_f*(vpymax-vpymin)/2.0 +vpymin
+        @CurrentCamera = @CurrentRenderer.GetActiveCamera
+        lights = @CurrentRenderer.GetLights
+        lights.InitTraversal
+        break if @CurrentLight = lights.GetNextItem
+      end
+    end
+
+    @LastX = x
+    @LastY = y
+  end
+
+  def GetCurrentRenderer
+    return @CurrentRenderer
+  end
+
+  def StartMotion(wid, event=nil)
+    x = event.x
+    y = event.y
+    self.UpdateRenderer(x,y)
+    return true
+  end
+
+  def EndMotion(wid, event=nil)
+    if @CurrentRenderer
+      self.Render
+    end
+    return true
+  end
+
+  def Rotate(x,y)
+    if @CurrentRenderer
+
+      @CurrentCamera.Azimuth(@LastX - x)
+      @CurrentCamera.Elevation(y - @LastY)
+      @CurrentCamera.OrthogonalizeViewUp
+
+      @LastX = x
+      @LastY = y
+
+      @CurrentRenderer.ResetCameraClippingRange
+      self.Render
+    end
+  end
+
+  def Pan(x,y)
+    if @CurrentRenderer
+
+      renderer = @CurrentRenderer
+      camera = @CurrentCamera
+      (pPoint0,pPoint1,pPoint2) = camera.GetPosition
+      (fPoint0,fPoint1,fPoint2) = camera.GetFocalPoint
+
+      if (camera.GetParallelProjection)
+        renderer.SetWorldPoint(fPoint0,fPoint1,fPoint2,1.0)
+        renderer.WorldToDisplay
+        fx,fy,fz = renderer.GetDisplayPoint
+        renderer.SetDisplayPoint(fx-x+@LastX,
+                                 fy+y-@LastY,
+                                 fz)
+        renderer.DisplayToWorld
+        fx,fy,fz,fw = renderer.GetWorldPoint
+        camera.SetFocalPoint(fx,fy,fz)
+
+        renderer.SetWorldPoint(pPoint0,pPoint1,pPoint2,1.0)
+        renderer.WorldToDisplay
+        fx,fy,fz = renderer.GetDisplayPoint
+        renderer.SetDisplayPoint(fx-x+@LastX,
+                                 fy+y-@LastY,
+                                 fz)
+        renderer.DisplayToWorld
+        fx,fy,fz,fw = renderer.GetWorldPoint
+        camera.SetPosition(fx,fy,fz)
+
+      else
+        (fPoint0,fPoint1,fPoint2) = camera.GetFocalPoint
+        # Specify a point location in world coordinates
+        renderer.SetWorldPoint(fPoint0,fPoint1,fPoint2,1.0)
+        renderer.WorldToDisplay
+        # Convert world point coordinates to display coordinates
+        dPoint = renderer.GetDisplayPoint
+        focalDepth = dPoint[2]
+
+        aPoint0 = @ViewportCenterX + (x - @LastX)
+        aPoint1 = @ViewportCenterY - (y - @LastY)
+
+        renderer.SetDisplayPoint(aPoint0,aPoint1,focalDepth)
+        renderer.DisplayToWorld
+
+        (rPoint0,rPoint1,rPoint2,rPoint3) = renderer.GetWorldPoint
+        if (rPoint3 != 0.0)
+          rPoint0 = rPoint0/rPoint3
+          rPoint1 = rPoint1/rPoint3
+          rPoint2 = rPoint2/rPoint3
+        end
+
+        camera.SetFocalPoint((fPoint0 - rPoint0) + fPoint0, 
+                             (fPoint1 - rPoint1) + fPoint1,
+                             (fPoint2 - rPoint2) + fPoint2) 
+
+        camera.SetPosition((fPoint0 - rPoint0) + pPoint0, 
+                           (fPoint1 - rPoint1) + pPoint1,
+                           (fPoint2 - rPoint2) + pPoint2)
+      end
+
+      @LastX = x
+      @LastY = y
+
+      self.Render
+    end
+  end
+
+  def Zoom(x,y)
+    if @CurrentRenderer
+
+      renderer = @CurrentRenderer
+      camera = @CurrentCamera
+
+      zoomFactor = 1.02**(0.5*(@LastY - y))
+      @CurrentZoom = @CurrentZoom * zoomFactor
+
+      if camera.GetParallelProjection
+        parallelScale = camera.GetParallelScale/zoomFactor
+        camera.SetParallelScale(parallelScale)
+      else
+        camera.Dolly(zoomFactor)
+        renderer.ResetCameraClippingRange
+      end
+
+      @LastX = x
+      @LastY = y
+
+      self.Render
+    end
+  end
+
+  def Reset
+    if @CurrentRenderer
+      @CurrentRenderer.ResetCamera
+    end
+
+    self.Render
+  end
+
+  def Wireframe
+    actors = @CurrentRenderer.GetActors
+    numActors = actors.GetNumberOfItems
+    actors.InitTraversal
+    for i in 0...numActors
+      actor = actors.GetNextItem
+      actor.GetProperty.SetRepresentationToWireframe
+    end
+
+    self.Render
+  end
+
+  def Surface
+    actors = @CurrentRenderer.GetActors
+    numActors = actors.GetNumberOfItems
+    actors.InitTraversal
+    for i in 0...numActors
+      actor = actors.GetNextItem
+      actor.GetProperty.SetRepresentationToSurface
+    end
+
+    self.Render
+  end
+
+  def PickActor(x,y)
+    if @CurrentRenderer
+
+      renderer = @CurrentRenderer
+      picker = @Picker
+
+      windowY = self.get_window.height
+      picker.Pick(x,(windowY - y - 1),0.0,renderer)
+      assembly = picker.GetAssembly
+
+      if (@PickedAssembly != nil && @PrePickedProperty != nil)
+        @PickedAssembly.SetProperty(@PrePickedProperty)
+        # release hold of the property
+        @PrePickedProperty.UnRegister(@PrePickedProperty)
+        @PrePickedProperty = nil
+      end
+
+      if (assembly != nil)
+        @PickedAssembly = assembly
+        @PrePickedProperty = @PickedAssembly.GetProperty
+        # hold onto the property
+        @PrePickedProperty.Register(@PrePickedProperty)
+        @PickedAssembly.SetProperty(@PickedProperty)
+      end
+
+      self.Render
+    end
+  end
+end
+
+
+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
+
+
+if $0 == __FILE__
+  main
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/gtk.rb VTK/Wrapping/Ruby/vtk/gtk.rb
--- VTK_org/Wrapping/Ruby/vtk/gtk.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/gtk.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,5 @@
+require 'vtk'
+require 'vtk/gtk/GtkVTKRenderWindow'
+require 'vtk/gtk/GtkVTKRenderWindowInteractor'
+require 'vtk/gtk/GtkGLExtVTKRenderWindow'
+require 'vtk/gtk/GtkGLExtVTKRenderWindowInteractor'
diff -uNr VTK_org/Wrapping/Ruby/vtk/hybrid.rb VTK/Wrapping/Ruby/vtk/hybrid.rb
--- VTK_org/Wrapping/Ruby/vtk/hybrid.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/hybrid.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkHybridRuby'
+else
+  require 'vtk/libvtkHybridRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/imaging.rb VTK/Wrapping/Ruby/vtk/imaging.rb
--- VTK_org/Wrapping/Ruby/vtk/imaging.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/imaging.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkImagingRuby'
+else
+  require 'vtk/libvtkImagingRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/io.rb VTK/Wrapping/Ruby/vtk/io.rb
--- VTK_org/Wrapping/Ruby/vtk/io.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/io.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkIORuby'
+else
+  require 'vtk/libvtkIORuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/parallel.rb VTK/Wrapping/Ruby/vtk/parallel.rb
--- VTK_org/Wrapping/Ruby/vtk/parallel.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/parallel.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkParallelRuby'
+else
+  require 'vtk/libvtkParallelRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/rendering.rb VTK/Wrapping/Ruby/vtk/rendering.rb
--- VTK_org/Wrapping/Ruby/vtk/rendering.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/rendering.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkRenderingRuby'
+else
+  require 'vtk/libvtkRenderingRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/tk/vtkLoadRubyTkWidgets.rb VTK/Wrapping/Ruby/vtk/tk/vtkLoadRubyTkWidgets.rb
--- VTK_org/Wrapping/Ruby/vtk/tk/vtkLoadRubyTkWidgets.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/tk/vtkLoadRubyTkWidgets.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,54 @@
+require 'rbconfig'
+require 'tk'
+
+def Vtk.LoadRubyTkWidgets
+=begin
+    vtkLoadRubyTkWidgets(interp) -- load vtk-tk widget extensions
+
+    This is a mess of mixed python and tcl code that searches for the
+    shared object file that contains the python-vtk-tk widgets.  Both
+    the ruby path and the tcl path are searched.
+=end
+  name = 'vtkRenderingRubyTkWidgets'
+  pkgname = name.downcase.capitalize
+
+  # find out if the file is already loaded
+  loaded = Tk.tk_call('info', 'loaded')
+  if loaded.include?(pkgname)
+    return false
+  end
+
+  # create the platform-dependent file name
+  prefix = ''
+  if Config::CONFIG['arch']=~/linux/
+    prefix = 'lib'
+  end
+  extension = Tk.tk_call('info', 'sharedlibextension')
+  filename = prefix+name+extension
+
+  # create an extensive list of paths to search
+  pathlist = $LOAD_PATH
+  # add tcl paths, ensure that {} is handled properly
+  auto_paths = Tk::AUTO_PATH.to_a
+  pathlist += auto_paths
+
+  # a common place for these sorts of things  
+  if Config::CONFIG['arch']=~/linux/
+    pathlist += ['/usr/local/lib']
+  end
+
+  # attempt to load
+  for path in pathlist
+    fullpath = File.join(path, filename)
+    begin
+      Tk.load_tcllibrary(fullpath, pkgname)
+      return true
+    rescue
+      next
+    end
+  end
+
+  # re-generate the error
+  Tk.tk_call('load', filename)
+  return nil
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/tk/vtkTkImageViewerWidget.rb VTK/Wrapping/Ruby/vtk/tk/vtkTkImageViewerWidget.rb
--- VTK_org/Wrapping/Ruby/vtk/tk/vtkTkImageViewerWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/tk/vtkTkImageViewerWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,377 @@
+=begin
+A vtkTkImageViewerWidget for ruby, which is based on the
+vtkTkImageWindowWidget.
+
+Specify double=1 to get a double-buffered window.
+
+=end
+
+require 'tk'
+require 'vtk'
+require 'vtk/tk/vtkLoadRubyTkWidgets'
+
+
+class VtkTkImageViewerWidget < TkWindow
+=begin
+    A vtkTkImageViewerWidget for Ruby.
+
+    Use GetImageViewer() to get the vtkImageViewer.
+
+    Create with the keyword double=1 in order to generate a
+    double-buffered viewer.
+    
+    Create with the keyword focus_on_enter=1 to enable
+    focus-follows-mouse.  The default is for a click-to-focus mode.    
+=end
+  TkCommandNames = ['vtkTkImageViewerWidget'.freeze].freeze
+
+  def initialize(master, kw={})
+=begin
+        Constructor.
+
+        Keyword arguments:
+
+          iv -- Use passed image viewer instead of creating a new one.
+
+          double -- If True, generate a double-buffered viewer.
+          Defaults to False.
+
+          focus_on_enter -- If True, use a focus-follows-mouse mode.
+          Defaults to False where the widget will use a click-to-focus
+          mode.
+=end
+    # load the necessary extensions into tk
+    vtkLoadRubyTkWidgets()
+
+    _symbolkey2str(kw)
+
+    if kw['iv']
+      @ImageViewer = kw['iv']
+    else
+      @ImageViewer = Vtk::ImageViewer.new
+    end
+
+    doubleBuffer = 0
+    if kw['double']
+      doubleBuffer = 1
+      kw.delete('double')
+    end
+ 
+    # check if focus should follow mouse
+    if kw['focus_on_enter']
+      @FocusOnEnter = 1
+    else
+      @FocusOnEnter = 0
+    end
+
+    kw['iv'] = @ImageViewer.GetAddressAsString("vtkImageViewer")
+    kw['widgetname'] = 'vtkTkImageViewerWidget'
+    super(master, kw)
+
+    if doubleBuffer
+      @ImageViewer.GetRenderWindow.DoubleBufferOn
+    end
+
+    self.BindTkImageViewer
+  end
+
+  def GetImageViewer
+    return @ImageViewer
+  end
+
+  def Render
+    @ImageViewer.Render
+  end
+
+  def BindTkImageViewer
+    imager = @ImageViewer.GetRenderer
+        
+    # stuff for window level text.
+    mapper = Vtk::TextMapper.new
+    mapper.SetInput("none")
+    t_prop = mapper.GetTextProperty
+    t_prop.SetFontFamilyToTimes
+    t_prop.SetFontSize(18)
+    t_prop.BoldOn
+    t_prop.ShadowOn
+        
+    @LevelMapper = mapper
+
+    actor = Vtk::Actor2D.new
+    actor.SetMapper(mapper)
+    actor.SetLayerNumber(1)
+    actor.GetPositionCoordinate.SetValue(4,22)
+    actor.GetProperty.SetColor(1,1,0.5)
+    actor.SetVisibility(0)
+    imager.AddActor2D(actor)
+
+    @LevelActor = actor
+                
+    mapper = Vtk::TextMapper.new
+    mapper.SetInput("none")
+    t_prop = mapper.GetTextProperty
+    t_prop.SetFontFamilyToTimes
+    t_prop.SetFontSize(18)
+    t_prop.BoldOn
+    t_prop.ShadowOn
+    
+    @WindowMapper = mapper
+
+    actor = Vtk::Actor2D.new
+    actor.SetMapper(mapper)
+    actor.SetLayerNumber(1)
+    actor.GetPositionCoordinate.SetValue(4,4)
+    actor.GetProperty.SetColor(1,1,0.5)
+    actor.SetVisibility(0)
+    imager.AddActor2D(actor)
+
+    @WindowActor = actor
+
+    @LastX = 0
+    @LastY = 0
+    @OldFocus = 0
+    @InExpose = 0
+    
+    # bindings
+    # window level
+    self.bind("ButtonPress-1"){|e,s| s||s=self; s.StartWindowLevelInteraction(e.x,e.y) }
+    self.bind("B1-Motion"){|e,s| s||s=self; s.UpdateWindowLevelInteraction(e.x,e.y) }
+    self.bind("ButtonRelease-1"){|e,s| s||s=self; s.EndWindowLevelInteraction }
+    
+    # Get the value
+    self.bind("ButtonPress-3"){|e,s| s||s=self; s.StartQueryInteraction(e.x,e.y) }
+    self.bind("B3-Motion"){|e,s| s||s=self; s.UpdateQueryInteraction(e.x,e.y) }
+    self.bind("ButtonRelease-3"){|e,s| s||s=self; s.EndQueryInteraction }
+
+    self.bind("Expose"){|e,s| s||s=self; s.ExposeTkImageViewer }
+    self.bind("Enter"){|e,s| s||s=self; s.EnterTkViewer }
+    self.bind("Leave"){|e,s| s||s=self; s.LeaveTkViewer }
+    self.bind("KeyPress-e"){|e,s| s||s=self; exit }
+    self.bind("KeyPress-r"){|e,s| s||s=self; s.ResetTkImageViewer }
+  end
+
+  def GetImageViewer
+    return @ImageViewer
+  end
+
+  def Render
+    return @ImageViewer.Render
+  end
+
+  def _GrabFocus
+    @OldFocus = self.focus
+    self.focus
+  end
+        
+  def EnterTkViewer
+    if @FocusOnEnter
+      self._GrabFocus
+    end
+    return nil
+  end
+
+  def LeaveTkViewer
+    if @FocusOnEnter && @OldFocus != nil
+      @OldFocus.focus
+    end
+    return nil
+  end
+
+  def ExposeTkImageViewer
+    if @InExpose == 0
+      @InExpose = 1
+      self.update()
+      @ImageViewer.Render()
+      @InExpose = 0
+    end
+    return nil
+  end
+
+  def StartWindowLevelInteraction(x,y)
+    if ! @FocusOnEnter
+      _GrabFocus
+    end
+    viewer = @ImageViewer
+    @LastX = x
+    @LastY = y
+    @Window = viewer.GetColorWindow.to_f
+    @Level = viewer.GetColorLevel.to_f
+
+    # make the window level text visible
+    @LevelActor.SetVisibility(1)
+    @WindowActor.SetVisibility(1)
+
+    self.UpdateWindowLevelInteraction(x,y)
+    return nil
+  end
+
+  def EndWindowLevelInteraction
+    # make the window level text invisible
+    @LevelActor.SetVisibility(0)
+    @WindowActor.SetVisibility(0)
+    self.Render
+  end
+
+  def UpdateWindowLevelInteraction(x,y)
+    # compute normalized delta
+    dx = 4.0*(x - @LastX)/self.winfo_width*@Window
+    dy = 4.0*(@LastY - y)/self.winfo_height*@Level
+
+    # abs so that direction does not flip
+    if @Window < 0.0
+      dx = -dx
+    end
+    if @Level < 0.0
+      dy = -dy
+    end
+
+    # compute new window level
+    window = @Window + dx
+    if window < 0.0
+      level = @Level + dy
+    else
+      level = @Level - dy
+    end
+
+    viewer = @ImageViewer
+    viewer.SetColorWindow(window)
+    viewer.SetColorLevel(level)
+
+    @WindowMapper.SetInput("Window: %g" % window)
+    @LevelMapper.SetInput("Level: %g" % level)
+    
+    self.Render
+  end
+
+  def ResetTkImageViewer
+    # Reset: Set window level to show all values
+    viewer = @ImageViewer
+    input = viewer.GetInput
+    if input == nil
+      return nil
+    end
+
+    # Get the extent in viewer
+    z = viewer.GetZSlice
+
+    input.SetUpdateExtent(-99999,99999,-99999,99999,z,z)
+    input.Update
+
+    low,high = input.GetScalarRange
+   
+    viewer.SetColorWindow(high - low)
+    viewer.SetColorLevel((high + low) * 0.5)
+
+    self.Render
+  end
+
+  def StartQueryInteraction(x,y)
+    if ! @FocusOnEnter
+      _GrabFocus()
+    end
+    # Query PixleValue stuff
+    @WindowActor.SetVisibility(1)
+    self.UpdateQueryInteraction(x,y)
+  end
+
+  def EndQueryInteraction
+    @WindowActor.SetVisibility(0)
+    self.Render
+  end
+
+  def UpdateQueryInteraction(x,y)
+    viewer = @ImageViewer
+    input = viewer.GetInput
+    z = viewer.GetZSlice
+
+    # y is flipped upside down
+    y = self.winfo_height - y
+
+    # make sure point is in the whole extent of the image.
+    xMin,xMax,yMin,yMax,zMin,zMax = input.GetWholeExtent
+    if (x < xMin || x > xMax || y < yMin || y > yMax || z < zMin || z > zMax)
+      return nil
+    end
+
+    input.SetUpdateExtent(x,x,y,y,z,z)
+    input.Update
+    numComps = input.GetNumberOfScalarComponents
+    text = ""
+    for i in 0...numComps
+      val = input.GetScalarComponentAsDouble(x,y,z,i)
+      text = "#{text}  #{"%.1f"%val}"
+    end
+
+    @WindowMapper.SetInput("(#{"%d"%x}, #{"%d"%y}): #{text}")
+        
+    self.Render
+  end
+
+end
+
+#-----------------------------------------------------------------------------
+# an example of how to use this widget
+if $0 == __FILE__
+  canvas = Vtk::ImageCanvasSource2D.new
+  canvas.SetNumberOfScalarComponents(3)
+  canvas.SetScalarType(3)
+  canvas.SetExtent(0,511,0,511,0,0)
+  canvas.SetDrawColor(100,100,0)
+  canvas.FillBox(0,511,0,511)
+  canvas.SetDrawColor(200,0,200)
+  canvas.FillBox(32,511,100,500)
+  canvas.SetDrawColor(100,0,0)
+  canvas.FillTube(550,20,30,400,5)
+  canvas.SetDrawColor(255,255,255)
+  canvas.DrawSegment3D(10,20,0,90,510,0)
+  canvas.SetDrawColor(200,50,50)
+  canvas.DrawSegment3D(510,90,0,10,20,0)
+
+  # Check segment clipping
+  canvas.SetDrawColor(0,200,0)
+  canvas.DrawSegment(-10,30,30,-10)
+  canvas.DrawSegment(-10,481,30,521)
+  canvas.DrawSegment(481,-10,521,30)
+  canvas.DrawSegment(481,521,521,481)
+
+  # Check Filling a triangle
+  canvas.SetDrawColor(20,200,200)
+  canvas.FillTriangle(-100,100,190,150,40,300)
+
+  # Check drawing a circle
+  canvas.SetDrawColor(250,250,10)
+  canvas.DrawCircle(350,350,200.0)
+
+  # Check drawing a point
+  canvas.SetDrawColor(250,250,250)
+  canvas.DrawPoint(350,350)
+  canvas.DrawPoint(350,550)
+
+  # Test filling functionality
+  canvas.SetDrawColor(55,0,0)
+  canvas.DrawCircle(450,350,80.0)
+  canvas.SetDrawColor(100,255,100)
+  canvas.FillPixel(450,350)
+
+  # Create the GUI: two renderer widgets and a quit button
+
+  frame = TkFrame.new
+
+  widget = VtkTkImageViewerWidget.new(frame,'width'=>512,'height'=>512,'double'=>1)
+  viewer = widget.GetImageViewer
+  viewer.SetInput(canvas.GetOutput)
+  viewer.SetColorWindow(256)
+  viewer.SetColorLevel(127.5)
+
+  button = TkButton.new(frame){
+    text "Quit"
+    command { exit }
+  }
+
+  widget.pack('side'=>'top','padx'=>3,'pady'=>3,'fill'=>'both','expand'=>true)
+  frame.pack('fill'=>'both','expand'=>true)
+  button.pack('fill'=>'x')
+
+  frame.mainloop
+
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/tk/vtkTkPhotoImage.rb VTK/Wrapping/Ruby/vtk/tk/vtkTkPhotoImage.rb
--- VTK_org/Wrapping/Ruby/vtk/tk/vtkTkPhotoImage.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/tk/vtkTkPhotoImage.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,28 @@
+=begin
+A subclass of Tkinter.PhotoImage that connects a
+vtkImageData to a photo widget.
+=end
+
+require 'tk'
+require 'vtk'
+require 'vtk/tk/vtkLoadRubyTkWidgets'
+
+class Vtk::TkPhotoImage < TkPhotoImage
+=begin
+    A subclass of PhotoImage with helper functions
+    A subend
+    for displaying vtkImageData
+=end
+  def initialize( kw={} )
+    # Caller the superclass
+    super( kw )
+    Vtk.LoadRubyTkWidgets
+  end
+  def PutImageSlice ( image, z, options={} )
+    default_options = { 'orientation'=>'transverse', 'window'=>256, 'level'=>128 }
+    default_options.update( options )
+    options = default_options
+    t = "_"+image.GetAddressAsString('vtkImageData')[5..-1]+"_"+image.GetClassName
+    Tk.tk_call("vtkImageDataToTkPhoto", t, @path, "%d"%z, options['orientation'], "%d"%options['window'], "%d"%options['level'])
+  end
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/tk/vtkTkRenderWidget.rb VTK/Wrapping/Ruby/vtk/tk/vtkTkRenderWidget.rb
--- VTK_org/Wrapping/Ruby/vtk/tk/vtkTkRenderWidget.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/tk/vtkTkRenderWidget.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,486 @@
+=begin
+A simple vtkTkRenderWidget for Tk.
+
+
+A few important notes:
+
+This class is meant to be used as a base-class widget for
+doing VTK rendering in Ruby
+
+In VTK (and C++) there is a very important distinction between
+public ivars (attributes in rubyspeak), protected ivars, &&
+private ivars.  When you write a ruby class that you want
+to 'look && feel' like a VTK class, you should follow these rules.
+
+1) Attributes should never be public.  Attributes should always be
+   either protected (prefixed with a single underscore) || private
+   (prefixed with a double underscore).  You can provide access to
+   attributes through public Set/Get methods (same as VTK).
+
+2) Use a single underscore to denote a protected attribute, e.g.
+   @RenderWindow is protected (can be accessed from this
+   class || a derived class).
+
+3) Use a double underscore to denote a private attribute, e.g.
+   @InExpose can not be accessed outside of this class.
+
+All attributes should be 'declared' in the __init__ function
+i.e. set to some initial value.  Don't forget that 'nil' means
+'NULL' - the ruby/vtk wrappers guarantee their equivalence.
+=end
+
+require 'tk'
+require 'vtk'
+require 'vtk/tk/vtkLoadRubyTkWidgets'
+
+
+class Vtk::TkRenderWidget < TkWindow
+=begin
+    A vtkTkRenderWidget for Ruby
+
+    Use GetRenderWindow to get the vtkRenderWindow.
+
+    Create with the keyword stereo=1 in order to generate a
+    stereo-capable window.
+
+    Create with the keyword focus_on_enter=1 to enable
+    focus-follows-mouse.  The default is for a click-to-focus mode.
+=end
+  TkCommandNames = ['vtkTkRenderWidget'.freeze].freeze
+
+  def initialize( master, kw={} )
+=begin
+        Constructor.
+
+        Keyword arguments:
+
+          rw -- Use passed render window instead of creating a new one.
+
+          stereo -- If True, generate a stereo-capable window.
+          Defaults to False.
+
+          focus_on_enter -- If True, use a focus-follows-mouse mode.
+          Defaults to False where the widget will use a click-to-focus
+          mode.
+=end
+    # load the necessary extensions into tk
+    Vtk.LoadRubyTkWidgets
+
+    _symbolkey2str(kw)
+
+    if kw['rw']
+      renderWindow = kw['rw']
+    else
+      renderWindow = Vtk::RenderWindow.new
+    end
+
+    if kw['stereo']
+      renderWindow.StereoCapableWindowOn
+      kw.delete('stereo')
+    end
+
+    # check if focus should follow mouse
+    if kw['focus_on_enter']
+      @FocusOnEnter = true
+      kw.delete('focus_on_enter')
+    else
+      @FocusOnEnter = false
+    end
+
+    kw['rw'] = renderWindow.GetAddressAsString("vtkRenderWindow")
+    kw['widgetname'] = 'vtkTkRenderWidget'
+    super(master, kw)
+    renderWindow.UnRegister(nil)
+
+    @CurrentRenderer = nil
+    @CurrentCamera = nil
+    @CurrentZoom = 1.0
+    @CurrentLight = nil
+
+    @ViewportCenterX = 0
+    @ViewportCenterY = 0
+
+    @Picker = Vtk::CellPicker.new
+    @PickedAssembly = nil
+    @PickedProperty = Vtk::Property.new
+    @PickedProperty.SetColor(1,0,0)
+    @PrePickedProperty = nil
+
+    @OldFocus = nil
+
+    # used by the LOD actors
+    @DesiredUpdateRate = 15
+    @StillUpdateRate = 0.0001
+
+    # these record the previous mouse position
+    @LastX = 0
+    @LastY = 0
+
+    # private attributes
+    @InExpose = false
+
+    # create the Tk bindings
+    self.BindTkRenderWidget
+  end
+
+  def BindTkRenderWidget
+=begin
+        Bind some default actions.
+=end
+    self.bind("ButtonPress"){|e,s| s||s=self; s.StartMotion(e.x,e.y) }
+    self.bind("ButtonRelease"){|e,s| s||s=self; s.EndMotion(e.x,e.y) }
+    self.bind("B1-Motion"){|e,s| s||s=self; s.Rotate(e.x,e.y) }
+    self.bind("B2-Motion"){|e,s| s||s=self; s.Pan(e.x,e.y) }
+    self.bind("B3-Motion"){|e,s| s||s=self; s.Zoom(e.x,e.y) }
+    self.bind("Shift-B1-Motion"){|e,s| s||s=self; s.Pan(e.x,e.y) }
+    self.bind("KeyPress-r"){|e,s| s||s=self; s.Reset(e.x,e.y) }
+    self.bind("KeyPress-u"){|e,s| s||s=self; s.deiconify }
+    self.bind("KeyPress-w"){|e,s| s||s=self; s.Wireframe }
+    self.bind("KeyPress-s"){|e,s| s||s=self; s.Surface }
+    self.bind("KeyPress-p"){|e,s| s||s=self; s.PickActor(e.x,e.y) }
+    if @FocusOnEnter
+      self.bind("Enter"){|e,s| s||s=self; s.Enter(e.x,e.y) }
+      self.bind("Leave"){|e,s| s||s=self; s.Leave(e.x,e.y) }
+    else
+      self.bind("ButtonPress"){|e,s| s||s=self; s.Enter(e.x,e.y) }
+      self.bind("Expose"){|e,s| s||s=self; s.Expose }
+    end
+  end
+
+  def GetZoomFactor
+    return @CurrentZoom
+  end
+
+  def SetDesiredUpdateRate(rate)
+=begin
+        Mirrors the method with the same name in
+        vtkRenderWindowInteractor.
+=end
+    @DesiredUpdateRate = rate
+  end
+
+  def GetDesiredUpdateRate
+=begin
+        Mirrors the method with the same name in
+        vtkRenderWindowInteractor.
+=end
+    return @DesiredUpdateRate 
+  end
+
+  def SetStillUpdateRate(rate)
+=begin
+        Mirrors the method with the same name in
+        vtkRenderWindowInteractor.
+=end
+    @StillUpdateRate = rate
+  end
+
+  def GetStillUpdateRate
+=begin
+       Mirrors the method with the same name in
+        vtkRenderWindowInteractor.
+=end
+    return @StillUpdateRate 
+  end
+
+  def GetRenderWindow
+    addr = Tk.tk_call(self, 'GetRenderWindow')[5..-1]
+    renderWindow = Vtk::RenderWindow.new('_%s_vtkRenderWindow_p' % addr)
+    renderWindow.UnRegister(nil)
+    return renderWindow
+  end
+
+  def GetPicker
+    return @Picker
+  end
+
+  def Expose
+    if ! @InExpose
+      @InExpose = true
+      self.update
+      self.GetRenderWindow.Render
+      @InExpose = false
+    end
+  end
+
+  def Render
+    if (@CurrentLight)
+      light = @CurrentLight
+      light.SetPosition(@CurrentCamera.GetPosition)
+      light.SetFocalPoint(@CurrentCamera.GetFocalPoint)
+    end
+
+    self.GetRenderWindow.Render
+  end
+
+  def UpdateRenderer(x,y)
+=begin
+        UpdateRenderer will identify the renderer under the mouse && set
+        up _CurrentRenderer, _CurrentCamera, && _CurrentLight.
+=end
+    windowX = self.winfo_width
+    windowY = self.winfo_height
+
+    renderers = self.GetRenderWindow.GetRenderers
+    numRenderers = renderers.GetNumberOfItems
+
+    @CurrentRenderer = nil
+    renderers.InitTraversal
+    for i in 0...numRenderers
+      renderer = renderers.GetNextItem
+      vx,vy = [0,0]
+      if (windowX > 1)
+        vx = x.to_f/(windowX-1)
+      end
+      if (windowY > 1)
+        vy = (windowY-y.to_f-1)/(windowY-1)
+      end
+      vpxmin,vpymin,vpxmax,vpymax = renderer.GetViewport
+
+      if (vx >= vpxmin && vx <= vpxmax && vy >= vpymin && vy <= vpymax)
+        @CurrentRenderer = renderer
+        @ViewportCenterX = windowX.to_f*(vpxmax-vpxmin)/2.0 +vpxmin
+        @ViewportCenterY = windowY.to_f*(vpymax-vpymin)/2.0 +vpymin
+        @CurrentCamera = @CurrentRenderer.GetActiveCamera
+        lights = @CurrentRenderer.GetLights
+        lights.InitTraversal
+        @CurrentLight = lights.GetNextItem
+        break
+      end
+    end
+
+    @LastX = x
+    @LastY = y
+  end
+
+  def GetCurrentRenderer
+    return @CurrentRenderer
+  end
+
+  def Enter(x,y)
+    @OldFocus = self.focus
+    self.focus
+    self.StartMotion(x, y)
+  end
+
+  def Leave(x,y)
+    if (@OldFocus != nil)
+      @OldFocus.focus
+    end
+  end
+
+  def StartMotion(x,y)
+    self.GetRenderWindow.SetDesiredUpdateRate(@DesiredUpdateRate)
+    self.UpdateRenderer(x,y)
+  end
+
+  def EndMotion(x,y)
+    self.GetRenderWindow.SetDesiredUpdateRate(@StillUpdateRate)
+    if @CurrentRenderer
+      self.Render
+    end
+  end
+
+  def Rotate(x,y)
+    if @CurrentRenderer
+
+      @CurrentCamera.Azimuth(@LastX - x)
+      @CurrentCamera.Elevation(y - @LastY)
+      @CurrentCamera.OrthogonalizeViewUp
+
+      @LastX = x
+      @LastY = y
+
+      @CurrentRenderer.ResetCameraClippingRange
+      self.Render
+    end
+  end
+
+  def Pan(x,y)
+    if @CurrentRenderer
+
+      renderer = @CurrentRenderer
+      camera = @CurrentCamera
+      pPoint0,pPoint1,pPoint2 = camera.GetPosition
+      fPoint0,fPoint1,fPoint2 = camera.GetFocalPoint
+
+      if (camera.GetParallelProjection)
+        renderer.SetWorldPoint(fPoint0,fPoint1,fPoint2,1.0)
+        renderer.WorldToDisplay
+        fx,fy,fz = renderer.GetDisplayPoint
+        renderer.SetDisplayPoint(fx-x+@LastX,
+                                 fy+y-@LastY,
+                                 fz)
+        renderer.DisplayToWorld
+        fx,fy,fz,fw = renderer.GetWorldPoint
+        camera.SetFocalPoint(fx,fy,fz)
+
+        renderer.SetWorldPoint(pPoint0,pPoint1,pPoint2,1.0)
+        renderer.WorldToDisplay
+        fx,fy,fz = renderer.GetDisplayPoint
+        renderer.SetDisplayPoint(fx-x+@LastX,
+                                 fy+y-@LastY,
+                                 fz)
+        renderer.DisplayToWorld
+        fx,fy,fz,fw = renderer.GetWorldPoint
+        camera.SetPosition(fx,fy,fz)
+
+      else
+        (fPoint0,fPoint1,fPoint2) = camera.GetFocalPoint
+        # Specify a point location in world coordinates
+        renderer.SetWorldPoint(fPoint0,fPoint1,fPoint2,1.0)
+        renderer.WorldToDisplay
+        # Convert world point coordinates to display coordinates
+        dPoint = renderer.GetDisplayPoint
+        focalDepth = dPoint[2]
+
+        aPoint0 = @ViewportCenterX + (x - @LastX)
+        aPoint1 = @ViewportCenterY - (y - @LastY)
+
+        renderer.SetDisplayPoint(aPoint0,aPoint1,focalDepth)
+        renderer.DisplayToWorld
+
+        (rPoint0,rPoint1,rPoint2,rPoint3) = renderer.GetWorldPoint
+        if (rPoint3 != 0.0)
+          rPoint0 = rPoint0/rPoint3
+          rPoint1 = rPoint1/rPoint3
+          rPoint2 = rPoint2/rPoint3
+        end
+
+        camera.SetFocalPoint((fPoint0 - rPoint0) + fPoint0, 
+                             (fPoint1 - rPoint1) + fPoint1,
+                             (fPoint2 - rPoint2) + fPoint2) 
+
+        camera.SetPosition((fPoint0 - rPoint0) + pPoint0, 
+                           (fPoint1 - rPoint1) + pPoint1,
+                           (fPoint2 - rPoint2) + pPoint2)
+      end
+
+      @LastX = x
+      @LastY = y
+
+      self.Render
+    end
+  end
+
+  def Zoom(x,y)
+    if @CurrentRenderer
+
+      renderer = @CurrentRenderer
+      camera = @CurrentCamera
+
+      zoomFactor = 1.02**(0.5*(@LastY - y))
+      @CurrentZoom = @CurrentZoom * zoomFactor
+
+      if camera.GetParallelProjection != 0
+        parallelScale = camera.GetParallelScale/zoomFactor
+        camera.SetParallelScale(parallelScale)
+      else
+        camera.Dolly(zoomFactor)
+        renderer.ResetCameraClippingRange
+      end
+
+      @LastX = x
+      @LastY = y
+
+      self.Render
+    end
+  end
+
+  def Reset(x,y)
+    if @CurrentRenderer
+      @CurrentRenderer.ResetCamera
+    end
+
+    self.Render
+  end
+
+  def Wireframe
+    actors = @CurrentRenderer.GetActors
+    numActors = actors.GetNumberOfItems
+    actors.InitTraversal
+    for i in 0...numActors
+      actor = actors.GetNextItem
+      actor.GetProperty.SetRepresentationToWireframe
+    end
+
+    self.Render
+  end
+
+  def Surface
+    actors = @CurrentRenderer.GetActors
+    numActors = actors.GetNumberOfItems
+    actors.InitTraversal
+    for i in 0...numActors
+      actor = actors.GetNextItem
+      actor.GetProperty.SetRepresentationToSurface
+    end
+
+    self.Render
+  end
+
+  def PickActor(x,y)
+    if @CurrentRenderer
+
+      renderer = @CurrentRenderer
+      picker = @Picker
+      windowY = self.winfo_height
+      picker.Pick(x,(windowY - y - 1),0.0,renderer)
+      assembly = picker.GetAssembly
+
+      if (@PickedAssembly != nil && @PrePickedProperty != nil)
+        @PickedAssembly.SetProperty(@PrePickedProperty)
+        # release hold of the property
+        @PrePickedProperty.UnRegister(@PrePickedProperty)
+        @PrePickedProperty = nil
+      end
+
+      if (assembly != nil)
+        @PickedAssembly = assembly
+        @PrePickedProperty = @PickedAssembly.GetProperty
+        # hold onto the property
+        @PrePickedProperty.Register(@PrePickedProperty)
+        @PickedAssembly.SetProperty(@PickedProperty)
+      end
+
+      self.Render
+    end
+  end
+
+end
+
+#----------------------------------------------------------------------------  
+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
+
+if $0 == __FILE__
+    vtkRenderWidgetConeExample
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/tk/vtkTkRenderWindowInteractor.rb VTK/Wrapping/Ruby/vtk/tk/vtkTkRenderWindowInteractor.rb
--- VTK_org/Wrapping/Ruby/vtk/tk/vtkTkRenderWindowInteractor.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/tk/vtkTkRenderWindowInteractor.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,394 @@
+=begin
+A fully functional VTK widget for Tkinter that uses
+vtkGenericRenderWindowInteractor.  The widget is called
+vtkTkRenderWindowInteractor.  The initialization part of this code is
+similar to that of the vtkTkRenderWidget.
+
+=end
+
+require 'tk'
+require 'vtk'
+require 'vtk/tk/vtkLoadRubyTkWidgets'
+
+
+class Vtk::TkRenderWindowInteractor < TkWindow
+=begin
+     A vtkTkRenderWidndowInteractor for Python.
+
+    Use GetRenderWindow to get the vtkRenderWindow.
+
+    Create with the keyword stereo=1 in order to generate a
+    stereo-capable window.
+
+    Create with the keyword focus_on_enter=1 to enable
+    focus-follows-mouse.  The default is for a click-to-focus mode.    
+
+    __getattr__ is used to make the widget also behave like a
+    vtkGenericRenderWindowInteractor.
+=end
+  TkCommandNames = ['vtkTkRenderWidget'.freeze].freeze
+
+  def initialize(master, kw={} )
+=begin
+        Constructor.
+
+        Keyword arguments:
+
+          rw -- Use passed render window instead of creating a new one.
+
+          stereo -- If True, generate a stereo-capable window.
+          Defaults to False.
+
+          focus_on_enter -- If True, use a focus-follows-mouse mode.
+          Defaults to False where the widget will use a click-to-focus
+          mode.
+=end
+    # load the necessary extensions into tk
+    Vtk.LoadRubyTkWidgets
+
+    _symbolkey2str(kw)
+
+    if kw['rw']
+      renderWindow = kw['rw']
+    else
+      renderWindow = Vtk::RenderWindow.new
+    end
+
+    if kw['stereo']
+      renderWindow.StereoCapableWindowOn
+      kw.delete('stereo')
+    end
+
+    # check if focus should follow mouse
+    if kw['focus_on_enter']
+      @FocusOnEnter = true
+      kw.delte('focus_on_enter')
+    else
+      @FocusOnEnter = false
+    end
+
+    kw['rw'] = renderWindow.GetAddressAsString("vtkRenderWindow")
+    kw['widgetname'] = 'vtkTkRenderWindowInteractor'
+#    kw['widgetname'] = 'vtkTkRenderWidget'
+    super( master, kw )
+    renderWindow.UnRegister(nil)
+
+    @Iren = Vtk::GenericRenderWindowInteractor.new
+    @Iren.SetRenderWindow(renderWindow)
+    @Iren.UnRegister(nil)
+
+    createTimer = Proc.new{|obj, evt|
+      self.after(10, Proc.new{ @Iren.TimerEvent })
+    }
+    destroyTimer = Proc.new{|obj, event|
+=begin
+       The timer is a one shot timer so will expire automatically.
+=end
+      return 1
+    }
+
+    @Iren.AddObserver('CreateTimerEvent', createTimer)
+    @Iren.AddObserver('DestroyTimerEvent', destroyTimer)
+
+
+
+    @OldFocus = nil
+
+    # private attributes
+    @InExpose = false
+
+    # create the Tk bindings
+    self.BindEvents
+    #self.tk_focusFollowsMouse
+
+  end
+
+  def BindEvents
+=begin
+        Bind all the events.
+=end
+    self.bind("Motion"){|e,s| s||s=self; s.MouseMoveEvent(e, 0, 0) }
+    self.bind("Control-Motion"){|e,s| s||s=self; s.MouseMoveEvent(e, 1, 0) }
+    self.bind("Shift-Motion"){|e,s| s||s=self; s.MouseMoveEvent(e, 1, 1) }
+    self.bind("Control-Shift-Motion"){|e,s| s||s=self; s.MouseMoveEvent(e, 0, 1) }
+
+    # Left Button
+    self.bind("ButtonPress-1"){|e,s| s||s=self; s.LeftButtonPressEvent(e, 0, 0) }
+    self.bind("Control-ButtonPress-1"){|e,s| s||s=self; s.LeftButtonPressEvent(e, 1, 0) }
+    self.bind("Shift-ButtonPress-1"){|e,s| s||s=self; s.LeftButtonPressEvent(e, 0, 1) }
+    self.bind("Control-Shift-ButtonPress-1"){|e,s| s||s=self; s.LeftButtonPressEvent(e, 1, 1) }
+    self.bind("ButtonRelease-1"){|e,s| s||s=self; s.LeftButtonReleaseEvent(e, 0, 0) }
+    self.bind("Control-ButtonRelease-1"){|e,s| s||s=self; s.LeftButtonReleaseEvent(e, 1, 0) }
+    self.bind("Shift-ButtonRelease-1"){|e,s| s||s=self; s.LeftButtonReleaseEvent(e, 0, 1) }
+    self.bind("Control-Shift-ButtonRelease-1"){|e,s| s||s=self; s.LeftButtonReleaseEvent(e, 1, 1) }
+
+    # Middle Button
+    self.bind("ButtonPress-2"){|e,s| s||s=self; s.MiddleButtonPressEvent(e, 0, 0) }
+    self.bind("Control-ButtonPress-2"){|e,s| s||s=self; s.MiddleButtonPressEvent(e, 1, 0) }
+    self.bind("Shift-ButtonPress-2"){|e,s| s||s=self; s.MiddleButtonPressEvent(e, 0, 1) }
+    self.bind("Control-Shift-ButtonPress-2"){|e,s| s||s=self; s.MiddleButtonPressEvent(e, 1, 1) }
+    self.bind("ButtonRelease-2"){|e,s| s||s=self; s.MiddleButtonReleaseEvent(e, 0, 0) }
+    self.bind("Control-ButtonRelease-2"){|e,s| s||s=self; s.MiddleButtonReleaseEvent(e, 1, 0) }
+    self.bind("Shift-ButtonRelease-2"){|e,s| s||s=self; s.MiddleButtonReleaseEvent(e, 0, 1) }
+    self.bind("Control-Shift-ButtonRelease-2"){|e,s| s||s=self; s.MiddleButtonReleaseEvent(e, 1, 1) }
+
+    # Right Button
+    self.bind("ButtonPress-3"){|e,s| s||s=self; s.RightButtonPressEvent(e, 0, 0) }
+    self.bind("Control-ButtonPress-3"){|e,s| s||s=self; s.RightButtonPressEvent(e, 1, 0) }
+    self.bind("Shift-ButtonPress-3"){|e,s| s||s=self; s.RightButtonPressEvent(e, 0, 1) }
+    self.bind("Control-Shift-ButtonPress-3"){|e,s| s||s=self; s.RightButtonPressEvent(e, 1, 1) }
+    self.bind("ButtonRelease-3"){|e,s| s||s=self; s.RightButtonReleaseEvent(e, 0, 0) }
+    self.bind("Control-ButtonRelease-3"){|e,s| s||s=self; s.RightButtonReleaseEvent(e, 1, 0) }
+    self.bind("Shift-ButtonRelease-3"){|e,s| s||s=self; s.RightButtonReleaseEvent(e, 0, 1) }
+    self.bind("Control-Shift-ButtonRelease-3"){|e,s| s||s=self; s.RightButtonReleaseEvent(e, 1, 1) }
+
+    if Config::CONFIG['arch'] =~ /win32/
+      self.bind("MouseWheel"){|e,s| s||s=self; s.MouseWheelEvent(e, 0, 0) }
+      self.bind("Control-MouseWheel"){|e,s| s||s=self; s.MouseWheelEvent(e, 1, 0) }
+      self.bind("Shift-MouseWheel"){|e,s| s||s=self; s.MouseWheelEvent(e, 0, 1) }
+      self.bind("Control-Shift-MouseWheel"){|e,s| s||s=self; s.MouseWheelEvent(e, 1, 1) }
+    else
+      # Mouse wheel forward event 
+      self.bind("ButtonPress-4"){|e,s| s||s=self; s.MouseWheelForwardEvent(e, 0, 0) }
+      self.bind("Control-ButtonPress-4"){|e,s| s||s=self; s.MouseWheelForwardEvent(e, 1, 0) }
+      self.bind("Shift-ButtonPress-4"){|e,s| s||s=self; s.MouseWheelForwardEvent(e, 0, 1) }
+      self.bind("Control-Shift-ButtonPress-4"){|e,s| s||s=self; s.MouseWheelForwardEvent(e, 1, 1) }
+
+      # Mouse wheel backward event 
+      self.bind("ButtonPress-5"){|e,s| s||s=self; s.MouseWheelBackwardEvent(e, 0, 0) }
+      self.bind("Control-ButtonPress-5"){|e,s| s||s=self; s.MouseWheelBackwardEvent(e, 1, 0) }
+      self.bind("Shift-ButtonPress-5"){|e,s| s||s=self; s.MouseWheelBackwardEvent(e, 0, 1) }
+      self.bind("Control-Shift-ButtonPress-5"){|e,s| s||s=self; s.MouseWheelBackwardEvent(e, 1, 1) }
+    end
+
+    # Key related events
+    self.bind("KeyPress"){|e,s| s||s=self; s.KeyPressEvent(e, 0, 0) }
+    self.bind("Control-KeyPress"){|e,s| s||s=self; s.KeyPressEvent(e, 1, 0) }
+    self.bind("Shift-KeyPress"){|e,s| s||s=self; s.KeyPressEvent(e, 0, 1) }
+    self.bind("Control-Shift-KeyPress"){|e,s| s||s=self; s.KeyPressEvent(e, 1, 1) }
+
+    self.bind("KeyRelease"){|e,s| s||s=self; s.KeyReleaseEvent(e, 0, 0) }
+    self.bind("Control-KeyRelease"){|e,s| s||s=self; s.KeyReleaseEvent(e, 1, 0) }
+    self.bind("Shift-KeyRelease"){|e,s| s||s=self; s.KeyReleaseEvent(e, 0, 1) }
+    self.bind("Control-Shift-KeyRelease"){|e,s| s||s=self; s.KeyReleaseEvent(e, 1, 1) }
+
+    self.bind("Enter"){|e,s| s||s=self; s.EnterEvent(e, 0, 0) }
+    self.bind("Control-Enter"){|e,s| s||s=self; s.EnterEvent(e, 1, 0) }
+    self.bind("Shift-Enter"){|e,s| s||s=self; s.EnterEvent(e, 0, 1) }
+    self.bind("Control-Shift-Enter"){|e,s| s||s=self; s.EnterEvent(e, 1, 1) }
+    self.bind("Leave"){|e,s| s||s=self; s.LeaveEvent(e, 0, 0) }
+    self.bind("Control-Leave"){|e,s| s||s=self; s.LeaveEvent(e, 1, 0) }
+    self.bind("Shift-Leave"){|e,s| s||s=self; s.LeaveEvent(e, 0, 1) }
+    self.bind("Control-Shift-Leave"){|e,s| s||s=self; s.LeaveEvent(e, 1, 1) }
+
+    self.bind("Configure"){|e,s| s||s=self; s.ConfigureEvent(e) }
+    self.bind("Expose"){|e,s| s||s=self; s.ExposeEvent }
+  end
+
+  def _GrabFocus(enter=0)
+    @OldFocus=self.focus
+    self.focus
+  end
+
+  def MouseMoveEvent(event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    @Iren.MouseMoveEvent
+  end
+
+  def LeftButtonPressEvent(event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    @Iren.LeftButtonPressEvent
+    if  !@FocusOnEnter
+      _GrabFocus
+    end
+  end
+
+  def LeftButtonReleaseEvent(event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    @Iren.LeftButtonReleaseEvent
+  end
+
+  def MiddleButtonPressEvent(event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    @Iren.MiddleButtonPressEvent
+    if  !@FocusOnEnter
+      _GrabFocus
+    end
+  end
+
+  def MiddleButtonReleaseEvent( event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    @Iren.MiddleButtonReleaseEvent
+  end
+
+  def RightButtonPressEvent(event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    @Iren.RightButtonPressEvent
+    if  !@FocusOnEnter
+      _GrabFocus
+    end
+  end
+
+  def RightButtonReleaseEvent(event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    @Iren.RightButtonReleaseEvent
+  end
+
+  def MouseWheelEvent(event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    if event.delta > 0
+      @Iren.MouseWheelForwardEvent
+    else
+      @Iren.MouseWheelBackwardEvent
+    end
+  end
+
+  def MouseWheelForwardEvent(event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    @Iren.MouseWheelForwardEvent
+  end
+
+  def MouseWheelBackwardEvent(event, ctrl, shift)
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, 0.chr, 0, nil)
+    @Iren.MouseWheelBackwardEvent
+  end
+
+  def KeyPressEvent(event, ctrl, shift)
+    key = 0.chr
+    if event.keysym_num < 256
+      key = event.keysym_num.chr
+    end
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, key, 0, event.keysym)
+    @Iren.KeyPressEvent
+    @Iren.CharEvent
+  end
+
+  def KeyReleaseEvent(event, ctrl, shift)
+    key = 0.chr
+    if event.keysym_num < 256
+      key = event.keysym_num.chr
+    end
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
+                                   shift, key, 0, event.keysym)
+    @Iren.KeyReleaseEvent
+  end
+
+  def ConfigureEvent(event)
+    @Iren.SetSize(event.width, event.height)
+    @Iren.ConfigureEvent
+  end
+
+  def EnterEvent(event, ctrl, shift)
+    if @FocusOnEnter
+      _GrabFocus
+    end
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl, shift,
+                                   0.chr, 0, nil)
+    @Iren.EnterEvent
+  end
+
+  def LeaveEvent(event, ctrl, shift)
+    if @FocusOnEnter && (@OldFocus != nil)
+      @OldFocus.focus
+    end
+    @Iren.SetEventInformationFlipY(event.x, event.y, ctrl, shift,
+                                   0.chr, 0, nil)
+    @Iren.LeaveEvent
+  end
+
+  def ExposeEvent
+    if !@InExpose
+      @InExpose = true
+      self.update
+      self.GetRenderWindow.Render
+      @InExpose = false
+    end
+  end
+
+  def GetRenderWindow
+    addr = Tk.tk_call(self, 'GetRenderWindow')[5..-1]
+    renderWindow = Vtk::RenderWindow.new('_%s_vtkRenderWindow_p' % addr)
+    renderWindow.UnRegister(nil)
+    return renderWindow
+  end
+
+  def Render
+    self.GetRenderWindow.Render
+  end
+
+  # wrapping methods of Vtk::RenderWindowInteractor
+  names = self.instance_methods
+  Vtk::RenderWindowInteractor.instance_methods.each{|name|
+    unless names.include?(name)
+      argc = Vtk::RenderWindowInteractor.instance_method(name).arity
+      argv = []
+      if argc >= 0
+        for i in 0...argc
+          argv.push "arg#{i}"
+        end
+      else
+        for i in 0...-argc-1
+          argv.push "arg#{i}"
+        end
+        argv.push "*optional"
+      end
+      eval <<-"EOF"
+      def #{name}( #{argv.join(",")} )
+        @Iren.#{name}( #{argv.join(",")} )
+      end
+      EOF
+    end
+  }
+end
+
+
+#----------------------------------------------------------------------------  
+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
+
+if $0 == __FILE__
+  vtkRenderWindowInteractorConeExample
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/tk.rb VTK/Wrapping/Ruby/vtk/tk.rb
--- VTK_org/Wrapping/Ruby/vtk/tk.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/tk.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,4 @@
+require 'vtk/tk/vtkTkRenderWidget'
+require 'vtk/tk/vtkTkImageViewerWidget'
+require 'vtk/tk/vtkTkRenderWindowInteractor'
+require 'vtk/tk/vtkTkPhotoImage'
diff -uNr VTK_org/Wrapping/Ruby/vtk/util/colors.rb VTK/Wrapping/Ruby/vtk/util/colors.rb
--- VTK_org/Wrapping/Ruby/vtk/util/colors.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/util/colors.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,223 @@
+# This module defines many standard colors that should be useful.
+# These colors should be exactly the same as the ones defined in
+# colors.tcl.
+
+module Vtk
+
+  module Colors
+    #  Whites
+    Antique_white = [0.9804, 0.9216, 0.8431]
+    Azure = [0.9412, 1.0000, 1.0000]
+    Bisque = [1.0000, 0.8941, 0.7686]
+    Blanched_almond = [1.0000, 0.9216, 0.8039]
+    Cornsilk = [1.0000, 0.9725, 0.8627]
+    Eggshell = [0.9900, 0.9000, 0.7900]
+    Floral_white = [1.0000, 0.9804, 0.9412]
+    Gainsboro = [0.8627, 0.8627, 0.8627]
+    Ghost_white = [0.9725, 0.9725, 1.0000]
+    Honeydew = [0.9412, 1.0000, 0.9412]
+    Ivory = [1.0000, 1.0000, 0.9412]
+    Lavender = [0.9020, 0.9020, 0.9804]
+    Lavender_blush = [1.0000, 0.9412, 0.9608]
+    Lemon_chiffon = [1.0000, 0.9804, 0.8039]
+    Linen = [0.9804, 0.9412, 0.9020]
+    Mint_cream = [0.9608, 1.0000, 0.9804]
+    Misty_rose = [1.0000, 0.8941, 0.8824]
+    Moccasin = [1.0000, 0.8941, 0.7098]
+    Navajo_white = [1.0000, 0.8706, 0.6784]
+    Old_lace = [0.9922, 0.9608, 0.9020]
+    Papaya_whip = [1.0000, 0.9373, 0.8353]
+    Peach_puff = [1.0000, 0.8549, 0.7255]
+    Seashell = [1.0000, 0.9608, 0.9333]
+    Snow = [1.0000, 0.9804, 0.9804]
+    Thistle = [0.8471, 0.7490, 0.8471]
+    Titanium_white = [0.9900, 1.0000, 0.9400]
+    Wheat = [0.9608, 0.8706, 0.7020]
+    White = [1.0000, 1.0000, 1.0000]
+    White_smoke = [0.9608, 0.9608, 0.9608]
+    Zinc_white = [0.9900, 0.9700, 1.0000]
+
+    #  Greys
+    Cold_grey = [0.5000, 0.5400, 0.5300]
+    Dim_grey = [0.4118, 0.4118, 0.4118]
+    Grey = [0.7529, 0.7529, 0.7529]
+    Light_grey = [0.8275, 0.8275, 0.8275]
+    Slate_grey = [0.4392, 0.5020, 0.5647]
+    Slate_grey_dark = [0.1843, 0.3098, 0.3098]
+    Slate_grey_light = [0.4667, 0.5333, 0.6000]
+    Warm_grey = [0.5000, 0.5000, 0.4100]
+
+    #  Blacks
+    Black = [0.0000, 0.0000, 0.0000]
+    Ivory_black = [0.1600, 0.1400, 0.1300]
+    Lamp_black = [0.1800, 0.2800, 0.2300]
+
+    #  Reds
+    Alizarin_crimson = [0.8900, 0.1500, 0.2100]
+    Brick = [0.6100, 0.4000, 0.1200]
+    Cadmium_red_deep = [0.8900, 0.0900, 0.0500]
+    Coral = [1.0000, 0.4980, 0.3137]
+    Coral_light = [0.9412, 0.5020, 0.5020]
+    Deep_pink = [1.0000, 0.0784, 0.5765]
+    English_red = [0.8300, 0.2400, 0.1000]
+    Firebrick = [0.6980, 0.1333, 0.1333]
+    Geranium_lake = [0.8900, 0.0700, 0.1900]
+    Hot_pink = [1.0000, 0.4118, 0.7059]
+    Indian_red = [0.6900, 0.0900, 0.1200]
+    Light_salmon = [1.0000, 0.6275, 0.4784]
+    Madder_lake_deep = [0.8900, 0.1800, 0.1900]
+    Maroon = [0.6902, 0.1882, 0.3765]
+    Pink = [1.0000, 0.7529, 0.7961]
+    Pink_light = [1.0000, 0.7137, 0.7569]
+    Raspberry = [0.5300, 0.1500, 0.3400]
+    Red = [1.0000, 0.0000, 0.0000]
+    Rose_madder = [0.8900, 0.2100, 0.2200]
+    Salmon = [0.9804, 0.5020, 0.4471]
+    Tomato = [1.0000, 0.3882, 0.2784]
+    Venetian_red = [0.8300, 0.1000, 0.1200]
+
+    #  Browns
+    Beige = [0.6400, 0.5800, 0.5000]
+    Brown = [0.5000, 0.1647, 0.1647]
+    Brown_madder = [0.8600, 0.1600, 0.1600]
+    Brown_ochre = [0.5300, 0.2600, 0.1200]
+    Burlywood = [0.8706, 0.7216, 0.5294]
+    Burnt_sienna = [0.5400, 0.2100, 0.0600]
+    Burnt_umber = [0.5400, 0.2000, 0.1400]
+    Chocolate = [0.8235, 0.4118, 0.1176]
+    Deep_ochre = [0.4500, 0.2400, 0.1000]
+    Flesh = [1.0000, 0.4900, 0.2500]
+    Flesh_ochre = [1.0000, 0.3400, 0.1300]
+    Gold_ochre = [0.7800, 0.4700, 0.1500]
+    Greenish_umber = [1.0000, 0.2400, 0.0500]
+    Khaki = [0.9412, 0.9020, 0.5490]
+    Khaki_dark = [0.7412, 0.7176, 0.4196]
+    Light_beige = [0.9608, 0.9608, 0.8627]
+    Peru = [0.8039, 0.5216, 0.2471]
+    Rosy_brown = [0.7373, 0.5608, 0.5608]
+    Raw_sienna = [0.7800, 0.3800, 0.0800]
+    Raw_umber = [0.4500, 0.2900, 0.0700]
+    Sepia = [0.3700, 0.1500, 0.0700]
+    Sienna = [0.6275, 0.3216, 0.1765]
+    Saddle_brown = [0.5451, 0.2706, 0.0745]
+    Sandy_brown = [0.9569, 0.6431, 0.3765]
+    Tan = [0.8235, 0.7059, 0.5490]
+    Van_dyke_brown = [0.3700, 0.1500, 0.0200]
+
+    #  Oranges
+    Cadmium_orange = [1.0000, 0.3800, 0.0100]
+    Cadmium_red_light = [1.0000, 0.0100, 0.0500]
+    Carrot = [0.9300, 0.5700, 0.1300]
+    Dark_orange = [1.0000, 0.5490, 0.0000]
+    Mars_orange = [0.5900, 0.2700, 0.0800]
+    Mars_yellow = [0.8900, 0.4400, 0.1000]
+    Orange = [1.0000, 0.5000, 0.0000]
+    Orange_red = [1.0000, 0.2706, 0.0000]
+    Yellow_ochre = [0.8900, 0.5100, 0.0900]
+
+    #  Yellows
+    Aureoline_yellow = [1.0000, 0.6600, 0.1400]
+    Banana = [0.8900, 0.8100, 0.3400]
+    Cadmium_lemon = [1.0000, 0.8900, 0.0100]
+    Cadmium_yellow = [1.0000, 0.6000, 0.0700]
+    Cadmium_yellow_light = [1.0000, 0.6900, 0.0600]
+    Gold = [1.0000, 0.8431, 0.0000]
+    Goldenrod = [0.8549, 0.6471, 0.1255]
+    Goldenrod_dark = [0.7216, 0.5255, 0.0431]
+    Goldenrod_light = [0.9804, 0.9804, 0.8235]
+    Goldenrod_pale = [0.9333, 0.9098, 0.6667]
+    Light_goldenrod = [0.9333, 0.8667, 0.5098]
+    Melon = [0.8900, 0.6600, 0.4100]
+    Naples_yellow_deep = [1.0000, 0.6600, 0.0700]
+    Yellow = [1.0000, 1.0000, 0.0000]
+    Yellow_light = [1.0000, 1.0000, 0.8784]
+
+    #  Greens
+    Chartreuse = [0.4980, 1.0000, 0.0000]
+    Chrome_oxide_green = [0.4000, 0.5000, 0.0800]
+    Cinnabar_green = [0.3800, 0.7000, 0.1600]
+    Cobalt_green = [0.2400, 0.5700, 0.2500]
+    Emerald_green = [0.0000, 0.7900, 0.3400]
+    Dorest_green = [0.1333, 0.5451, 0.1333]
+    Green = [0.0000, 1.0000, 0.0000]
+    Green_dark = [0.0000, 0.3922, 0.0000]
+    Green_pale = [0.5961, 0.9843, 0.5961]
+    Green_yellow = [0.6784, 1.0000, 0.1843]
+    Lawn_green = [0.4863, 0.9882, 0.0000]
+    Lime_green = [0.1961, 0.8039, 0.1961]
+    Mint = [0.7400, 0.9900, 0.7900]
+    Olive = [0.2300, 0.3700, 0.1700]
+    Olive_drab = [0.4196, 0.5569, 0.1373]
+    Olive_green_dark = [0.3333, 0.4196, 0.1843]
+    Permanent_green = [0.0400, 0.7900, 0.1700]
+    Sap_green = [0.1900, 0.5000, 0.0800]
+    Sea_green = [0.1804, 0.5451, 0.3412]
+    Sea_green_dark = [0.5608, 0.7373, 0.5608]
+    Sea_green_medium = [0.2353, 0.7020, 0.4431]
+    Sea_green_light = [0.1255, 0.6980, 0.6667]
+    Spring_green = [0.0000, 1.0000, 0.4980]
+    Spring_green_medium = [0.0000, 0.9804, 0.6039]
+    Terre_verte = [0.2200, 0.3700, 0.0600]
+    Viridian_light = [0.4300, 1.0000, 0.4400]
+    Yellow_green = [0.6039, 0.8039, 0.1961]
+
+    #  Cyans
+    Aquamarine = [0.4980, 1.0000, 0.8314]
+    Aquamarine_medium = [0.4000, 0.8039, 0.6667]
+    Cyan = [0.0000, 1.0000, 1.0000]
+    Cyan_white = [0.8784, 1.0000, 1.0000]
+    Turquoise = [0.2510, 0.8784, 0.8157]
+    Turquoise_dark = [0.0000, 0.8078, 0.8196]
+    Turquoise_medium = [0.2824, 0.8196, 0.8000]
+    Turquoise_pale = [0.6863, 0.9333, 0.9333]
+
+    #  Blues
+    Alice_blue = [0.9412, 0.9725, 1.0000]
+    Blue = [0.0000, 0.0000, 1.0000]
+    Blue_light = [0.6784, 0.8471, 0.9020]
+    Blue_medium = [0.0000, 0.0000, 0.8039]
+    Cadet = [0.3725, 0.6196, 0.6275]
+    Cobalt = [0.2400, 0.3500, 0.6700]
+    Cornflower = [0.3922, 0.5843, 0.9294]
+    Cerulean = [0.0200, 0.7200, 0.8000]
+    Dodger_blue = [0.1176, 0.5647, 1.0000]
+    Indigo = [0.0300, 0.1800, 0.3300]
+    Manganese_blue = [0.0100, 0.6600, 0.6200]
+    Midnight_blue = [0.0980, 0.0980, 0.4392]
+    Navy = [0.0000, 0.0000, 0.5020]
+    Peacock = [0.2000, 0.6300, 0.7900]
+    Powder_blue = [0.6902, 0.8784, 0.9020]
+    Royal_blue = [0.2549, 0.4118, 0.8824]
+    Slate_blue = [0.4157, 0.3529, 0.8039]
+    Slate_blue_dark = [0.2824, 0.2392, 0.5451]
+    Slate_blue_light = [0.5176, 0.4392, 1.0000]
+    Slate_blue_medium = [0.4824, 0.4078, 0.9333]
+    Sky_blue = [0.5294, 0.8078, 0.9216]
+    Sky_blue_deep = [0.0000, 0.7490, 1.0000]
+    Sky_blue_light = [0.5294, 0.8078, 0.9804]
+    Steel_blue = [0.2745, 0.5098, 0.7059]
+    Steel_blue_light = [0.6902, 0.7686, 0.8706]
+    Turquoise_blue = [0.0000, 0.7800, 0.5500]
+    Ultramarine = [0.0700, 0.0400, 0.5600]
+
+    #  Magentas
+    Blue_violet = [0.5412, 0.1686, 0.8863]
+    Cobalt_violet_deep = [0.5700, 0.1300, 0.6200]
+    Magenta = [1.0000, 0.0000, 1.0000]
+    Orchid = [0.8549, 0.4392, 0.8392]
+    Orchid_dark = [0.6000, 0.1961, 0.8000]
+    Orchid_medium = [0.7294, 0.3333, 0.8275]
+    Permanent_red_violet = [0.8600, 0.1500, 0.2700]
+    Plum = [0.8667, 0.6275, 0.8667]
+    Purple = [0.6275, 0.1255, 0.9412]
+    Purple_medium = [0.5765, 0.4392, 0.8588]
+    Ultramarine_violet = [0.3600, 0.1400, 0.4300]
+    Violet = [0.5600, 0.3700, 0.6000]
+    Violet_dark = [0.5804, 0.0000, 0.8275]
+    Violet_red = [0.8157, 0.1255, 0.5647]
+    Violet_red_medium = [0.7804, 0.0824, 0.5216]
+    Violet_red_pale = [0.8588, 0.4392, 0.5765]
+
+  end
+end
+
diff -uNr VTK_org/Wrapping/Ruby/vtk/util/.cvsignore VTK/Wrapping/Ruby/vtk/util/.cvsignore
--- VTK_org/Wrapping/Ruby/vtk/util/.cvsignore	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/util/.cvsignore	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1 @@
+*.pyc
diff -uNr VTK_org/Wrapping/Ruby/vtk/util/misc.rb VTK/Wrapping/Ruby/vtk/util/misc.rb
--- VTK_org/Wrapping/Ruby/vtk/util/misc.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/util/misc.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,68 @@
+#----------------------------------------------------------------------
+# the following functions are for the vtk regression testing and examples
+
+def vtkGetDataRoot
+    dataIndex=-1;
+    for i in 0..ARGV.length
+        if ARGV[i] == '-D' && i < ARGV.length-1:
+            dataIndex = i+1
+        end
+    end
+
+    if dataIndex != -1
+        dataRoot = ARGV[dataIndex]
+    else
+        unless dataRoot = ENV['VTK_DATA_ROOT']
+            dataRoot = '../../../../VTKData'
+        end
+    end
+
+    return dataRoot
+end
+
+
+def vtkRegressionTestImage( renWin )
+    imageIndex=-1;
+    for i in 0..ARGV.length
+        if ARGV[i] == '-V' && i < ARGV.length-1:
+            imageIndex = i+1
+        end
+    end
+
+    if imageIndex != -1
+        fname = File.join(vtkGetDataRoot(), ARGV[imageIndex])
+
+        rt_w2if = vtk.vtkWindowToImageFilter()
+        rt_w2if.SetInput(renWin)
+
+        if File.exist?(fname)
+            pass
+        else
+            rt_pngw = vtk.vtkPNGWriter()
+            rt_pngw.SetFileName(fname)
+            rt_pngw.SetInput(rt_w2if.GetOutput())
+            rt_pngw.Write()
+            rt_pngw = nil
+        end
+
+        rt_png = vtk.vtkPNGReader()
+        rt_png.SetFileName(fname)
+
+        rt_id = vtk.vtkImageDifference()
+        rt_id.SetInput(rt_w2if.GetOutput())
+        rt_id.SetImage(rt_png.GetOutput())
+        rt_id.Update()
+
+        if rt_id.GetThresholdedError() <= 10
+            return 1
+        else
+            $stderr.print("Failed image test: %f\n",
+                             rt_id.GetThresholdedError())
+            return 0
+        end
+    end
+
+    return 2
+end
+
+            
diff -uNr VTK_org/Wrapping/Ruby/vtk/util/vtkConstants.rb VTK/Wrapping/Ruby/vtk/util/vtkConstants.rb
--- VTK_org/Wrapping/Ruby/vtk/util/vtkConstants.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/util/vtkConstants.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,123 @@
+"""
+Miscellaneous constants copied from vtkSystemIncludes.h
+(It would be nice if this file were automatically generated,
+but the constants don't change very often)
+"""
+
+# Some constants used throughout code
+
+VTK_LARGE_FLOAT = 1.0e+38
+VTK_LARGE_INTEGER = 2147483647 # 2^31 - 1
+
+# These types are returned by GetDataType to indicate pixel type.
+VTK_VOID            = 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
+
+# These types are not currently supported by GetDataType, but are 
+# for completeness.
+VTK_STRING          =13
+VTK_OPAQUE          =14
+
+# Some constant required for correct template performance
+VTK_BIT_MIN = 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_UNSIGNED_INT_MIN = 0
+#VTK_UNSIGNED_INT_MAX = 4294967295
+VTK_LONG_MIN = (-VTK_LARGE_INTEGER-1)
+VTK_LONG_MAX = VTK_LARGE_INTEGER
+#VTK_UNSIGNED_LONG_MIN = 0
+#VTK_UNSIGNED_LONG_MAX = 4294967295
+VTK_FLOAT_MIN = -VTK_LARGE_FLOAT
+VTK_FLOAT_MAX = VTK_LARGE_FLOAT
+VTK_DOUBLE_MIN = -1.0e+99
+VTK_DOUBLE_MAX  = 1.0e+99
+
+# These types are returned to distinguish dataset types
+VTK_POLY_DATA          = 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
+
+# These types define error codes for vtk functions
+VTK_OK                 = 1
+VTK_ERROR              = 2
+
+# These types define different text properties
+VTK_ARIAL     = 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
+
+# Constants for InterpolationType
+VTK_NEAREST_INTERPOLATION      = 0
+VTK_LINEAR_INTERPOLATION       = 1
+
+# For volume rendering
+VTK_MAX_VRCOMP    = 4
+
+
+# A macro to get the name of a type
+
+__vtkTypeNameDict = {VTK_VOID=>"void",
+                     VTK_DOUBLE=>"double",
+                     VTK_FLOAT=>"float",
+                     VTK_LONG=>"long",
+                     VTK_UNSIGNED_LONG=>"unsigned long",
+                     VTK_INT=>"int",
+                     VTK_UNSIGNED_INT=>"unsigned int",
+                     VTK_SHORT=>"short",
+                     VTK_UNSIGNED_SHORT=>"unsigned short",
+                     VTK_CHAR=>"char",
+                     VTK_UNSIGNED_CHAR=>"unsigned char",
+                     VTK_BIT=>"bit"}
+                   
+def vtkImageScalarTypeNameMacro(type)
+  return __vtkTypeNameDict[type]
+end
+
+
diff -uNr VTK_org/Wrapping/Ruby/vtk/util/vtkImageExportToArray.rb VTK/Wrapping/Ruby/vtk/util/vtkImageExportToArray.rb
--- VTK_org/Wrapping/Ruby/vtk/util/vtkImageExportToArray.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/util/vtkImageExportToArray.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,96 @@
+begin
+  require "narray"
+
+  module Vtk
+    class ImageExportToArray
+      def initialize
+        @export = ImageExport.new
+        @ConvertUnsignedShortToInt = false
+      end
+
+      @@typeDict = { VTK_CHAR=>NArray::BYTE,
+                     VTK_UNSIGNED_CHAR=>NArray::BYTE,
+                     VTK_SHORT=>NArray::SINT,
+                     VTK_UNSIGNED_SHORT=>NArray::SINT,
+                     VTK_INT=>NArray::INT,
+                     VTK_FLOAT=>NArray::SFLOAT,
+                     VTK_DOUBLE=>NArray::FLOAT }
+
+      @@sizeDict = { VTK_CHAR=>1,
+                     VTK_UNSIGNED_CHAR=>1,
+                     VTK_SHORT=>2,
+                     VTK_UNSIGNED_SHORT=>2,
+                     VTK_INT=>4,
+                     VTK_FLOAT=>4,
+                     VTK_DOUBLE=>8 }
+
+      # convert unsigned shorts to ints, to avoid sign problems
+      def SetConvertUnsignedShortToInt(yesno)
+        @ConvertUnsignedShortToInt = yesno
+      end
+
+      def GetConvertUnsignedShortToInt
+        return @ConvertUnsignedShortToInt
+      end
+    
+      def ConvertUnsignedShortToIntOn
+        @ConvertUnsignedShortToInt = true
+      end
+
+      def ConvertUnsignedShortToIntOff
+        @ConvertUnsignedShortToInt = false
+      end
+
+      # set the input
+      def SetInput(input)
+        return @export.SetInput(input)
+      end
+
+      def GetInput
+        return @export.GetInput
+      end
+
+      def GetArray
+        input = @export.GetInput
+        input.UpdateInformation
+        type = input.GetScalarType
+        extent = input.GetWholeExtent
+        numComponents = input.GetNumberOfScalarComponents
+        dim = [extent[5]-extent[4]+1,
+               extent[3]-extent[2]+1,
+               extent[1]-extent[0]+1]
+        if (numComponents > 1)
+          dim = dim + [numComponents]
+        end
+        size = dim[0]*dim[1]*dim[2]*numComponents*@@sizeDict[type]
+
+        imString = NArray.byte(size).to_s
+        @export.Export(imString)
+        imArray = NArray.to_na(imString,@@typeDict[type])
+
+        # reshape array appropriately.
+        imArray.reshape!(*dim)
+        # convert unsigned short to int to avoid sign issues
+        if (type == VTK_UNSIGNED_SHORT && @ConvertUnsignedShortToInt)
+          imArray = umath.bitwise_and(imArray.astype(Numeric.Int32),0xffff)
+          return imArray
+        end
+      end
+        
+      def GetDataExtent
+        return @export.GetDataExtent
+      end
+
+      def GetDataSpacing
+        return @export.GetDataSpacing
+      end
+
+      def GetDataOrigin
+        return @export.GetDataOrigin
+      end
+
+    end
+  end
+
+rescue LoadError
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/util/vtkImageImportFromArray.rb VTK/Wrapping/Ruby/vtk/util/vtkImageImportFromArray.rb
--- VTK_org/Wrapping/Ruby/vtk/util/vtkImageImportFromArray.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/util/vtkImageImportFromArray.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,116 @@
+begin
+  require 'narray'
+
+  module Vtk
+    class ImageImportFromArray
+      def initialize
+        @import = ImageImport.new
+        @ConvertIntToUnsignedShort = false
+        @Array = nil
+      end
+
+      @@typeDict = {NArray::BYTE=>VTK_UNSIGNED_CHAR,
+                    NArray::SINT=>VTK_SHORT,
+                    NArray::INT=>VTK_INT,
+                    NArray::SFLOAT=>VTK_FLOAT,
+                    NArray::FLOAT=>VTK_DOUBLE }
+
+      @@sizeDict = { VTK_CHAR=>1,
+                     VTK_UNSIGNED_CHAR=>1,
+                     VTK_SHORT=>2,
+                     VTK_UNSIGNED_SHORT=>2,
+                     VTK_INT=>4,
+                     VTK_FLOAT=>4,
+                     VTK_DOUBLE=>8 }
+
+      # convert 'Int32' to 'unsigned short'
+      def SetConvertIntToUnsignedShort(yesno)
+        @ConvertIntToUnsignedShort = yesno
+      end
+
+      def GetConvertIntToUnsignedShort
+        return @ConvertIntToUnsignedShort
+      end
+
+      def ConvertIntToUnsignedShortOn
+        @ConvertIntToUnsignedShort = true
+      end
+
+      def ConvertIntToUnsignedShortOff
+        @ConvertIntToUnsignedShort = false
+      end
+
+      # get the output
+      def GetOutput
+        return @import.GetOutput
+      end
+
+      # import an array
+      def SetArray(imArray)
+        @Array = imArray
+        numComponents = 1
+        dim = imArray.shape
+
+        if (dim.length == 4)
+          numComponents = dim[3]
+          dim = [dim[0],dim[1],dim[2]]
+        end
+            
+        type = @@typeDict[imArray.typecode]
+
+        if (@ConvertIntToUnsignedShort && imArray.typecode == NArray::INT)
+            imTmpArr = imArray.astype(Numeric.Int16).to_s
+            type = VTK_UNSIGNED_SHORT
+        else
+            imTmpArr = imArray.to_s
+        end
+
+        size = imTmpArr.len*@@sizeDict[type]
+        @import.CopyImportVoidPointer(imTmpArr, size)
+        @import.SetDataScalarType(type)
+        @import.SetNumberOfScalarComponents(numComponents)
+        extent = @import.GetDataExtent
+        @import.SetDataExtent(extent[0],extent[0]+dim[2]-1,
+                              extent[2],extent[2]+dim[1]-1,
+                              extent[4],extent[4]+dim[0]-1)
+        @import.SetWholeExtent(extent[0],extent[0]+dim[2]-1,
+                               extent[2],extent[2]+dim[1]-1,
+                               extent[4],extent[4]+dim[0]-1)
+      end
+
+      def GetArray
+        return @Array
+      end
+        
+      # a whole bunch of methods copied from vtkImageImport
+
+      def SetDataExtent(extent)
+        @import.SetDataExtent(extent)
+      end
+
+      def GetDataExtent
+        return @import.GetDataExtent
+      end
+    
+      def SetDataSpacing(spacing)
+        @import.SetDataSpacing(spacing)
+      end
+
+      def GetDataSpacing
+        return @import.GetDataSpacing
+      end
+    
+      def SetDataOrigin(origin)
+        @import.SetDataOrigin(origin)
+      end
+
+      def GetDataOrigin
+        return @import.GetDataOrigin
+      end
+    end
+  end
+
+rescue LoadError
+end
+
+    
diff -uNr VTK_org/Wrapping/Ruby/vtk/util.rb VTK/Wrapping/Ruby/vtk/util.rb
--- VTK_org/Wrapping/Ruby/vtk/util.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/util.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,6 @@
+require 'vtk'
+require 'vtk/util/colors'
+require 'vtk/util/misc'
+require 'vtk/util/vtkConstants'
+require 'vtk/util/vtkImageExportToArray'
+require 'vtk/util/vtkImageImportFromArray'
diff -uNr VTK_org/Wrapping/Ruby/vtk/volumerendering.rb VTK/Wrapping/Ruby/vtk/volumerendering.rb
--- VTK_org/Wrapping/Ruby/vtk/volumerendering.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/volumerendering.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkVolumeRenderingRuby'
+else
+  require 'vtk/libvtkVolumeRenderingRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk/widgets.rb VTK/Wrapping/Ruby/vtk/widgets.rb
--- VTK_org/Wrapping/Ruby/vtk/widgets.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk/widgets.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+require 'rbconfig'
+
+if Config::CONFIG['host_os'] =~ /win32/
+  require 'vtk/vtkWidgetsRuby'
+else
+  require 'vtk/libvtkWidgetsRuby'
+end
diff -uNr VTK_org/Wrapping/Ruby/vtk_dummy.rb VTK/Wrapping/Ruby/vtk_dummy.rb
--- VTK_org/Wrapping/Ruby/vtk_dummy.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk_dummy.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,3 @@
+File.open('vtk_dummy_complete','w'){|file|
+  file.print "Done\n"
+}
diff -uNr VTK_org/Wrapping/Ruby/vtk.rb VTK/Wrapping/Ruby/vtk.rb
--- VTK_org/Wrapping/Ruby/vtk.rb	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtk.rb	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,29 @@
+require 'vtk/common'
+require 'vtk/filtering'
+require 'vtk/io'
+require 'vtk/imaging'
+require 'vtk/graphics'
+begin
+  require 'vtk/genericfiltering'
+rescue LoadError
+end
+begin
+  require 'vtk/rendering'
+rescue LoadError
+end
+begin
+  require 'vtk/volumerendering'
+rescue LoadError
+end
+begin
+  require 'vtk/hybrid'
+rescue LoadError
+end
+begin
+  require 'vtk/widgets'
+rescue LoadError
+end
+begin
+  require 'vtk/parallel'
+rescue LoadError
+end
diff -uNr VTK_org/Wrapping/Ruby/vtkRubyAppInitConfigure.h.in VTK/Wrapping/Ruby/vtkRubyAppInitConfigure.h.in
--- VTK_org/Wrapping/Ruby/vtkRubyAppInitConfigure.h.in	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtkRubyAppInitConfigure.h.in	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,7 @@
+#ifndef __vtkRubyAppInitConfigure_h
+#define __vtkRubyAppInitConfigure_h
+
+#define VTK_RUBY_LIBRARY_DIR_BUILD "@LIBRARY_OUTPUT_PATH@"
+#define VTK_RUBY_SCRIPT_DIR_BUILD "@VTK_BINARY_DIR@/Wrapping/Ruby"
+
+#endif
diff -uNr VTK_org/Wrapping/Ruby/vtkRubyAppInit.cxx VTK/Wrapping/Ruby/vtkRubyAppInit.cxx
--- VTK_org/Wrapping/Ruby/vtkRubyAppInit.cxx	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/Ruby/vtkRubyAppInit.cxx	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,200 @@
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile: vtkRubyAppInit.cxx,v $
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+
+
+/* Minimal main program -- everything is loaded from the library */
+
+#include "vtkRuby.h"
+
+#ifdef VTK_COMPILED_USING_MPI
+# include <mpi.h>
+# include "vtkMPIController.h"
+#endif // VTK_COMPILED_USING_MPI
+
+#include "vtkVersion.h"
+#include "Wrapping/Ruby/vtkRubyAppInitConfigure.h"
+
+#if defined(CMAKE_INTDIR)
+# define VTK_RUBY_LIBRARY_DIR VTK_RUBY_LIBRARY_DIR_BUILD "/" CMAKE_INTDIR
+#else
+# define VTK_RUBY_LIBRARY_DIR VTK_RUBY_LIBRARY_DIR_BUILD
+#endif
+
+#include <sys/stat.h>
+
+/*
+ * Make sure all the kits register their classes with vtkInstantiator.
+ */
+#include "vtkCommonInstantiator.h"
+#include "vtkFilteringInstantiator.h"
+#include "vtkIOInstantiator.h"
+#include "vtkImagingInstantiator.h"
+#include "vtkGraphicsInstantiator.h"
+
+#ifdef VTK_USE_RENDERING
+#include "vtkRenderingInstantiator.h"
+#include "vtkVolumeRenderingInstantiator.h"
+#include "vtkHybridInstantiator.h"
+#endif
+
+#ifdef VTK_USE_PARALLEL
+#include "vtkParallelInstantiator.h"
+#endif
+
+#include <vtkstd/string>
+#include <vtksys/SystemTools.hxx>
+
+#ifdef VTK_COMPILED_USING_MPI
+class vtkMPICleanup {
+public:
+  vtkMPICleanup()
+    {
+      this->Controller = 0;
+    }
+  void Initialize(int* argc, char ***argv)
+    {
+      MPI_Init(argc, argv);
+      this->Controller = vtkMPIController::New();
+      this->Controller->Initialize(argc, argv, 1);
+      vtkMultiProcessController::SetGlobalController(this->Controller);
+    }
+  ~vtkMPICleanup()
+    {
+      if ( this->Controller )
+        {
+        this->Controller->Finalize();
+        this->Controller->Delete();
+        }
+    }
+private:
+  vtkMPIController *Controller;
+};
+
+static vtkMPICleanup VTKMPICleanup;
+
+#endif // VTK_COMPILED_USING_MPI
+
+
+static void vtkRubyAppInitEnableMSVCDebugHook();
+static void vtkRubyAppInitPrependPath(void);
+
+/* The maximum length of a file name.  */
+#if defined(PATH_MAX)
+# define VTK_RUBY_MAXPATH PATH_MAX
+#elif defined(MAXPATHLEN)
+# define VTK_RUBY_MAXPATH MAXPATHLEN
+#else
+# define VTK_RUBY_MAXPATH 16384
+#endif
+
+/* Ruby major.minor version string.  */
+#define VTK_RUBY_TO_STRING(x) VTK_RUBY_TO_STRING0(x)
+#define VTK_RUBY_TO_STRING0(x) VTK_RUBY_TO_STRING1(x)
+#define VTK_RUBY_TO_STRING1(x) #x
+#define VTK_RUBY_VERSION VTK_RUBY_TO_STRING(PY_MAJOR_VERSION.PY_MINOR_VERSION)
+
+int main(int argc, char **argv)
+{
+  vtkRubyAppInitEnableMSVCDebugHook();
+
+#ifdef VTK_COMPILED_USING_MPI
+  VTKMPICleanup.Initialize(&argc, &argv);
+#endif // VTK_COMPILED_USING_MPI
+
+  int displayVersion = 0;
+  if ( argc > 1 )
+    {
+    int cc;
+    for ( cc = 1; cc < argc; cc ++ )
+      {
+      if ( strcmp(argv[cc], "-V") == 0 )
+        {
+        displayVersion = 1;
+        break;
+        }
+      }
+    }
+  else
+    {
+    displayVersion = 1;
+    }
+  if ( displayVersion )
+    {
+    cout << vtkVersion::GetVTKSourceVersion() << endl;
+    }
+
+  // The following code will hack in the path for running VTK/Ruby
+  // from the build tree. Do not try this at home. We are
+  // professionals.
+
+  // Initialize interpreter.
+  ruby_init();
+  ruby_options(argc, argv);
+
+  vtkRubyAppInitPrependPath();
+
+  // Ok, all done, now enter ruby main.
+  ruby_run();
+  return 0;
+}
+
+// For a DEBUG build on MSVC, add a hook to prevent error dialogs when
+// being run from DART.
+#if defined(_MSC_VER) && defined(_DEBUG)
+# include <crtdbg.h>
+static int vtkRubyAppInitDebugReport(int, char* message, int*)
+{
+  fprintf(stderr, message);
+  exit(1);
+}
+void vtkRubyAppInitEnableMSVCDebugHook()
+{
+  if(getenv("DART_TEST_FROM_DART"))
+    {
+    _CrtSetReportHook(vtkRubyAppInitDebugReport);
+    }
+}
+#else
+void vtkRubyAppInitEnableMSVCDebugHook()
+{
+}
+#endif
+
+//----------------------------------------------------------------------------
+static void vtkRubyAppInitPrependRubyPath(const char* dir)
+{
+  // Convert slashes for this platform.
+  vtkstd::string out_dir = dir;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  for(vtkstd::string::size_type i = 0; i < out_dir.length(); ++i)
+    {
+    if(out_dir[i] == '/')
+      {
+      out_dir[i] = '\\';
+      }
+    }
+#endif
+
+  // Append the path to the $LOAD_PATH
+  ruby_incpush(dir);
+}
+
+//----------------------------------------------------------------------------
+static void vtkRubyAppInitPrependPath()
+{
+  vtkRubyAppInitPrependRubyPath(VTK_RUBY_LIBRARY_DIR);
+  vtkRubyAppInitPrependRubyPath(VTK_RUBY_SCRIPT_DIR_BUILD);
+
+}
diff -uNr VTK_org/Wrapping/vtkWrapRuby.c VTK/Wrapping/vtkWrapRuby.c
--- VTK_org/Wrapping/vtkWrapRuby.c	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/vtkWrapRuby.c	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,1268 @@
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile: vtkWrapRuby.c,v $
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+
+#include "vtkRuby.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "vtkParse.h"
+#include "vtkConfigure.h"
+
+int numberOfWrappedFunctions = 0;
+FunctionInfo *wrappedFunctions[1000];
+extern FunctionInfo *currentFunction;
+
+static int class_has_new = 0;
+
+/* when the cpp file doesn't have enough info use the hint file */
+void use_hints(FILE *fp)
+{
+  int  i;
+  
+  switch (currentFunction->ReturnType % 0x1000)
+    {
+    case 0x301:
+    case 0x307:
+      fprintf(fp,"    return rb_ary_new3(%d", currentFunction->HintSize);
+      for (i = 0; i < currentFunction->HintSize; i++)
+        {
+        fprintf(fp,",rb_float_new(temp%i[%d])",MAX_ARGS,i);
+        }
+      fprintf(fp,");\n");
+      break;
+    case 0x304:
+    case 0x30D:
+      fprintf(fp,"    return rb_ary_new3(%d", currentFunction->HintSize);
+      for (i = 0; i < currentFunction->HintSize; i++) 
+        {
+        fprintf(fp,",INT2NUM(temp%i[%d])",MAX_ARGS,i);
+        }
+      fprintf(fp,");\n");
+      break;
+    case 0x30A:
+      fprintf(fp,"    return rb_ary_new3(%d", currentFunction->HintSize);
+      for (i = 0; i < currentFunction->HintSize; i++) 
+        {
+#ifdef VTK_USE_64BIT_IDS
+#ifdef HAVE_LONG_LONG
+        fprintf(fp,",LL2NUM(temp%i[%d])",MAX_ARGS,i);
+#else
+        fprintf(fp,",LONG2NUM(temp%i[%d])",MAX_ARGS,i);
+#endif
+#else
+        fprintf(fp,",INT2NUM(temp%i[%d])",MAX_ARGS,i);
+#endif
+        }
+      fprintf(fp,");\n");
+      break;
+    case 0x30B: case 0x30C:
+      fprintf(fp,"    return rb_ary_new3(%d", currentFunction->HintSize);
+      for (i = 0; i < currentFunction->HintSize; i++) 
+        {
+#ifdef HAVE_LONG_LONG
+        fprintf(fp,",LL2NUM(temp%i[%d])",MAX_ARGS,i);
+#else
+        fprintf(fp,",LONG2NUM(temp%i[%d])",MAX_ARGS,i);
+#endif
+        }
+      fprintf(fp,");\n");
+      break;
+    case 0x305: case 0x306: case 0x313: case 0x314:
+    case 0x31A: case 0x31B: case 0x31C: case 0x315: case 0x316:
+      break;
+    }
+  return;
+}
+
+
+void output_temp(FILE *fp, int i, int aType, char *Id, int aCount)
+{
+  /* handle VAR FUNCTIONS */
+  if (aType == 0x5000)
+    {
+    fprintf(fp,"    VALUE temp%i;\n",i); 
+    return;
+    }
+  
+  if (((aType % 0x10) == 0x2)&&(!((aType % 0x1000)/0x100)))
+    {
+    return;
+    }
+
+  /* for const * return types prototype with const */
+  if ((i == MAX_ARGS)&&(aType % 0x2000 >= 0x1000))
+    {
+    fprintf(fp,"    const ");
+    }
+  else
+    {
+    fprintf(fp,"    ");
+    }
+  
+  if ((aType % 0x100)/0x10 == 0x1)
+    {
+    fprintf(fp,"unsigned ");
+    }
+  
+  switch (aType % 0x10)
+    {
+    case 0x1:   fprintf(fp,"float  "); break;
+    case 0x7:   fprintf(fp,"double "); break;
+    case 0x4:   fprintf(fp,"int    "); break;
+    case 0x5:   fprintf(fp,"short  "); break;
+    case 0x6:   fprintf(fp,"long   "); break;
+    case 0x2:   fprintf(fp,"void   "); break;
+    case 0x3:   fprintf(fp,"char   "); break;
+    case 0x9:   fprintf(fp,"%s ",Id); break;
+    case 0xA:   fprintf(fp,"vtkIdType "); break;
+    case 0xB:   fprintf(fp,"long long "); break;
+    case 0xC:   fprintf(fp,"__int64 "); break;
+    case 0xD:   fprintf(fp,"signed char "); break;
+    case 0x8: return;
+    }
+  
+  switch ((aType % 0x1000)/0x100)
+    {
+    case 0x1: fprintf(fp, " *"); break; /* act " &" */
+    case 0x2: fprintf(fp, "&&"); break;
+    case 0x3: 
+      if ((i == MAX_ARGS)||(aType % 0x10 == 0x9)||(aType % 0x1000 == 0x303)
+          ||(aType % 0x1000 == 0x302))
+        {
+        fprintf(fp, " *"); 
+        }
+      break;
+    case 0x4: fprintf(fp, "&*"); break;
+    case 0x5: fprintf(fp, "*&"); break;
+    case 0x7: fprintf(fp, "**"); break;
+    default: fprintf(fp,"  "); break;
+    }
+  fprintf(fp,"temp%i",i);
+  
+  /* handle arrays */
+  if ((aType % 0x1000/0x100 == 0x3)&&
+      (i != MAX_ARGS)&&(aType % 0x10 != 0x9)&&(aType % 0x1000 != 0x303)
+      &&(aType % 0x1000 != 0x302))
+    {
+    fprintf(fp,"[%i]",aCount);
+    }
+
+  fprintf(fp,";\n");
+  if (aType % 0x1000 == 0x302 && i != MAX_ARGS)
+    {
+    fprintf(fp,"    int      size%d;\n",i);
+    }
+}
+
+void do_return(FILE *fp)
+{
+  /* ignore void */
+  if (((currentFunction->ReturnType % 0x10) == 0x2)&&
+      (!((currentFunction->ReturnType % 0x1000)/0x100)))
+    {
+    fprintf(fp,"    return Qnil;\n");
+    return;
+    }
+  
+  switch (currentFunction->ReturnType % 0x1000)
+    {
+    case 0x303:
+      fprintf(fp,"    if (temp%i == NULL) {\n",MAX_ARGS);
+      fprintf(fp,"      return Qnil;\n      }\n");
+      fprintf(fp,"    else {\n");
+      fprintf(fp,"      return rb_str_new2(temp%i);\n      }\n",MAX_ARGS);
+    break;
+    case 0x109:
+    case 0x309:  
+      {
+      fprintf(fp,"    {\n");
+      fprintf(fp,"    return vtkRubyGetObjectFromPointer((vtkObjectBase *)temp%i);\n",
+              MAX_ARGS, currentFunction->ReturnClass, currentFunction->ReturnClass);
+      fprintf(fp,"    }\n");
+      break;
+      }
+      
+    /* handle functions returning vectors */
+    /* this is done by looking them up in a hint file */
+    case 0x301: case 0x307: case 0x30A: case 0x30B: case 0x30C: case 0x30D:
+    case 0x304: case 0x305: case 0x306:
+      use_hints(fp);
+      break;
+    case 0x302:
+      {
+      fprintf(fp,"    if (temp%i == NULL)\n        {\n",MAX_ARGS);
+      fprintf(fp,"      return Qnil;\n        }\n");
+      fprintf(fp,"    else\n        {\n");
+      fprintf(fp,"      return rb_str_new2(vtkRubyManglePointer(temp%i,\"void_p\"));\n        }\n",
+              MAX_ARGS);
+      break;
+      }
+    case 0x1:
+    case 0x7:
+      {
+      fprintf(fp,"    return rb_float_new(temp%i);\n",
+                      MAX_ARGS);
+      break;
+      }
+    case 0x13:
+    case 0x14:
+    case 0x15:
+    case 0x4:
+    case 0x5:
+    case 0x6:
+    case 0xD:
+      {
+      fprintf(fp,"    return INT2NUM(temp%i);\n", MAX_ARGS); 
+      break;
+      }
+    case 0x16:   
+      {
+      fprintf(fp,"    return UINT2NUM(temp%i);\n", MAX_ARGS);
+      break;
+      }
+#if defined(VTK_USE_64BIT_IDS) && defined(HAVE_LONG_LONG) && (VTK_SIZEOF_LONG != VTK_SIZEOF_ID_TYPE)
+    case 0xA:
+      {
+      fprintf(fp,"    return LL2NUM(temp%i);\n", MAX_ARGS);
+      break;
+      }
+    case 0x1A:
+      {
+      fprintf(fp,"    return ULL2NUM(temp%i);\n",
+              MAX_ARGS);
+      break;
+      }
+#else
+    case 0xA:
+      {
+      fprintf(fp,"    return LONG2NUM((long)temp%i);\n", MAX_ARGS);
+      break;
+      }
+    case 0x1A:
+      {
+#if (PY_VERSION_HEX >= 0x02020000)
+      fprintf(fp,"    return ULONG2NUM((unsigned long)temp%i);\n",
+              MAX_ARGS);
+#else
+      fprintf(fp,"    return LONG2NUM((long)temp%i);\n",
+              MAX_ARGS);
+#endif
+      break;
+      }
+#endif
+#if defined(VTK_SIZEOF_LONG_LONG)
+# if defined(HAVE_LONG_LONG) && (VTK_SIZEOF_LONG != VTK_SIZEOF_LONG_LONG)
+    case 0xB:
+      {
+      fprintf(fp,"    return LL2NUM(temp%i);\n", MAX_ARGS);
+      break;
+      }
+    case 0x1B:
+      {
+      fprintf(fp,"    return ULL2NUM(temp%i);\n",
+              MAX_ARGS);
+      break;
+      }
+# else
+    case 0xB:
+      {
+      fprintf(fp,"    return LONG2NUM(temp%i);\n", MAX_ARGS);
+      break;
+      }
+    case 0x1B:
+      {
+      fprintf(fp,"    return ULONG2NUM(temp%i);\n",
+              MAX_ARGS);
+      break;
+      }
+# endif
+#endif
+#if defined(VTK_SIZEOF___INT64)
+# if defined(HAVE_LONG_LONG) && (VTK_SIZEOF_LONG != VTK_SIZEOF___INT64)
+    case 0xC:
+      {
+      fprintf(fp,"    return LL2NUM(temp%i);\n", MAX_ARGS);
+      break;
+      }
+    case 0x1C:
+      {
+      fprintf(fp,"    return ULL2NUM(temp%i);\n",
+              MAX_ARGS);
+      break;
+      }
+# else
+    case 0xC:
+      {
+      fprintf(fp,"    return LONG2NUM(temp%i);\n", MAX_ARGS);
+      break;
+      }
+    case 0x1C:
+      {
+      fprintf(fp,"    return ULONG2NUM(temp%i);\n",
+              MAX_ARGS);
+      break;
+      }
+# endif
+#endif
+    case 0x3:   
+      {
+      fprintf(fp,"    return rb_str_new((char *)&temp%i,1);\n",
+              MAX_ARGS);
+      break;
+      }
+    }
+}
+
+void get_args(FILE *fp,int occ)
+{
+  int argtype;
+  int i, j;
+
+  if (currentFunction->ArgTypes[0] == 0x5000)
+    {
+    fprintf(fp,"    if (rb_class_of(argv[0])!=rb_cProc)\n");
+    fprintf(fp,"      goto break%d;\n",occ);
+    fprintf(fp,"    temp0 = argv[0];\n");
+    fprintf(fp,"    rb_VTKObject_PushMark(self, temp0);\n");
+    return;
+    }
+
+  for (i = 0; i < currentFunction->NumberOfArguments; i++)
+    {
+    argtype = currentFunction->ArgTypes[i] % 0x1000;
+
+    switch (argtype)
+      {
+      case 0x301:
+        fprintf(fp,"    if (rb_class_of(argv[%d])!=rb_cArray||RARRAY(argv[%d])->len!=%d)\n",i,i,currentFunction->ArgCounts[i]);
+        fprintf(fp,"      goto break%d;\n",occ);
+        for (j = 0; j < currentFunction->ArgCounts[i]; j++) 
+          {
+          fprintf(fp,"    temp%i[%d] = (float)NUM2DBL(rb_ary_entry(argv[%d],%d));\n",i,j,i,j);
+          }
+        break;
+      case 0x307:  
+        fprintf(fp,"    if (rb_class_of(argv[%d])!=rb_cArray||RARRAY(argv[%d])->len!=%d)\n",i,i,currentFunction->ArgCounts[i]);
+        fprintf(fp,"      goto break%d;\n",occ);
+        for (j = 0; j < currentFunction->ArgCounts[i]; j++) 
+          {
+          fprintf(fp,"    temp%i[%d] = NUM2DBL(rb_ary_entry(argv[%d],%d));\n",i,j,i,j);
+          }
+        break;
+      case 0x304:
+        fprintf(fp,"    if (rb_class_of(argv[%d])!=rb_cArray||RARRAY(argv[%d])->len!=%d)\n",i,i,currentFunction->ArgCounts[i]);
+        fprintf(fp,"      goto break%d;\n",occ);
+        for (j = 0; j < currentFunction->ArgCounts[i]; j++) 
+          {
+          fprintf(fp,"    temp%i[%d] = NUM2INT(rb_ary_entry(argv[%d],%d));\n",i,j,i,j);
+          }
+        break;
+      case 0x30A:
+        fprintf(fp,"    if (rb_class_of(argv[%d])!=rb_cArray||RARRAY(argv[%d])->len!=%d)\n",i,i,currentFunction->ArgCounts[i]);
+        fprintf(fp,"      goto break%d;\n",occ);
+        for (j = 0; j < currentFunction->ArgCounts[i]; j++) 
+          {
+#ifdef VTK_USE_64BIT_IDS
+#ifdef HAVE_LONG_LONG
+          fprintf(fp,"    temp%i[%d] = NUM2LL(rb_ary_entry(argv[%d],%d));\n",i,j,i,j);
+#else
+          fprintf(fp,"    temp%i[%d] = NUM2LONG(rb_ary_entry(argv[%d],%d));\n",i,j,i,j);
+#endif
+#else
+          fprintf(fp,"    temp%i[%d] = NUM2INT(rb_ary_entry(argv[%d],%d));\n",i,j,i,j);
+#endif
+          }
+        break;
+      case 0x30B: case 0x30C:
+        fprintf(fp,"    if (rb_class_of(argv[%d])!=rb_cArray||RARRAY(argv[%d])->len!=%d)\n",i,i,currentFunction->ArgCounts[i]);
+        fprintf(fp,"      goto break%d;\n",occ);
+        for (j = 0; j < currentFunction->ArgCounts[i]; j++) 
+          {
+#ifdef HAVE_LONG_LONG
+          fprintf(fp,"    temp%i[%d] = NUM2LL(rb_ary_entry(argv[%d],%d));\n",i,j,i,j);
+#else
+          fprintf(fp,"    temp%i[%d] = NUM2LONG(rb_ary_entry(argv[%d],%d));\n",i,j,i,j);
+#endif
+          }
+        break;
+      case 0x109:
+      case 0x309:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_vtkObjectBaseClass())&&argv[%d]!=Qnil)\n",i,i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = (%s *)vtkRubyGetPointerFromObject(argv[%d]);\n",i,currentFunction->ArgClasses[i],i);
+        fprintf(fp,"    if (temp%i!=NULL&&!((vtkObjectBase *)temp%i)->IsA(\"%s\"))\n",i,i,currentFunction->ArgClasses[i]);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    rb_VTKObject_PushMark(self, argv[%d]);\n",i);
+	break;
+      case 0x303:
+        fprintf(fp,"    if (argv[%d]!=Qnil&&rb_class_of(argv[%d])!=rb_cString)\n",i,i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = argv[%d]==Qnil?NULL:STR2CSTR(argv[%d]);\n",i,i,i);
+	fprintf(fp,"    rb_VTKObject_PushMark(self, argv[%d]);\n",i);
+	break;
+      case 0x302:
+        fprintf(fp,"    if (argv[%d]!=Qnil&&rb_class_of(argv[%d])!=rb_cString)\n",i,i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    if (argv[%d]==Qnil)\n",i);
+	fprintf(fp,"      {\n");
+	fprintf(fp,"        temp%i = (void*)STR2CSTR(argv[%d]);\n",i,i);
+	fprintf(fp,"        size%i = RSTRING(argv[%d])->len;\n",i,i);
+	fprintf(fp,"      }\n");
+	fprintf(fp,"    else\n");
+	fprintf(fp,"      {\n");
+	fprintf(fp,"        temp%i = NULL;\n",i);
+	fprintf(fp,"        size%i = 0;\n",i);
+	fprintf(fp,"      }\n");
+	fprintf(fp,"    rb_VTKObject_PushMark(self, argv[%d]);\n",i);
+	break;
+      case 0x1:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = (float)NUM2DBL(argv[%d]);\n",i,i);
+	break;
+      case 0x7:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = NUM2DBL(argv[%d]);\n",i,i);
+	break;
+      case 0x14:
+      case 0x4:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = NUM2INT(argv[%d]);\n",i,i);
+	break;
+      case 0x15:
+      case 0x5:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = (short)NUM2INT(argv[%d]);\n",i,i);
+	break;
+      case 0x16:
+      case 0x6:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = NUM2LONG(argv[%d]);\n",i,i);
+	break;
+      case 0x1A:
+      case 0xA:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+#ifdef VTK_USE_64BIT_IDS
+#ifdef HAVE_LONG_LONG
+	fprintf(fp,"    temp%i = NUM2LL(argv[%d]);\n",i,i);
+#else
+	fprintf(fp,"    temp%i = NUM2LONG(argv[%d]);\n",i,i);
+#endif
+#else
+	fprintf(fp,"    temp%i = NUM2INT(argv[%d]);\n",i,i);
+#endif
+	break;
+      case 0xB: case 0xC:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+#ifdef HAVE_LONG_LONG
+	fprintf(fp,"    temp%i = NUM2LL(argv[%d]);\n",i,i);
+#else
+	fprintf(fp,"    temp%i = NUM2LONG(argv[%d]);\n",i,i);
+#endif
+	break;
+      case 0x1B: case 0x1C:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+#ifdef HAVE_LONG_LONG
+	fprintf(fp,"    temp%i = NUM2ULL(argv[%d]);\n",i,i);
+#else
+	fprintf(fp,"    temp%i = NUM2ULONG(argv[%d]);\n",i,i);
+#endif
+	break;
+      case 0xD:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = (signed char)NUM2INT(argv[%d]);\n",i,i);
+	break;
+      case 0x3:
+        fprintf(fp,"    if (rb_class_of(argv[%d])!=rb_cString)\n",i,i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = STR2CSTR(argv[%d])[0];\n",i,i);
+	break;
+      case 0x13:
+        fprintf(fp,"    if (!rb_obj_is_kind_of(argv[%d],rb_cNumeric))\n",i);
+        fprintf(fp,"      goto break%d;\n",occ);
+	fprintf(fp,"    temp%i = (char)NUM2INT(argv[%d]);\n",i,i);
+	break;
+      }
+    }
+  return;
+}
+
+
+void outputFunction2(FILE *fp, FileInfo *data)
+{
+  int i, k, is_static, is_vtkobject, fnum, occ, backnum;
+  FunctionInfo *theFunc;
+  FunctionInfo *backFunc;
+
+  is_vtkobject = ((strcmp(data->ClassName,"vtkObjectBase") == 0) || 
+                  (data->NumberOfSuperClasses != 0));
+
+  /* create a signature for each method (for use in docstring) */
+  for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++)
+    {
+    theFunc = wrappedFunctions[fnum];
+    currentFunction = theFunc;
+    }
+
+  /* create external type declarations for all object
+     return types */
+  for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++)
+    {
+    theFunc = wrappedFunctions[fnum];
+    currentFunction = theFunc;
+
+    /* check for object return types */
+    if ((theFunc->ReturnType % 0x1000 == 0x309)||
+        (theFunc->ReturnType % 0x1000 == 0x109))
+      {
+      /* check that we haven't done this type (no duplicate declarations) */
+      for (backnum = fnum-1; backnum >= 0; backnum--) 
+        {
+        backFunc = wrappedFunctions[backnum];
+        if (((backFunc->ReturnType % 0x1000 == 0x309)||
+             (backFunc->ReturnType % 0x1000 == 0x109)) &&
+            (strcmp(theFunc->ReturnClass,backFunc->ReturnClass) == 0))
+          {
+          break;
+          }
+        }
+      }
+    }
+
+  /* for each function in the array */
+  for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++)
+    {
+    /* make sure we haven't already done one of these */
+    theFunc = wrappedFunctions[fnum];
+    currentFunction = theFunc;
+
+    if (theFunc->Name)
+      {
+      fprintf(fp,"\n");
+
+      /* check whether all signatures are static methods */
+      is_static = 1;
+      for (occ = fnum; occ < numberOfWrappedFunctions; occ++)
+        {
+        /* is it the same name */
+        if (wrappedFunctions[occ]->Name &&
+            !strcmp(theFunc->Name,wrappedFunctions[occ]->Name))
+          {
+          /* check for static methods */
+          if (((wrappedFunctions[occ]->ReturnType/0x1000) & 0x2) != 0x2)
+            {
+            is_static = 0;
+            }
+          }
+        }
+        
+      if(currentFunction->IsLegacy)
+        {
+        fprintf(fp,"#if !defined(VTK_LEGACY_REMOVE)\n");
+        }
+      fprintf(fp,"static VALUE rb_%s_%s(int argc, VALUE *argv, VALUE self)\n",
+              data->ClassName,currentFunction->Name);
+      fprintf(fp,"{\n");
+
+      if (strcmp(currentFunction->Name,"UnRegister")==0)
+	{
+        fprintf(fp,"  if (argc == 1)\n");
+        fprintf(fp,"    {\n");
+        for (i = 0; i < currentFunction->NumberOfArguments; i++)
+          {
+          output_temp(fp, i, currentFunction->ArgTypes[i],
+                      currentFunction->ArgClasses[i],
+                      currentFunction->ArgCounts[i]);
+          }
+        output_temp(fp, MAX_ARGS,currentFunction->ReturnType,
+                    currentFunction->ReturnClass,0);
+        get_args(fp,fnum);
+	fprintf(fp,"    vtkRubyUnRegister(self);\n");
+	fprintf(fp,"    return Qnil;\n");
+        fprintf(fp,"    }\n");
+        fprintf(fp,"  break%d:\n",fnum);
+	}
+      else
+	{
+        /* find all occurances of this method */
+        for (occ = fnum; occ < numberOfWrappedFunctions; occ++)
+	  {
+          is_static = 0;
+
+	  /* is it the same name */
+	  if (wrappedFunctions[occ]->Name && 
+	      !strcmp(theFunc->Name,wrappedFunctions[occ]->Name))
+	    {
+             /* check for static methods */
+            if (((wrappedFunctions[occ]->ReturnType/0x1000) & 0x2) == 0x2)
+	      {
+              is_static = 1;
+	      }
+
+	    currentFunction = wrappedFunctions[occ];
+
+	    fprintf(fp,"  /* handle an occurrence */\n");
+	    fprintf(fp,"  if (argc == %d)\n", currentFunction->NumberOfArguments);
+	    fprintf(fp,"    {\n");
+	    /* declare the variables */
+	    if (!is_static)
+	      {
+	      if (is_vtkobject)
+		{
+		fprintf(fp,"    %s *op;\n\n",data->ClassName);
+		}
+	      else 
+		{
+		fprintf(fp,"    %s *op = (%s *)vtkRubyGetPointerFromObject(self)->ptr;\n\n",data->ClassName,data->ClassName);
+		}
+	      }
+
+	    /* process the args */
+	    for (i = 0; i < currentFunction->NumberOfArguments; i++)
+	      {
+	      output_temp(fp, i, currentFunction->ArgTypes[i],
+			  currentFunction->ArgClasses[i],
+			  currentFunction->ArgCounts[i]);
+	      }
+	    output_temp(fp, MAX_ARGS,currentFunction->ReturnType,
+			currentFunction->ReturnClass,0);
+	    if (is_static || !is_vtkobject)
+	      {
+	      get_args(fp,occ);
+	      }
+	    else
+	      {
+	      get_args(fp,occ);
+	      fprintf(fp,"    op = (%s *)vtkRubyGetPointerFromObject(self);\n",data->ClassName);
+	      }
+
+	    /* make sure passed method is callable  for VAR functions */
+	    if (currentFunction->NumberOfArguments == 0x1 &&
+		currentFunction->ArgTypes[0] == 0x5000)
+	      {
+	      fprintf(fp,"    if (rb_class_of(temp0)!=rb_cProc)\n");
+	      fprintf(fp,"      {\n      rb_raise(rb_eArgError,\"vtk callback method passed to %s in %s was not callable.\");\n",
+		      currentFunction->Name,data->ClassName);
+	      fprintf(fp,"      }\n");
+	      }
+
+	    /* check for void pointers and pass appropriate info*/
+	    for (i = 0; i < currentFunction->NumberOfArguments; i++)
+	      {
+	      if (currentFunction->ArgTypes[i] % 0x1000 == 0x302)
+		{
+		fprintf(fp,"    temp%i = vtkRubyUnmanglePointer((char *)temp%i,&size%i,(char*)\"%s\");\n",i,i,i,"void_p");
+		fprintf(fp,"    if (size%i == -1) {\n      rb_raise(rb_eRuntimeError,\"mangled pointer to %s in %s was of incorrect type.\");\n",
+			i,currentFunction->Name,data->ClassName);
+		fprintf(fp,"      }\n");
+		fprintf(fp,"    else if (size%i == -2) {\n      rb_raise(rb_eRuntimeError,\"mangled pointer to %s in %s was poorly formed.\");\n",
+			i,currentFunction->Name,data->ClassName);
+		fprintf(fp,"      rb_raise(rb_eArgError,\"Invalid arguments (%s#%s)\");\n",data->ClassName,currentFunction->Name);
+		fprintf(fp,"}\n"); 
+		}
+	      }
+
+	    for (k = 0; k < (2 - (is_static || !is_vtkobject)); k++)
+	      {
+	      char methodname[256]; 
+	      if (k == 0)
+		{
+		if (is_static)
+		  {
+		  fprintf(fp,"      {\n");
+		  sprintf(methodname,"%s::%s",
+			  data->ClassName,currentFunction->Name);
+		  }
+		else if (!is_vtkobject)
+		  {
+		  fprintf(fp,"      {\n");
+		  sprintf(methodname,"op->%s",currentFunction->Name);
+		  }
+		else
+		  {
+		  if (currentFunction->IsPureVirtual)
+		    {
+		    fprintf(fp,"    if (strcmp(op->GetClassName(),\"%s\")==0)\n      {\n",data->ClassName);
+		    fprintf(fp,"      rb_raise(rb_eTypeError,\"pure virtual method call\");\n");
+		    fprintf(fp,"    }\n");
+		    continue;
+		    }
+		  else
+		    {
+		    fprintf(fp,"    if (strcmp(op->GetClassName(),\"%s\")==0)\n      {\n",data->ClassName);
+		    sprintf(methodname,"op->%s::%s",
+			    data->ClassName,currentFunction->Name);
+		    }
+		  }
+		}
+	      else
+		{
+		fprintf(fp,"    else\n      {\n");
+		sprintf(methodname,"op->%s",currentFunction->Name);
+		}
+                
+	      switch (currentFunction->ReturnType % 0x1000)
+		{
+		case 0x2:
+		  fprintf(fp,"      %s(",methodname);
+		  break;
+		case 0x109:
+		  fprintf(fp,"      temp%i = &%s(",MAX_ARGS,methodname);
+		  break;
+		default:
+		  fprintf(fp,"      temp%i = %s(",MAX_ARGS,methodname);
+		}
+
+	      for (i = 0; i < currentFunction->NumberOfArguments; i++)
+		{
+		if (i)
+		  fprintf(fp,",");
+		if (currentFunction->ArgTypes[i] % 0x1000 == 0x109)
+		  fprintf(fp,"*(temp%i)",i);
+		else if (currentFunction->NumberOfArguments == 1 
+			 && currentFunction->ArgTypes[i] == 0x5000)
+		  fprintf(fp,"((temp0 != Qnil) ? vtkRubyVoidFunc : NULL),(void *)temp%i",i);
+		else
+		  fprintf(fp,"temp%i",i);
+		}
+	      fprintf(fp,");\n");
+          
+	      if (currentFunction->NumberOfArguments == 1 
+		  && currentFunction->ArgTypes[0] == 0x5000)
+		fprintf(fp,"    %sArgDelete(vtkRubyVoidFuncArgDelete);\n",
+			methodname);
+	      fprintf(fp,"      }\n");
+	      }
+
+	    for (i = 0; i < currentFunction->NumberOfArguments; i++)
+	      {
+	      if (currentFunction->ArgCounts[i] &&  /* array */
+		  currentFunction->ArgTypes[i] % 0x10 != 0 && /* not a special type */
+		  currentFunction->ArgTypes[i] % 0x10 != 0x9 && /* not class pointer */
+		  currentFunction->ArgTypes[i] % 0x10 != 0x8 && 
+		  currentFunction->ArgTypes[i] % 0x10 != 0x2 && /* not void pointer */
+		  (currentFunction->ArgTypes[i] % 0x2000 < 0x1000)) /* not const */
+		{
+		fprintf(fp,"    if (vtkRubyCheckArray(argv,%d,temp%d,%d))\n      {\n"
+			"      return 0;\n"
+			"      }\n", i, i, currentFunction->ArgCounts[i]);
+		}
+	      }
+	    do_return(fp);
+	    fprintf(fp,"    }\n");
+	    if(currentFunction->NumberOfArguments != 0)
+	      fprintf(fp,"  break%d:\n",occ);
+	    }
+	  }
+	}
+      fprintf(fp,"  rb_raise(rb_eArgError,\"wrong # of arguments (%%d)\",argc);\n");
+      fprintf(fp,"  return Qnil;\n");
+      fprintf(fp,"}\n");
+      if(currentFunction->IsLegacy)
+        {
+        fprintf(fp,"#endif\n");
+        }
+      fprintf(fp,"\n");
+
+      /* clear all occurances of this method from further consideration */
+      for (occ = fnum + 1; occ < numberOfWrappedFunctions; occ++)
+        {
+        /* is it the same name */
+        if (wrappedFunctions[occ]->Name && 
+            !strcmp(theFunc->Name,wrappedFunctions[occ]->Name))
+          {
+          int siglen = (int)strlen(wrappedFunctions[fnum]->Signature);
+          /* memory leak here but ... */
+          wrappedFunctions[occ]->Name = NULL;
+          wrappedFunctions[fnum]->Signature = (char *)
+            realloc(wrappedFunctions[fnum]->Signature,siglen+3+
+                    strlen(wrappedFunctions[occ]->Signature));
+          strcpy(&wrappedFunctions[fnum]->Signature[siglen],"\\n");
+          strcpy(&wrappedFunctions[fnum]->Signature[siglen+2],
+                 wrappedFunctions[occ]->Signature);
+          }
+        }
+      } /* is this method non NULL */
+    } /* loop over all methods */
+  
+}
+
+
+
+void outputFunction(FILE *fp, FileInfo *data)
+{
+  int i;
+  int args_ok = 1;
+
+  fp = fp;
+  /* some functions will not get wrapped no matter what else,
+     and some really common functions will appear only in vtkObjectRuby */
+  if (currentFunction->IsOperator || 
+      currentFunction->ArrayFailure ||
+      !currentFunction->IsPublic ||
+      !currentFunction->Name)
+    {
+    return;
+    }
+  
+  /* check to see if we can handle the args */
+  for (i = 0; i < currentFunction->NumberOfArguments; i++)
+    {
+    if (currentFunction->ArgTypes[i] % 0x1000 == 9) args_ok = 0;
+    if ((currentFunction->ArgTypes[i] % 0x10) == 8) args_ok = 0;
+    if (((currentFunction->ArgTypes[i] % 0x1000)/0x100 != 0x3)&&
+        (currentFunction->ArgTypes[i] % 0x1000 != 0x109)&&
+        ((currentFunction->ArgTypes[i] % 0x1000)/0x100)) args_ok = 0;
+    if (currentFunction->ArgTypes[i] % 0x1000 == 0x313) args_ok = 0;
+    if (currentFunction->ArgTypes[i] % 0x1000 == 0x314) args_ok = 0;
+    if (currentFunction->ArgTypes[i] % 0x1000 == 0x31A) args_ok = 0;
+    if (currentFunction->ArgTypes[i] % 0x1000 == 0x31B) args_ok = 0;
+    if (currentFunction->ArgTypes[i] % 0x1000 == 0x31C) args_ok = 0;
+    if (currentFunction->ArgTypes[i] % 0x1000 == 0x315) args_ok = 0;
+    if (currentFunction->ArgTypes[i] % 0x1000 == 0x316) args_ok = 0;
+    }
+  if ((currentFunction->ReturnType % 0x10) == 0x8) args_ok = 0;
+  if (currentFunction->ReturnType % 0x1000 == 0x9) args_ok = 0;
+  if (((currentFunction->ReturnType % 0x1000)/0x100 != 0x3)&&
+      (currentFunction->ReturnType % 0x1000 != 0x109)&&
+      ((currentFunction->ReturnType % 0x1000)/0x100)) args_ok = 0;
+
+
+  /* eliminate unsigned char * and unsigned short * */
+  if (currentFunction->ReturnType % 0x1000 == 0x313) args_ok = 0;
+  if (currentFunction->ReturnType % 0x1000 == 0x314) args_ok = 0;
+  if (currentFunction->ReturnType % 0x1000 == 0x31A) args_ok = 0;
+  if (currentFunction->ReturnType % 0x1000 == 0x31B) args_ok = 0;
+  if (currentFunction->ReturnType % 0x1000 == 0x31C) args_ok = 0;
+  if (currentFunction->ReturnType % 0x1000 == 0x315) args_ok = 0;
+  if (currentFunction->ReturnType % 0x1000 == 0x316) args_ok = 0;
+
+  if (currentFunction->NumberOfArguments && 
+      (currentFunction->ArgTypes[0] == 0x5000)
+      &&(currentFunction->NumberOfArguments != 0x1)) args_ok = 0;
+
+  /* make sure we have all the info we need for array arguments in */
+  for (i = 0; i < currentFunction->NumberOfArguments; i++)
+    {
+    if (((currentFunction->ArgTypes[i] % 0x1000)/0x100 == 0x3)&&
+        (currentFunction->ArgCounts[i] <= 0)&&
+        (currentFunction->ArgTypes[i] % 0x1000 != 0x309)&&
+        (currentFunction->ArgTypes[i] % 0x1000 != 0x303)&&
+        (currentFunction->ArgTypes[i] % 0x1000 != 0x302)) args_ok = 0;
+    }
+
+  /* if we need a return type hint make sure we have one */
+  switch (currentFunction->ReturnType % 0x1000)
+    {
+    case 0x301: case 0x307: case 0x30A: case 0x30B: case 0x30C: case 0x30D:
+    case 0x304: case 0x305: case 0x306:
+      args_ok = currentFunction->HaveHint;
+      break;
+    }
+  
+  /* make sure it isn't a Delete or New function */
+  if (!strcmp("Delete",currentFunction->Name) ||
+      !strcmp("New",currentFunction->Name))
+    {
+    args_ok = 0;
+    }
+  
+  /* check for New() function */
+  if (!strcmp("New",currentFunction->Name) &&
+      currentFunction->NumberOfArguments == 0)
+    {
+    class_has_new = 1;
+    }
+
+  if (currentFunction->IsPublic && args_ok && 
+      strcmp(data->ClassName,currentFunction->Name) &&
+      strcmp(data->ClassName, currentFunction->Name + 1))
+    {
+    wrappedFunctions[numberOfWrappedFunctions] = currentFunction;
+    numberOfWrappedFunctions++;
+    }
+}
+
+
+void outputMethods(FILE *fp, FileInfo *data)
+{
+  int fnum;
+
+  for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++)
+    {
+    if(wrappedFunctions[fnum]->IsLegacy)
+      {
+      fprintf(fp,"#if !defined(VTK_LEGACY_REMOVE)\n");
+      }
+    if(wrappedFunctions[fnum]->Name)
+      {
+      if (((wrappedFunctions[fnum]->ReturnType/0x1000) & 0x2) == 0x2)
+        fprintf(fp,"  rb_define_singleton_method(c%s, \"%s\", VALUEFUNC(rb_%s_%s), -1);\n",
+		data->ClassName, wrappedFunctions[fnum]->Name,
+		data->ClassName, wrappedFunctions[fnum]->Name);
+      else
+	fprintf(fp,"  rb_define_method(c%s, \"%s\", VALUEFUNC(rb_%s_%s), -1);\n",
+		data->ClassName, wrappedFunctions[fnum]->Name,
+		data->ClassName, wrappedFunctions[fnum]->Name);
+      }
+    if(wrappedFunctions[fnum]->IsLegacy)
+      {
+      fprintf(fp,"#endif\n");
+      }
+    }
+
+  if (strcmp("vtkObject",data->ClassName)==0)
+    {
+    fprintf(fp,"  rb_define_method(c%s, \"AddObserver\", VALUEFUNC(rb_%s_AddObserver), -1);\n",
+	    data->ClassName, data->ClassName);
+    }
+  else if (!strcmp("vtkObjectBase",data->ClassName))
+    {
+    fprintf(fp,"  rb_define_method(c%s, \"GetAddressAsString\", VALUEFUNC(rb_%s_GetAddressAsString), -1);\n",
+	    data->ClassName, data->ClassName);
+    fprintf(fp,"  rb_define_method(c%s, \"PrintRevisions\", VALUEFUNC(rb_%s_PrintRevisions), 0);\n",
+	    data->ClassName, data->ClassName);
+    }
+
+}
+
+
+/* print the parsed structures */
+void vtkParseOutput(FILE *fp, FileInfo *data)
+{
+  int i;
+  
+  fprintf(fp,"// ruby wrapper for %s object\n//\n",data->ClassName);
+  fprintf(fp,"#define VTK_WRAPPING_CXX\n");
+  if (strcmp("vtkObjectBase",data->ClassName) != 0)
+    {
+    /* Block inclusion of full streams.  */
+    fprintf(fp,"#define VTK_STREAMS_FWD_ONLY\n");
+    }
+  #if !defined(__APPLE__)
+  fprintf(fp,"#include \"vtkRuby.h\"\n");
+  fprintf(fp,"#undef _XOPEN_SOURCE /* Conflicts with standards.h.  */\n");
+  fprintf(fp,"#undef _THREAD_SAFE /* Conflicts with pthread.h.  */\n");
+  fprintf(fp,"#include \"vtkRubyUtil.h\"\n");
+  #endif
+  fprintf(fp,"#include \"%s.h\"\n",data->ClassName);
+  #if defined(__APPLE__)
+  fprintf(fp,"#include \"vtkRubyUtil.h\"\n\n");
+  #endif
+
+  fprintf(fp,"#ifdef __cplusplus\n");
+  fprintf(fp,"#  ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */\n");
+  fprintf(fp,"#    define PROTECTFUNC(f) ((VALUE (*)()) f)\n");
+  fprintf(fp,"#    define VALUEFUNC(f) ((VALUE (*)()) f)\n");
+  fprintf(fp,"#    define VOIDFUNC(f)  ((void (*)()) f)\n");
+  fprintf(fp,"#  else\n");
+  fprintf(fp,"#    ifndef ANYARGS /* These definitions should work for Ruby 1.6 */\n");
+  fprintf(fp,"#      define PROTECTFUNC(f) ((VALUE (*)()) f)\n");
+  fprintf(fp,"#      define VALUEFUNC(f) ((VALUE (*)()) f)\n");
+  fprintf(fp,"#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)\n");
+  fprintf(fp,"#    else /* These definitions should work for Ruby 1.7+ */\n");
+  fprintf(fp,"#      define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)\n");
+  fprintf(fp,"#      define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)\n");
+  fprintf(fp,"#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)\n");
+  fprintf(fp,"#    endif\n");
+  fprintf(fp,"#  endif\n");
+  fprintf(fp,"#else\n");
+  fprintf(fp,"#  define VALUEFUNC(f) (f)\n");
+  fprintf(fp,"#  define VOIDFUNC(f) (f)\n");
+  fprintf(fp,"#endif\n\n");
+
+  fprintf(fp,"#if defined(WIN32)\n");
+  fprintf(fp,"extern \"C\" { __declspec( dllexport ) void Init_%s(VALUE); }\n",
+          data->ClassName);
+  fprintf(fp,"#else\n");
+  fprintf(fp,"extern \"C\" { void Init_%s(VALUE); }\n",
+          data->ClassName);
+  fprintf(fp,"#endif\n\n");
+  for (i = 0; i < data->NumberOfSuperClasses; i++)
+    {
+    fprintf(fp,"extern \"C\" { VALUE Init_%s(VALUE); }\n",
+            data->SuperClasses[i]);
+    }
+  
+  if (!strcmp("vtkObject",data->ClassName))
+    {
+    /* Add the AddObserver method to vtkObject. */
+    fprintf(fp,"static VALUE rb_vtkObject_AddObserver(int argc, VALUE *argv, VALUE self)\n");
+    fprintf(fp,"{\n");
+    fprintf(fp,"  vtkObject *op;\n");
+    fprintf(fp,"  char *temp0;\n");
+    fprintf(fp,"  VALUE temp1;\n");
+    fprintf(fp,"  float temp2;\n");
+    fprintf(fp,"  unsigned long     temp20 = 0;\n");
+    fprintf(fp,"  if (argc!=2&&argc!=3)\n");
+    fprintf(fp,"    rb_raise(rb_eArgError,\"wrong # of arguments (%%d for 2)\",argc);\n");
+    fprintf(fp,"  op = (vtkObject *)vtkRubyGetPointerFromObject(self);\n");
+    fprintf(fp,"  temp0 = STR2CSTR(argv[0]);\n");
+    fprintf(fp,"  if(rb_class_of(argv[1])!=rb_cProc)\n");
+    fprintf(fp,"    rb_raise(rb_eArgError,\"the second argument must be Proc\");\n");
+    fprintf(fp,"  temp1 = argv[1];\n");
+    fprintf(fp,"  vtkRubyCommand *cbc = vtkRubyCommand::New();\n");
+    fprintf(fp,"  cbc->SetObject(temp1);\n");
+    fprintf(fp,"  if (argc==2)\n");
+    fprintf(fp,"    {\n");
+    fprintf(fp,"    temp20 = op->AddObserver(temp0,cbc);\n");
+    fprintf(fp,"    }\n");
+    fprintf(fp,"  else if(argc==3)\n");
+    fprintf(fp,"    {\n");
+    fprintf(fp,"    temp2 = NUM2DBL(argv[2]);\n");
+    fprintf(fp,"    temp20 = op->AddObserver(temp0,cbc,temp2);\n");
+    fprintf(fp,"    }\n");
+    fprintf(fp,"  cbc->Delete();\n");
+    fprintf(fp,"  return ULONG2NUM(temp20);\n");
+    fprintf(fp,"}\n\n");
+    }
+
+  if (!strcmp("vtkObjectBase",data->ClassName))
+    {
+    /* while we are at it spit out the GetStringFromObject method */
+    fprintf(fp,"VALUE rb_vtkObjectBase_GetAddressAsString(int argc, VALUE *argv, VALUE self)\n");
+    fprintf(fp,"{\n");
+
+    /* declare the variables */
+    fprintf(fp,"  %s *op;\n",data->ClassName);
+
+    /* handle unbound method call if 'self' is a RuVTKClass */
+    fprintf(fp,"  char *typecast;\n\n");
+    fprintf(fp,"  char temp20[256];\n");
+    fprintf(fp,"  if(argc==1)\n");
+    fprintf(fp,"    typecast = STR2CSTR(argv[0]);\n");
+    fprintf(fp,"  else if(argc>1)\n");
+    fprintf(fp,"    rb_raise(rb_eArgError,\"wrong # of arguments (%%d for <=1)\", argc);\n");
+    fprintf(fp,"  op = (%s *)vtkRubyGetPointerFromObject(self);\n",data->ClassName);
+    fprintf(fp,"  sprintf(temp20,\"Addr=%%p\",op);\n");
+    fprintf(fp,"  return rb_str_new2(temp20);\n");
+    fprintf(fp,"}\n\n");
+
+    /* Add the PrintRevisions method to vtkObjectBase. */
+    fprintf(fp,"VALUE rb_vtkObjectBase_PrintRevisions(int argc, VALUE *args, VALUE self)\n");
+    fprintf(fp,"{\n");
+    fprintf(fp,"  %s *op;\n",data->ClassName);
+    fprintf(fp,"  op = (%s *)vtkRubyGetPointerFromObject(self);\n",data->ClassName);
+    fprintf(fp,"  ostrstream vtkmsg_with_warning_C4701;\n");
+    fprintf(fp,"  op->PrintRevisions(vtkmsg_with_warning_C4701);\n");
+    fprintf(fp,"  vtkmsg_with_warning_C4701.put('\\0');\n");
+    fprintf(fp,"  VALUE result = rb_str_new2(vtkmsg_with_warning_C4701.str());\n");
+    fprintf(fp,"  delete vtkmsg_with_warning_C4701.str();\n");
+    fprintf(fp,"  return result;\n");
+    fprintf(fp,"}\n\n");
+    }
+  
+  /* insert function handling code here */
+  for (i = 0; i < data->NumberOfFunctions; i++)
+    {
+    currentFunction = data->Functions + i;
+    outputFunction(fp, data);
+    }
+  if (data->NumberOfSuperClasses || !data->IsAbstract)
+    {
+    outputFunction2(fp, data);
+    }
+  
+  /* output the class initilization function */
+  if (strcmp(data->ClassName,"vtkObjectBase") == 0)
+    { /* special wrapping for vtkObject */
+    if (class_has_new)
+      {
+      fprintf(fp,"static VALUE rb_%sNew(int argc, VALUE *argv, VALUE klass)\n",data->ClassName);
+      fprintf(fp,"{\n");
+      fprintf(fp,"  if (argc==0)\n");
+      fprintf(fp,"    return rb_VTKObject_New(klass, (vtkObjectBase*)%s::New());\n",
+	      data->ClassName);
+      fprintf(fp,"  else if (argc==1)\n");
+      fprintf(fp,"    return vtkRubyGetObjectFromObject(argv[0], \"%s\", klass);\n",
+	      data->ClassName);
+      fprintf(fp,"  else\n");
+      fprintf(fp,"    rb_raise(rb_eArgError,\"wrong # of arguments (%%d for 0 or 1)\",argc);\n");
+      fprintf(fp,"\n}\n\n");
+      }
+    fprintf(fp,"static VALUE c%s;\n", data->ClassName);
+    fprintf(fp,"static void rb_VTKClass_%sNew(VALUE module)\n", data->ClassName);
+    fprintf(fp,"{\n");
+    fprintf(fp,"  c%s = rb_vtk_define_class_under(module, \"%s\", rb_cObject);\n",
+	    data->ClassName, data->ClassName);
+    if (class_has_new)
+      {
+      fprintf(fp,"  rb_define_singleton_method(c%s, \"new\", VALUEFUNC(rb_%sNew), -1);\n",
+	      data->ClassName, data->ClassName);
+      }
+    outputMethods(fp, data);
+    fprintf(fp,"}\n\n");
+    fprintf(fp,"static int c%s_flag = 1;\n", data->ClassName);
+    fprintf(fp,"#if defined(WIN32)\n");
+    fprintf(fp,"extern __declspec( dllexport )\n");
+    fprintf(fp,"#else\n");
+    fprintf(fp,"extern \n");
+    fprintf(fp,"#endif\n");
+    fprintf(fp,"VALUE rb_%sClass(VALUE module)\n", data->ClassName);
+    fprintf(fp,"{\n");
+    fprintf(fp,"  if (c%s_flag)\n", data->ClassName);
+    fprintf(fp,"    {\n");
+    fprintf(fp,"    rb_VTKClass_%sNew(module);\n", data->ClassName);
+    fprintf(fp,"    c%s_flag = 0;\n", data->ClassName);
+    fprintf(fp,"    }\n");
+    fprintf(fp,"  return c%s;\n", data->ClassName);
+    fprintf(fp,"}\n");
+    fprintf(fp,"#if defined(WIN32)\n");
+    fprintf(fp,"extern __declspec( dllexport )\n");
+    fprintf(fp,"#else\n");
+    fprintf(fp,"extern \n");
+    fprintf(fp,"#endif\n");
+    fprintf(fp,"VALUE rb_%sClass()\n", data->ClassName);
+    fprintf(fp,"{\n");
+    fprintf(fp,"  if (c%s_flag)\n", data->ClassName);
+    fprintf(fp,"    {\n");
+    fprintf(fp,"    rb_raise(rb_eRuntimeError,\"%sClass is not defined\");\n", data->ClassName);
+    fprintf(fp,"    }\n");
+    fprintf(fp,"  return c%s;\n", data->ClassName);
+    fprintf(fp,"}\n\n");
+    fprintf(fp,"#ifdef __cplusplus\n");
+    fprintf(fp,"extern \"C\" {\n");
+    fprintf(fp,"#endif\n");
+    fprintf(fp,"void Init_%s(VALUE module)\n{\n",data->ClassName);
+    fprintf(fp,"  rb_%sClass(module);\n", data->ClassName);
+    fprintf(fp,"}\n");
+    fprintf(fp,"#ifdef __cplusplus\n");
+    fprintf(fp,"}\n");
+    fprintf(fp,"#endif\n");
+    }
+  else if (data->NumberOfSuperClasses)
+    { /* wrapping of descendants of vtkObjectBase */
+    if (class_has_new)
+      {
+      fprintf(fp,"static VALUE rb_%sNew(int argc, VALUE *argv, VALUE klass)\n",data->ClassName);
+      fprintf(fp,"{\n");
+      fprintf(fp,"  if (argc==0)\n");
+      fprintf(fp,"    return rb_VTKObject_New(klass, (vtkObjectBase*)%s::New());\n",
+	      data->ClassName);
+      fprintf(fp,"  else if (argc==1)\n");
+      fprintf(fp,"    return vtkRubyGetObjectFromObject(argv[0], \"%s\", klass);\n",
+	      data->ClassName);
+      fprintf(fp,"  else\n");
+      fprintf(fp,"    rb_raise(rb_eArgError,\"wrong # of arguments (%%d for 0 or 1)\",argc);\n");
+      fprintf(fp,"\n}\n\n");
+      }
+    fprintf(fp,"static VALUE c%s;\n", data->ClassName);
+    fprintf(fp,"static void rb_VTKClass_%sNew(VALUE module)\n", data->ClassName);
+    fprintf(fp,"{\n");
+    fprintf(fp,"#if defined(WIN32)\n");
+    fprintf(fp,"  extern __declspec( dllimport )\n");
+    fprintf(fp,"#else\n");
+    fprintf(fp,"  extern \n");
+    fprintf(fp,"#endif\n");
+    fprintf(fp,"  VALUE rb_%sClass(VALUE);\n", data->SuperClasses[0]);
+    fprintf(fp,"  c%s = rb_vtk_define_class_under(module, \"%s\", rb_%sClass(module));\n",
+	    data->ClassName, data->ClassName, data->SuperClasses[0]);
+    if (class_has_new)
+      {
+      fprintf(fp,"  rb_define_singleton_method(c%s, \"new\", VALUEFUNC(rb_%sNew), -1);\n",
+	      data->ClassName, data->ClassName);
+      }
+    outputMethods(fp, data);
+    fprintf(fp,"}\n");
+    fprintf(fp,"static int c%s_flag = 1;\n", data->ClassName);
+    fprintf(fp,"#if defined(WIN32)\n");
+    fprintf(fp,"extern __declspec( dllexport )\n");
+    fprintf(fp,"#else\n");
+    fprintf(fp,"extern \n");
+    fprintf(fp,"#endif\n");
+    fprintf(fp,"VALUE rb_%sClass(VALUE module)\n", data->ClassName);
+    fprintf(fp,"{\n");
+    fprintf(fp,"  if (c%s_flag)\n", data->ClassName);
+    fprintf(fp,"    {\n");
+    fprintf(fp,"    rb_VTKClass_%sNew(module);\n", data->ClassName);
+    fprintf(fp,"    c%s_flag = 0;\n", data->ClassName);
+    fprintf(fp,"    }\n");
+    fprintf(fp,"  return c%s;\n", data->ClassName);
+    fprintf(fp,"}\n");
+    fprintf(fp,"#ifdef __cplusplus\n");
+    fprintf(fp,"extern \"C\" {\n");
+    fprintf(fp,"#endif\n");
+    fprintf(fp,"void Init_%s(VALUE module)\n{\n",data->ClassName);
+    fprintf(fp,"  rb_%sClass(module);\n", data->ClassName);
+    fprintf(fp,"}\n");
+    fprintf(fp,"#ifdef __cplusplus\n");
+    fprintf(fp,"}\n");
+    fprintf(fp,"#endif\n");
+    }
+  else if (!data->IsAbstract)
+    { /* wrapping of 'special' non-vtkObject classes */
+    fprintf(fp,"static VALUE rb_%sNew(int argc, VALUE *argv, VALUE klass)\n",
+	    data->ClassName);
+    fprintf(fp,"{\n");
+    fprintf(fp,"  VALUE %s *obj = new %s;\n",data->ClassName,data->ClassName);
+    fprintf(fp,"  return rb_VTKSpecialObject_New(klass, (void*)obj);\n");
+    fprintf(fp,"\n}\n\n");
+    fprintf(fp,"static VALUE c%s;\n", data->ClassName);
+    fprintf(fp,"static void rb_VTKClass_%sNew(VALUE module)\n", data->ClassName);
+    fprintf(fp,"{\n");
+    fprintf(fp,"  c%s = rb_vtk_define_class_under(module, \"%s\", rb_cObject);\n",
+	    data->ClassName, data->ClassName);
+    fprintf(fp,"  rb_define_singleton_method(c%s, \"new\", VALUEFUNC(rb_%sNew), -1);\n",
+	      data->ClassName, data->ClassName);
+    fprintf(fp,"}\n");
+    fprintf(fp,"static int c%s_flag = 1;\n", data->ClassName);
+    fprintf(fp,"#if defined(WIN32)\n");
+    fprintf(fp,"extern __declspec( dllexport )\n");
+    fprintf(fp,"#else\n");
+    fprintf(fp,"extern \n");
+    fprintf(fp,"#endif\n");
+    fprintf(fp,"VALUE rb_%sClass(VALUE module)\n", data->ClassName);
+    fprintf(fp,"{\n");
+    fprintf(fp,"  if (c%s_flag)\n", data->ClassName);
+    fprintf(fp,"    {\n");
+    fprintf(fp,"    rb_VTKClass_%sNew(module);\n", data->ClassName);
+    fprintf(fp,"    c%s_flag = 0;\n", data->ClassName);
+    fprintf(fp,"    }\n");
+    fprintf(fp,"  return c%s;\n", data->ClassName);
+    fprintf(fp,"}\n");
+    fprintf(fp,"#ifdef __cplusplus\n");
+    fprintf(fp,"extern \"C\" {\n");
+    fprintf(fp,"#endif\n");
+    fprintf(fp,"void Init_%s(VALUE module)\n{\n",data->ClassName);
+    fprintf(fp,"  rb_%sClass(module);\n", data->ClassName);
+    fprintf(fp,"}\n");
+    fprintf(fp,"#ifdef __cplusplus\n");
+    fprintf(fp,"}\n");
+    fprintf(fp,"#endif\n");
+    }
+  else
+    { /* un-wrappable classes */
+    fprintf(fp,"#ifdef __cplusplus\n");
+    fprintf(fp,"extern \"C\" {\n");
+    fprintf(fp,"#endif\n");
+    fprintf(fp,"void Init_%s(VALUE module)\n{\n",data->ClassName);
+    fprintf(fp,"  rb_raise(rb_eRuntimeError, \"%s Class is not wrappable\");\n");
+    fprintf(fp,"}\n");
+    fprintf(fp,"#ifdef __cplusplus\n");
+    fprintf(fp,"}\n");
+    fprintf(fp,"#endif\n");
+    }
+
+}
+
diff -uNr VTK_org/Wrapping/vtkWrapRubyInit.c VTK/Wrapping/vtkWrapRubyInit.c
--- VTK_org/Wrapping/vtkWrapRubyInit.c	1970-01-01 09:00:00.000000000 +0900
+++ VTK/Wrapping/vtkWrapRubyInit.c	2009-01-25 13:53:16.000000000 +0900
@@ -0,0 +1,103 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* warning this code is also in getclasses.cxx under pcmaker */
+/* this roputine creates the init file */
+static void CreateInitFile(const char *libName, 
+  int numConcrete, char **concrete, 
+  FILE *fout) 
+{
+  int i;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  const char* prefix = "";
+#else
+  const char* prefix = "lib";
+#endif
+
+#if defined(_WIN32)
+  const char* dllexp = "__declspec(dllexport) ";
+#else
+  const char* dllexp = "";
+#endif
+  
+  fprintf(fout,"// Generated by vtkWrapRubyInit in VTK/Wrapping\n");
+  fprintf(fout,"#include \"vtkRuby.h\"\n\n");
+  fprintf(fout,"#include \"vtkSystemIncludes.h\"\n");
+  fprintf(fout,"#include <string.h>\n");
+  fprintf(fout,"// Handle compiler warning messages, etc.\n"
+          "#if defined( _MSC_VER ) && !defined(VTK_DISPLAY_WIN32_WARNINGS)\n"
+          "#pragma warning ( disable : 4706 )\n"
+          "#endif // Windows Warnings \n\n");
+  
+for (i = 0; i < numConcrete; i++)
+    {
+    fprintf(fout,"extern  \"C\" {%svoid Init_%s(VALUE); }\n", dllexp, concrete[i]);
+    }
+  
+#ifdef _WIN32
+  fprintf(fout,"extern  \"C\" {%svoid Init_%s();}\n\n", dllexp, libName);
+  fprintf(fout,"void Init_%s()\n{\n", libName);
+#else
+  fprintf(fout,"extern  \"C\" {%svoid Init_lib%s();}\n\n", dllexp, libName);
+  fprintf(fout,"void Init_lib%s()\n{\n", libName);
+#endif
+  
+  /* module init function */
+  fprintf(fout,"  VALUE mVtk = rb_define_module(\"Vtk\");\n\n");
+
+  for (i = 0; i < numConcrete; i++)
+    {
+    fprintf(fout,"  Init_%s(mVtk);\n", concrete[i]);
+    }
+  fprintf(fout,"}\n\n");
+}
+
+
+int main(int argc,char *argv[])
+{
+  FILE *file;
+  FILE *fout;
+  int numConcrete = 0;
+  char libName[250];
+  char tmpVal[250];
+  char *concrete[4000];
+
+  if (argc < 3)
+    {
+    fprintf(stderr,"Usage: %s input_file output_file\n",argv[0]);
+    return 1;
+    }
+
+  file = fopen(argv[1],"r");
+  if (!file) 
+    {
+    fprintf(stderr,"Input file %s could not be opened\n",argv[1]);
+    return 1;
+    }
+
+  fout = fopen(argv[2],"w");
+  if (!fout)
+    {
+    return 1;
+    }
+
+  /* read the info from the file */
+  fscanf(file,"%s",libName);
+
+  /* read in the classes */
+  while (fscanf(file,"%s",tmpVal) != EOF)
+    {
+    concrete[numConcrete] = strdup(tmpVal);
+    numConcrete++;
+    }
+  /* close the file */
+  fclose(file);
+
+  CreateInitFile(libName, numConcrete, concrete, fout);
+  fclose(fout);
+
+  return 0;
+}
+
