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	2007-06-05 13:53:47.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/cmVTKWrapRuby2Command.c VTK/CMake/cmVTKWrapRuby2Command.c
--- VTK_org/CMake/cmVTKWrapRuby2Command.c	1970-01-01 09:00:00.000000000 +0900
+++ VTK/CMake/cmVTKWrapRuby2Command.c	2007-06-05 13:53:47.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/vtkWrapRuby.cmake VTK/CMake/vtkWrapRuby.cmake
--- VTK_org/CMake/vtkWrapRuby.cmake	1970-01-01 09:00:00.000000000 +0900
+++ VTK/CMake/vtkWrapRuby.cmake	2007-06-05 13:53:47.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-03-29 05:38:25.000000000 +0900
+++ VTK/CMakeLists.txt	2007-06-05 13:53:47.000000000 +0900
@@ -606,6 +606,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.
@@ -616,6 +617,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)
@@ -633,6 +642,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)
@@ -886,6 +898,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)
@@ -967,13 +982,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)
 
@@ -1227,6 +1242,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")
@@ -1250,7 +1308,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)
@@ -1259,14 +1317,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)
@@ -1342,6 +1400,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
@@ -1433,7 +1511,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/CMakeLists.txt.orig VTK/CMakeLists.txt.orig
--- VTK_org/CMakeLists.txt.orig	1970-01-01 09:00:00.000000000 +0900
+++ VTK/CMakeLists.txt.orig	2007-03-29 05:38:25.000000000 +0900
@@ -0,0 +1,1528 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
+PROJECT(VTK)
+
+# Don't build anything unless the version of CMake is high enough.
+# The matching ELSE/ENDIF should be the last lines in the file.
+IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.9)
+
+# Tell the CMake makefile generator to not have rules depend on
+# themselves.  This causes extra rebuilds when the include path
+# changes from turning a kit on or off.
+SET(CMAKE_SKIP_RULE_DEPENDENCY 1)
+
+#-----------------------------------------------------------------------------
+# VTK version number.  An even minor number corresponds to releases.
+SET(VTK_MAJOR_VERSION 5)
+SET(VTK_MINOR_VERSION 0)
+SET(VTK_BUILD_VERSION 3)
+SET(VTK_VERSION
+    "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
+
+# Append the library version information to the library target
+# properties.  A parent project may set its own properties and/or may
+# block this.
+IF(NOT VTK_NO_LIBRARY_VERSION)
+  SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES}
+    VERSION "${VTK_VERSION}"
+    SOVERSION "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}"
+    )
+ENDIF(NOT VTK_NO_LIBRARY_VERSION)
+
+#-----------------------------------------------------------------------------
+# Load some macros.
+INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkDependentOption.cmake)
+INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkThirdParty.cmake)
+INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkExportKit.cmake)
+INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkMakeInstantiator.cmake)
+INCLUDE(${CMAKE_ROOT}/Modules/CMakeExportBuildSettings.cmake)
+
+#-----------------------------------------------------------------------------
+# Choose static or shared libraries.
+INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkSelectSharedLibraries.cmake)
+
+# Disable the install targets if using the rpath feature.
+IF(NOT WIN32)
+  IF(VTK_USE_RPATH)
+    SET(VTK_INSTALL_NO_RUNTIME 1)
+    SET(VTK_INSTALL_NO_DEVELOPMENT 1)
+    SET(VTK_INSTALL_NO_DOCUMENTATION 1)
+  ENDIF(VTK_USE_RPATH)
+ENDIF(NOT WIN32)
+
+#-----------------------------------------------------------------------------
+# Output directories.
+IF(NOT LIBRARY_OUTPUT_PATH)
+  SET(LIBRARY_OUTPUT_PATH ${VTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
+ENDIF(NOT LIBRARY_OUTPUT_PATH)
+IF(NOT EXECUTABLE_OUTPUT_PATH)
+  SET(EXECUTABLE_OUTPUT_PATH ${VTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
+ENDIF(NOT EXECUTABLE_OUTPUT_PATH)
+SET(VTK_LIBRARY_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
+SET(VTK_EXECUTABLE_DIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
+SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
+
+#-----------------------------------------------------------------------------
+# Configure install locations.  This allows parent projects to modify
+# the install location.  Optionally allow the project to specify a
+# single VTK_INSTALL_ROOT which basically adds to its install prefix
+# for VTK only.
+
+# The location in which to install VTK executables.
+IF(NOT VTK_INSTALL_BIN_DIR)
+  SET(VTK_INSTALL_BIN_DIR ${VTK_INSTALL_ROOT}/bin)
+ENDIF(NOT VTK_INSTALL_BIN_DIR)
+
+# The location in which to install VTK header files.
+IF(NOT VTK_INSTALL_INCLUDE_DIR)
+  SET(VTK_INSTALL_INCLUDE_DIR
+    ${VTK_INSTALL_ROOT}/include/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}
+    )
+ENDIF(NOT VTK_INSTALL_INCLUDE_DIR)
+
+# The location in which to install VTK libraries.
+IF(NOT VTK_INSTALL_LIB_DIR)
+  SET(VTK_INSTALL_LIB_DIR ${VTK_INSTALL_ROOT}/lib)
+ENDIF(NOT VTK_INSTALL_LIB_DIR)
+
+# The location in which to install CMake scripts for packaging VTK.
+IF(NOT VTK_INSTALL_PACKAGE_DIR)
+  SET(VTK_INSTALL_PACKAGE_DIR
+    ${VTK_INSTALL_LIB_DIR}/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}
+    )
+ENDIF(NOT VTK_INSTALL_PACKAGE_DIR)
+
+# The location in which to install VTK doxygen documentation helper
+# files.
+IF(NOT VTK_INSTALL_DOXYGEN_DIR)
+  SET(VTK_INSTALL_DOXYGEN_DIR ${VTK_INSTALL_PACKAGE_DIR}/doxygen)
+ENDIF(NOT VTK_INSTALL_DOXYGEN_DIR)
+
+# Compute the proper location for installing the Tcl package.  This
+# must be a fixed relative path below the library install location and
+# is therefore not settable by parent projects.
+SET(VTK_INSTALL_TCL_DIR
+  ${VTK_INSTALL_LIB_DIR}/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}
+  )
+
+IF(NOT VTK_INSTALL_JAVA_DIR)
+  SET(VTK_INSTALL_JAVA_DIR ${VTK_INSTALL_PACKAGE_DIR}/java)
+ENDIF(NOT VTK_INSTALL_JAVA_DIR)
+
+# Choose a default CMAKE_INSTALL_PREFIX on Windows.  CMake 2.2 and
+# above already choose a good default, so force a change only if the
+# current value looks like the CMake 2.0 default.
+IF(NOT UNIX)
+  IF(CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
+    IF("$ENV{ProgramFiles}" MATCHES "^$")
+      IF("$ENV{SystemDrive}" MATCHES "^$")
+        SET(VTK_GENERIC_PROGRAM_FILES "C:/Program Files")
+      ELSE("$ENV{SystemDrive}" MATCHES "^$")
+        SET(VTK_GENERIC_PROGRAM_FILES "$ENV{SystemDrive}/Program Files")
+      ENDIF("$ENV{SystemDrive}" MATCHES "^$")
+    ELSE("$ENV{ProgramFiles}" MATCHES "^$")
+      SET(VTK_GENERIC_PROGRAM_FILES "$ENV{ProgramFiles}")
+    ENDIF("$ENV{ProgramFiles}" MATCHES "^$")
+    SET(CMAKE_INSTALL_PREFIX
+      "${VTK_GENERIC_PROGRAM_FILES}/${PROJECT_NAME}"
+      CACHE PATH "Install path prefix, prepended onto install directories."
+      FORCE)
+    SET(VTK_GENERIC_SYSTEM_DRIVE)
+  ENDIF(CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
+  MARK_AS_ADVANCED(CLEAR CMAKE_INSTALL_PREFIX)
+ENDIF(NOT UNIX)
+
+# There are three basic components to the VTK installation: runtime,
+# development, and documentation.  Install rules for each component
+# are surrounded by blockers.  Parent projects or users can specify
+# VTK_INSTALL_NO_RUNTIME, VTK_INSTALL_NO_DEVELOPMENT, or
+# VTK_INSTALL_NO_DOCUMENTATION to avoid installation of the
+# corresponding component.
+
+# Shared libraries are considered both runtime and development and
+# static libraries are considered development only.  In order to
+# switch library installation on and off correctly we make the
+# decision here.
+SET(VTK_INSTALL_NO_LIBRARIES)
+IF(BUILD_SHARED_LIBS)
+  IF(VTK_INSTALL_NO_RUNTIME AND VTK_INSTALL_NO_DEVELOPMENT)
+    SET(VTK_INSTALL_NO_LIBRARIES 1)
+  ENDIF(VTK_INSTALL_NO_RUNTIME AND VTK_INSTALL_NO_DEVELOPMENT)
+ELSE(BUILD_SHARED_LIBS)
+  IF(VTK_INSTALL_NO_DEVELOPMENT)
+    SET(VTK_INSTALL_NO_LIBRARIES 1)
+  ENDIF(VTK_INSTALL_NO_DEVELOPMENT)
+ENDIF(BUILD_SHARED_LIBS)
+
+#-----------------------------------------------------------------------------
+# Save the compiler settings so another project can import them.
+CMAKE_EXPORT_BUILD_SETTINGS(${VTK_BINARY_DIR}/VTKBuildSettings.cmake)
+IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+  INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR} .cmake VTKBuildSettings)
+ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+
+#-----------------------------------------------------------------------------
+# Provide compatibility options.
+OPTION(VTK_LEGACY_REMOVE "Remove all legacy code completely." OFF)
+OPTION(VTK_LEGACY_SILENT "Silence all legacy code messages." OFF)
+MARK_AS_ADVANCED(VTK_LEGACY_REMOVE VTK_LEGACY_SILENT)
+
+#-----------------------------------------------------------------------------
+# Determine the set of VTK kits that should be built.
+OPTION(VTK_USE_RENDERING "Build the vtkRendering kit.  Needed for displaying data or using widgets." ON)
+VTK_DEPENDENT_OPTION(VTK_USE_PARALLEL "Build the vtkParallel kit." OFF
+                     "VTK_USE_RENDERING" OFF)
+
+# Determine GUI Support.
+VTK_DEPENDENT_OPTION(VTK_USE_GUISUPPORT "Build VTK with GUI Support" OFF
+                     "VTK_USE_RENDERING" OFF)
+MARK_AS_ADVANCED(VTK_USE_GUISUPPORT)
+
+# Remove old options from an existing cache.
+IF("VTK_USE_HYBRID" MATCHES "^VTK_USE_HYBRID$")
+ELSE("VTK_USE_HYBRID" MATCHES "^VTK_USE_HYBRID$")
+  SET(VTK_USE_HYBRID "" CACHE INTERNAL "Hiding old option")
+ENDIF("VTK_USE_HYBRID" MATCHES "^VTK_USE_HYBRID$")
+IF("VTK_USE_PATENTED" MATCHES "^VTK_USE_PATENTED$")
+ELSE("VTK_USE_PATENTED" MATCHES "^VTK_USE_PATENTED$")
+  SET(VTK_USE_PATENTED "" CACHE INTERNAL "Hiding old option")
+ENDIF("VTK_USE_PATENTED" MATCHES "^VTK_USE_PATENTED$")
+IF("VTK_USE_VOLUMERENDERING" MATCHES "^VTK_USE_VOLUMERENDERING$")
+ELSE("VTK_USE_VOLUMERENDERING" MATCHES "^VTK_USE_VOLUMERENDERING$")
+  SET(VTK_USE_VOLUMERENDERING "" CACHE INTERNAL "Hiding old option")
+ENDIF("VTK_USE_VOLUMERENDERING" MATCHES "^VTK_USE_VOLUMERENDERING$")
+
+SET(VTK_KITS COMMON FILTERING IO GRAPHICS GENERIC_FILTERING IMAGING)
+IF(VTK_USE_RENDERING)
+  SET(VTK_KITS ${VTK_KITS} RENDERING)
+  SET(VTK_KITS ${VTK_KITS} VOLUMERENDERING)
+  SET(VTK_KITS ${VTK_KITS} HYBRID)
+  SET(VTK_KITS ${VTK_KITS} WIDGETS)
+ENDIF(VTK_USE_RENDERING)
+IF(VTK_USE_PARALLEL)
+  SET(VTK_KITS ${VTK_KITS} PARALLEL)
+ENDIF(VTK_USE_PARALLEL)
+
+# from GUISupport
+IF(VTK_USE_QVTK)
+  SET(VTK_KITS ${VTK_KITS} QVTK)
+ENDIF(VTK_USE_QVTK)
+IF(VTK_USE_MFC)
+  SET(VTK_KITS ${VTK_KITS} MFC)
+ENDIF(VTK_USE_MFC)
+
+
+#-----------------------------------------------------------------------------
+# Determine GUI.
+FIND_PACKAGE(X11)
+SET(VTK_USE_X_OPTIONAL 0)
+SET(VTK_USE_X_FORCE 0)
+IF(X11_FOUND)
+  IF(CYGWIN)
+    SET(VTK_USE_X_OPTIONAL 1)
+  ENDIF(CYGWIN)
+  IF(APPLE)
+    SET(VTK_USE_X_OPTIONAL 1)
+  ELSE(APPLE)
+    SET(VTK_USE_X_FORCE ${VTK_USE_RENDERING})
+  ENDIF(APPLE)
+ENDIF(X11_FOUND)
+
+VTK_DEPENDENT_OPTION(VTK_USE_CARBON "Build classes using Carbon API." ON
+                     "APPLE;VTK_USE_RENDERING" OFF)
+VTK_DEPENDENT_OPTION(VTK_USE_COCOA "Build classes using Cocoa API." OFF
+                     "APPLE;VTK_USE_RENDERING" OFF)
+VTK_DEPENDENT_OPTION(VTK_USE_X
+                     "Build classes for the X11 window system." OFF
+                     "X11_FOUND;VTK_USE_RENDERING;VTK_USE_X_OPTIONAL"
+                     "${VTK_USE_X_FORCE}")
+
+IF(VTK_USE_CARBON AND VTK_USE_COCOA)
+  MESSAGE(SEND_ERROR "Only one of VTK_USE_CARBON and VTK_USE_COCOA may be ON.")
+  SET(VTK_USE_CARBON 0)
+  SET(VTK_USE_COCOA 0)
+ENDIF(VTK_USE_CARBON AND VTK_USE_COCOA)
+
+#-----------------------------------------------------------------------------
+# VTK requires special compiler flags on some platforms.
+SET(VTK_REQUIRED_C_FLAGS)
+SET(VTK_REQUIRED_CXX_FLAGS)
+
+# make sure Crun is linked in with the native compiler, it is
+# not used by default for shared libraries and is required for
+# things like java to work.
+IF(CMAKE_SYSTEM MATCHES "SunOS.*")
+  IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+    FIND_LIBRARY(VTK_SUNCC_CRUN_LIBRARY Crun /opt/SUNWspro/lib)
+    IF(VTK_SUNCC_CRUN_LIBRARY)
+      LINK_LIBRARIES(${VTK_SUNCC_CRUN_LIBRARY})
+    ENDIF(VTK_SUNCC_CRUN_LIBRARY)
+    FIND_LIBRARY(VTK_SUNCC_CSTD_LIBRARY Cstd /opt/SUNWspro/lib)
+    IF(VTK_SUNCC_CSTD_LIBRARY)
+      LINK_LIBRARIES(${VTK_SUNCC_CSTD_LIBRARY})
+    ENDIF(VTK_SUNCC_CSTD_LIBRARY)
+  ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
+
+IF(CMAKE_COMPILER_IS_GNUCXX)
+  # A GCC compiler.  Quiet warning about strstream deprecation.
+  SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -Wno-deprecated")
+  IF(WIN32)
+    # The platform is gcc on cygwin.
+    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mwin32")
+    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mwin32")
+  ENDIF(WIN32)
+  IF(MINGW)
+    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mthreads")
+    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mthreads")
+    SET(VTK_REQUIRED_EXE_LINKER_FLAGS "${VTK_REQUIRED_EXE_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
+    SET(VTK_REQUIRED_SHARED_LINKER_FLAGS "${VTK_REQUIRED_SHARED_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
+    SET(VTK_REQUIRED_MODULE_LINKER_FLAGS "${VTK_REQUIRED_MODULE_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
+    LINK_LIBRARIES(-lgdi32)
+  ENDIF(MINGW)
+  IF(CMAKE_SYSTEM MATCHES "SunOS.*")
+    # Disable warnings that occur in X11 headers.
+    IF(DART_ROOT AND BUILD_TESTING)
+      SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -Wno-unknown-pragmas")
+      SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -Wno-unknown-pragmas")
+    ENDIF(DART_ROOT AND BUILD_TESTING)
+  ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
+ELSE(CMAKE_COMPILER_IS_GNUCXX)
+  IF(CMAKE_ANSI_CFLAGS)
+    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
+  ENDIF(CMAKE_ANSI_CFLAGS)
+  IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+     SET(VTK_REQUIRED_CXX_FLAGS
+         "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include")
+  ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+  IF(CMAKE_SYSTEM MATCHES "IRIX.*")
+    SET(VTK_REQUIRED_CXX_FLAGS
+      "${VTK_REQUIRED_CXX_FLAGS} -Wl,-woff84 -woff 15 -woff 84 -woff 3439 -woff 1424 -woff 3201")
+    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -woff 3439")
+  ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*")
+  #silence duplicate symbol warnings on AIX
+  IF(CMAKE_SYSTEM MATCHES "AIX.*")
+    SET(VTK_REQUIRED_EXE_LINKER_FLAGS "${VTK_REQUIRED_EXE_LINKER_FLAGS} -bhalt:5")
+    SET(VTK_REQUIRED_SHARED_LINKER_FLAGS "${VTK_REQUIRED_SHARED_LINKER_FLAGS} -bhalt:5")
+    SET(VTK_REQUIRED_MODULE_LINKER_FLAGS "${VTK_REQUIRED_MODULE_LINKER_FLAGS} -bhalt:5")
+  ENDIF(CMAKE_SYSTEM MATCHES "AIX.*")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
+IF(APPLE)
+  SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -Wl,-flat_namespace,-U,_environ")
+  SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -Wl,-flat_namespace,-U,_environ")
+  IF(CMAKE_COMPILER_IS_GNUCXX)
+    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -no-cpp-precomp")
+    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -no-cpp-precomp")
+    IF(VTK_USE_CARBON)
+      SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -fpascal-strings")
+    ENDIF(VTK_USE_CARBON)
+  ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+ENDIF(APPLE)
+
+IF(UNIX)
+  IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+    INCLUDE(${VTK_SOURCE_DIR}/CMake/TestNO_ICC_IDYNAMIC_NEEDED.cmake)
+    TESTNO_ICC_IDYNAMIC_NEEDED(NO_ICC_IDYNAMIC_NEEDED ${VTK_SOURCE_DIR}/CMake)
+    IF(NO_ICC_IDYNAMIC_NEEDED)
+      SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS}")
+    ELSE(NO_ICC_IDYNAMIC_NEEDED)
+      SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -i_dynamic")
+    ENDIF(NO_ICC_IDYNAMIC_NEEDED)
+  ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ENDIF(UNIX)
+
+IF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake|VCExpress)")
+  # Use the highest warning level for visual studio.
+  SET(CMAKE_CXX_WARNING_LEVEL 4)
+  IF(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+    STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+  ELSE(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
+  ENDIF(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+  # Disable deprecation warnings for standard C and STL functions in VS2005
+  # and later
+  IF(CMAKE_COMPILER_2005)
+    ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
+    ADD_DEFINITIONS(-D_SCL_SECURE_NO_DEPRECATE)
+  ENDIF(CMAKE_COMPILER_2005) 
+ENDIF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake|VCExpress)")
+
+# Tell VTK source files they are being built inside VTK.
+ADD_DEFINITIONS(-DVTK_IN_VTK)
+
+#-----------------------------------------------------------------------------
+# Add compiler flags VTK needs to work on this platform.  This must be
+# done after the call to CMAKE_EXPORT_BUILD_SETTINGS, but before any
+# try-compiles are done.
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${VTK_REQUIRED_EXE_LINKER_FLAGS}")
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${VTK_REQUIRED_SHARED_LINKER_FLAGS}")
+SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${VTK_REQUIRED_MODULE_LINKER_FLAGS}")
+
+# The Borland implib tool is used by CMake to generate the .lib export
+# file from a .dll.  CMake 2.0 and earlier did not add the "-c" option
+# to specify that the exported symbols should be case sensitive.  Add
+# the flag now if it is not there.
+IF(BORLAND)
+  STRING(REGEX REPLACE "implib -w" "implib -c -w"
+    CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+ENDIF(BORLAND)
+
+#-----------------------------------------------------------------------------
+# Platform configuration tests.
+INCLUDE(${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
+INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIStreamHeaders.cmake)
+INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
+INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake)
+INCLUDE(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
+
+# Simulate old CMakeBackwardCompatibilityCXX test.
+# In CMake 2.4 and up this could be just
+# INCLUDE(${CMAKE_ROOT}/Modules/TestForSSTREAM.cmake)
+INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
+CHECK_INCLUDE_FILE_CXX("sstream" CMAKE_HAS_ANSI_STRING_STREAM)
+IF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
+  SET(CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL
+    "Does the compiler support sstream or stringstream.")
+ENDIF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
+
+SET(VTK_SIZEOF_CHAR   ${CMAKE_SIZEOF_CHAR})
+SET(VTK_SIZEOF_DOUBLE ${CMAKE_SIZEOF_DOUBLE})
+SET(VTK_SIZEOF_FLOAT  ${CMAKE_SIZEOF_FLOAT})
+SET(VTK_SIZEOF_INT    ${CMAKE_SIZEOF_INT})
+SET(VTK_SIZEOF_LONG   ${CMAKE_SIZEOF_LONG})
+SET(VTK_SIZEOF_SHORT  ${CMAKE_SIZEOF_SHORT})
+CHECK_TYPE_SIZE("long long" VTK_SIZEOF_LONG_LONG)
+CHECK_TYPE_SIZE("__int64"   VTK_SIZEOF___INT64)
+
+IF(VTK_SIZEOF___INT64)
+  IF("VTK_TYPE_SAME_LONG_AND___INT64" MATCHES "^VTK_TYPE_SAME_LONG_AND___INT64$")
+    MESSAGE(STATUS "Checking whether long and __int64 are the same type")
+    TRY_COMPILE(VTK_TYPE_SAME_LONG_AND___INT64
+      ${VTK_BINARY_DIR}/CMakeTmp
+      ${VTK_SOURCE_DIR}/CMake/vtkTestCompareTypes.cxx
+      COMPILE_DEFINITIONS
+      -DVTK_TEST_COMPARE_TYPE_1=long
+      -DVTK_TEST_COMPARE_TYPE_2=__int64
+      OUTPUT_VARIABLE OUTPUT)
+    IF(VTK_TYPE_SAME_LONG_AND___INT64)
+      MESSAGE(STATUS "Checking whether long and __int64 are the same type -- yes")
+      SET(VTK_TYPE_SAME_LONG_AND___INT64 1 CACHE INTERNAL "Whether long and __int64 are the same type")
+      WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+        "Determining whether long and __int64 are the same type "
+        "passed with the following output:\n"
+        "${OUTPUT}\n" APPEND)
+    ELSE(VTK_TYPE_SAME_LONG_AND___INT64)
+      MESSAGE(STATUS "Checking whether long and __int64 are the same type -- no")
+      SET(VTK_TYPE_SAME_LONG_AND___INT64 0 CACHE INTERNAL "Whether long and __int64 are the same type")
+      WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+        "Determining whether long and __int64 are the same type "
+        "failed with the following output:\n"
+        "${OUTPUT}\n" APPEND)
+    ENDIF(VTK_TYPE_SAME_LONG_AND___INT64)
+  ENDIF("VTK_TYPE_SAME_LONG_AND___INT64" MATCHES "^VTK_TYPE_SAME_LONG_AND___INT64$")
+  IF(VTK_SIZEOF_LONG_LONG)
+    IF("VTK_TYPE_SAME_LONG_LONG_AND___INT64" MATCHES "^VTK_TYPE_SAME_LONG_LONG_AND___INT64$")
+      MESSAGE(STATUS "Checking whether long long and __int64 are the same type")
+      TRY_COMPILE(VTK_TYPE_SAME_LONG_LONG_AND___INT64
+        ${VTK_BINARY_DIR}/CMakeTmp
+        ${VTK_SOURCE_DIR}/CMake/vtkTestCompareTypes.cxx
+        COMPILE_DEFINITIONS
+        -DVTK_TEST_COMPARE_TYPE_1=TYPE_LONG_LONG
+        -DVTK_TEST_COMPARE_TYPE_2=__int64
+        OUTPUT_VARIABLE OUTPUT)
+      IF(VTK_TYPE_SAME_LONG_LONG_AND___INT64)
+        MESSAGE(STATUS "Checking whether long long and __int64 are the same type -- yes")
+        SET(VTK_TYPE_SAME_LONG_LONG_AND___INT64 1 CACHE INTERNAL "Whether long long and __int64 are the same type")
+        WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+          "Determining whether long long and __int64 are the same type "
+          "passed with the following output:\n"
+          "${OUTPUT}\n" APPEND)
+      ELSE(VTK_TYPE_SAME_LONG_LONG_AND___INT64)
+        MESSAGE(STATUS "Checking whether long long and __int64 are the same type -- no")
+        SET(VTK_TYPE_SAME_LONG_LONG_AND___INT64 0 CACHE INTERNAL "Whether long long and __int64 are the same type")
+        WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+          "Determining whether long long and __int64 are the same type "
+          "failed with the following output:\n"
+          "${OUTPUT}\n" APPEND)
+      ENDIF(VTK_TYPE_SAME_LONG_LONG_AND___INT64)
+    ENDIF("VTK_TYPE_SAME_LONG_LONG_AND___INT64" MATCHES "^VTK_TYPE_SAME_LONG_LONG_AND___INT64$")
+  ENDIF(VTK_SIZEOF_LONG_LONG)
+  IF(NOT VTK_TYPE_SAME_LONG_AND___INT64)
+    IF(NOT VTK_TYPE_SAME_LONG_LONG_AND___INT64)
+      #  VS 6 cannot convert unsigned __int64 to double unless the
+      # "Visual C++ Processor Pack" is installed.
+      IF("VTK_TYPE_CONVERT_UI64_TO_DOUBLE" MATCHES "^VTK_TYPE_CONVERT_UI64_TO_DOUBLE$")
+        MESSAGE(STATUS "Checking whether unsigned __int64 can convert to double")
+        TRY_COMPILE(VTK_TYPE_CONVERT_UI64_TO_DOUBLE
+          ${VTK_BINARY_DIR}/CMakeTmp
+          ${VTK_SOURCE_DIR}/CMake/vtkTestConvertTypes.cxx
+          COMPILE_DEFINITIONS
+          -DVTK_TEST_CONVERT_TYPE_FROM=TYPE_UNSIGNED___INT64
+          -DVTK_TEST_CONVERT_TYPE_TO=double
+          OUTPUT_VARIABLE OUTPUT)
+        IF(VTK_TYPE_CONVERT_UI64_TO_DOUBLE)
+          MESSAGE(STATUS "Checking whether unsigned __int64 can convert to double -- yes")
+          SET(VTK_TYPE_CONVERT_UI64_TO_DOUBLE 1 CACHE INTERNAL "Whether unsigned __int64 can convert to double")
+          WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+            "Determining whether unsigned __int64 can convert to double "
+            "passed with the following output:\n"
+            "${OUTPUT}\n" APPEND)
+        ELSE(VTK_TYPE_CONVERT_UI64_TO_DOUBLE)
+          MESSAGE(STATUS "Checking whether unsigned __int64 can convert to double -- no")
+          SET(VTK_TYPE_CONVERT_UI64_TO_DOUBLE 0 CACHE INTERNAL "Whether unsigned __int64 can convert to double")
+          WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+            "Determining whether unsigned __int64 can convert to double "
+            "failed with the following output:\n"
+            "${OUTPUT}\n" APPEND)
+        ENDIF(VTK_TYPE_CONVERT_UI64_TO_DOUBLE)
+      ENDIF("VTK_TYPE_CONVERT_UI64_TO_DOUBLE" MATCHES "^VTK_TYPE_CONVERT_UI64_TO_DOUBLE$")
+    ENDIF(NOT VTK_TYPE_SAME_LONG_LONG_AND___INT64)
+  ENDIF(NOT VTK_TYPE_SAME_LONG_AND___INT64)
+ENDIF(VTK_SIZEOF___INT64)
+
+# Enable the "long long" type if it is available.  It is standard in
+# C99 and C++03 but not in earlier standards.
+SET(VTK_TYPE_USE_LONG_LONG)
+IF(VTK_SIZEOF_LONG_LONG)
+  SET(VTK_TYPE_USE_LONG_LONG 1)
+ENDIF(VTK_SIZEOF_LONG_LONG)
+
+# Enable the "__int64" type if it is available and unique.  It is not
+# standard.
+SET(VTK_TYPE_USE___INT64)
+IF(VTK_SIZEOF___INT64)
+  IF(NOT VTK_TYPE_SAME_LONG_AND___INT64)
+    IF(NOT VTK_TYPE_SAME_LONG_LONG_AND___INT64)
+      SET(VTK_TYPE_USE___INT64 1)
+    ENDIF(NOT VTK_TYPE_SAME_LONG_LONG_AND___INT64)
+  ENDIF(NOT VTK_TYPE_SAME_LONG_AND___INT64)
+ENDIF(VTK_SIZEOF___INT64)
+
+IF("VTK_COMPILER_HAS_BOOL" MATCHES "^VTK_COMPILER_HAS_BOOL$")
+  MESSAGE(STATUS "Checking support for C++ type bool")
+  TRY_COMPILE(VTK_COMPILER_HAS_BOOL
+              ${VTK_BINARY_DIR}/CMakeTmp/Bool
+              ${VTK_SOURCE_DIR}/CMake/vtkTestBoolType.cxx
+              OUTPUT_VARIABLE OUTPUT)
+  IF(VTK_COMPILER_HAS_BOOL)
+    MESSAGE(STATUS "Checking support for C++ type bool -- yes")
+    SET(VTK_COMPILER_HAS_BOOL 1 CACHE INTERNAL "Support for C++ type bool")
+    WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+      "Determining if the C++ compiler supports type bool "
+      "passed with the following output:\n"
+      "${OUTPUT}\n" APPEND)
+  ELSE(VTK_COMPILER_HAS_BOOL)
+    MESSAGE(STATUS "Checking support for C++ type bool -- no")
+    SET(VTK_COMPILER_HAS_BOOL 0 CACHE INTERNAL "Support for C++ type bool")
+    WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+      "Determining if the C++ compiler supports type bool "
+      "failed with the following output:\n"
+      "${OUTPUT}\n" APPEND)
+  ENDIF(VTK_COMPILER_HAS_BOOL)
+ENDIF("VTK_COMPILER_HAS_BOOL" MATCHES "^VTK_COMPILER_HAS_BOOL$")
+
+IF("VTK_COMPILER_HAS_FULL_SPECIALIZATION" MATCHES "^VTK_COMPILER_HAS_FULL_SPECIALIZATION$")
+  MESSAGE(STATUS "Checking support for full template specialization syntax")
+  TRY_COMPILE(VTK_COMPILER_HAS_FULL_SPECIALIZATION
+              ${VTK_BINARY_DIR}/CMakeTmp
+              ${VTK_SOURCE_DIR}/CMake/vtkTestFullSpecialization.cxx
+              OUTPUT_VARIABLE OUTPUT)
+  IF(VTK_COMPILER_HAS_FULL_SPECIALIZATION)
+    MESSAGE(STATUS "Checking support for full template specialization syntax -- yes")
+    SET(VTK_COMPILER_HAS_FULL_SPECIALIZATION 1 CACHE INTERNAL "Support for full template specialization syntax")
+    WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+      "Determining if the C++ compiler supports full template specialization syntax "
+      "passed with the following output:\n"
+      "${OUTPUT}\n" APPEND)
+  ELSE(VTK_COMPILER_HAS_FULL_SPECIALIZATION)
+    MESSAGE(STATUS "Checking support for full template specialization syntax -- no")
+    SET(VTK_COMPILER_HAS_FULL_SPECIALIZATION 0 CACHE INTERNAL "Support for full template specialization syntax")
+    WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+      "Determining if the C++ compiler supports full template specialization syntax "
+      "failed with the following output:\n"
+      "${OUTPUT}\n" APPEND)
+  ENDIF(VTK_COMPILER_HAS_FULL_SPECIALIZATION)
+ENDIF("VTK_COMPILER_HAS_FULL_SPECIALIZATION" MATCHES "^VTK_COMPILER_HAS_FULL_SPECIALIZATION$")
+
+IF("VTK_TYPE_CHAR_IS_SIGNED" MATCHES "^VTK_TYPE_CHAR_IS_SIGNED$")
+  MESSAGE(STATUS "Checking signedness of char")
+  TRY_RUN(VTK_TYPE_CHAR_IS_SIGNED VTK_TYPE_CHAR_IS_SIGNED_COMPILED
+          ${VTK_BINARY_DIR}/CMakeTmp/Char
+          ${VTK_SOURCE_DIR}/CMake/vtkTestCharSignedness.cxx)
+  IF(VTK_TYPE_CHAR_IS_SIGNED_COMPILED)
+    IF(VTK_TYPE_CHAR_IS_SIGNED)
+      MESSAGE(STATUS "Checking signedness of char -- signed")
+      SET(VTK_TYPE_CHAR_IS_SIGNED 1 CACHE INTERNAL "Whether char is signed.")
+    ELSE(VTK_TYPE_CHAR_IS_SIGNED)
+      MESSAGE(STATUS "Checking signedness of char -- unsigned")
+      SET(VTK_TYPE_CHAR_IS_SIGNED 0 CACHE INTERNAL "Whether char is signed.")
+    ENDIF(VTK_TYPE_CHAR_IS_SIGNED)
+  ELSE(VTK_TYPE_CHAR_IS_SIGNED_COMPILED)
+    MESSAGE(STATUS "Checking signedness of char -- failed")
+  ENDIF(VTK_TYPE_CHAR_IS_SIGNED_COMPILED)
+ENDIF("VTK_TYPE_CHAR_IS_SIGNED" MATCHES "^VTK_TYPE_CHAR_IS_SIGNED$")
+
+INCLUDE(Parallel/VTKParallelCMakeTests.cmake)
+
+# Check for explicit template instantiation support by compiler.
+INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkTestExplicitInstantiation.cmake)
+
+# Setup clean configuration of vtkConfigure.h and vtkToolkits.h.
+MACRO(VTK_PREPARE_CMAKEDEFINE not invar outvar)
+  IF(${not} ${invar})
+    SET(${outvar} 1)
+  ELSE(${not} ${invar})
+    SET(${outvar})
+  ENDIF(${not} ${invar})
+ENDMACRO(VTK_PREPARE_CMAKEDEFINE)
+VTK_PREPARE_CMAKEDEFINE("" CMAKE_WORDS_BIGENDIAN VTK_WORDS_BIGENDIAN)
+VTK_PREPARE_CMAKEDEFINE("" CMAKE_USE_PTHREADS VTK_USE_PTHREADS)
+VTK_PREPARE_CMAKEDEFINE("" CMAKE_USE_SPROC VTK_USE_SPROC)
+VTK_PREPARE_CMAKEDEFINE("" CMAKE_HP_PTHREADS VTK_HP_PTHREADS)
+VTK_PREPARE_CMAKEDEFINE("" CMAKE_USE_WIN32_THREADS VTK_USE_WIN32_THREADS)
+VTK_PREPARE_CMAKEDEFINE("" CMAKE_NO_ANSI_STRING_STREAM VTK_NO_ANSI_STRING_STREAM)
+VTK_PREPARE_CMAKEDEFINE("" CMAKE_NO_STD_NAMESPACE VTK_NO_STD_NAMESPACE)
+VTK_PREPARE_CMAKEDEFINE(NOT CMAKE_ANSI_FOR_SCOPE VTK_NO_FOR_SCOPE)
+VTK_PREPARE_CMAKEDEFINE(NOT VTK_EXPLICIT_TEMPLATES
+                  VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
+VTK_PREPARE_CMAKEDEFINE(NOT VTK_COMPILER_HAS_FULL_SPECIALIZATION
+                        VTK_NO_FULL_TEMPLATE_SPECIALIZATION)
+
+#-----------------------------------------------------------------------------
+# Include file dependency tracking regular expression.
+SET(VTK_REGEX "vtk[^.]*\\.([^t]|t[^x]|tx[^x]|cxx|hxx)")
+IF(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
+  # Track all .txx file dependencies.
+  SET(VTK_REGEX_TXX "vtk[^.]*\\.txx")
+ELSE(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
+  # Track all .txx file dependencies except *Implicit.txx files.
+  SET(VTK_REGEX_TXX "vtk[^.]*([^t]|[^i]t|[^c]it|[^i]cit|[^l]icit|[^p]licit|[^m]plicit|[^I]mplicit)\\.txx")
+ENDIF(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
+INCLUDE_REGULAR_EXPRESSION("^((lex|png|j|z|t|D).*|${VTK_REGEX}|${VTK_REGEX_TXX})$")
+
+#-----------------------------------------------------------------------------
+# 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_JAVA "Wrap VTK classes into the Java language." OFF)
+
+# Python requires shared libraries.
+IF(VTK_WRAP_PYTHON)
+  IF(NOT BUILD_SHARED_LIBS)
+    MESSAGE(SEND_ERROR "VTK_WRAP_PYTHON requires BUILD_SHARED_LIBS to be ON.")
+    SET(VTK_WRAP_PYTHON 0)
+  ENDIF(NOT BUILD_SHARED_LIBS)
+ENDIF(VTK_WRAP_PYTHON)
+
+# Java requires shared libraries on Windows.
+IF(VTK_WRAP_JAVA)
+  IF(WIN32)
+    IF(NOT BUILD_SHARED_LIBS)
+      MESSAGE(SEND_ERROR "VTK_WRAP_JAVA requires BUILD_SHARED_LIBS to be ON.")
+      SET(VTK_WRAP_JAVA 0)
+    ENDIF(NOT BUILD_SHARED_LIBS)
+  ENDIF(WIN32)
+ENDIF(VTK_WRAP_JAVA)
+
+SET(VTK_LANGUAGES "")
+IF(VTK_WRAP_TCL)
+  SET(VTK_LANGUAGES ${VTK_LANGUAGES} TCL)
+ENDIF(VTK_WRAP_TCL)
+IF(VTK_WRAP_PYTHON)
+  SET(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON)
+ENDIF(VTK_WRAP_PYTHON)
+IF(VTK_WRAP_JAVA)
+  SET(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA)
+ENDIF(VTK_WRAP_JAVA)
+
+#-----------------------------------------------------------------------------
+# Load the VTK CMake extension modules.  This must be done after the
+# wrapping language selection.
+
+# Import the VTK_COMPILE_CMAKE_EXTENSIONS and VTK_LOAD_CMAKE_EXTENSIONS macros
+INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkCompileCMakeExtensions.cmake)
+INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkLoadCMakeExtensions.cmake)
+
+# Compile the extensions into the build tree and load them.
+VTK_COMPILE_CMAKE_EXTENSIONS(${VTK_SOURCE_DIR}/CMake ${VTK_BINARY_DIR}/CMake
+  VTK_CMAKE_EXTENSIONS_COMPILED)
+IF(VTK_CMAKE_EXTENSIONS_COMPILED)
+  VTK_LOAD_CMAKE_EXTENSIONS(${VTK_BINARY_DIR}/CMake)
+ENDIF(VTK_CMAKE_EXTENSIONS_COMPILED)
+
+#-----------------------------------------------------------------------------
+# Configure Dart testing support.
+INCLUDE(${CMAKE_ROOT}/Modules/Dart.cmake)
+MARK_AS_ADVANCED(BUILD_TESTING DART_ROOT TCL_TCLSH)
+IF(BUILD_TESTING)
+  ENABLE_TESTING()
+  CONFIGURE_FILE(${VTK_SOURCE_DIR}/CMake/CTestCustom.ctest.in
+    ${VTK_BINARY_DIR}/CMake/CTestCustom.ctest @ONLY)
+  FILE(WRITE ${VTK_BINARY_DIR}/CTestCustom.cmake
+    "INCLUDE(\"${VTK_BINARY_DIR}/CMake/CTestCustom.ctest\")\n")
+  OPTION(VTK_USE_DISPLAY "Turn this option off and tests will not popup windows" ON)
+  MARK_AS_ADVANCED(VTK_USE_DISPLAY)
+ENDIF(BUILD_TESTING)
+
+SET(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "    try {")
+SET(CMAKE_TESTDRIVER_AFTER_TESTMAIN "    }
+    catch(vtkstd::exception& e)
+      {
+      fprintf(stderr, \"Test driver caught exception: [%s]\\n\", e.what());
+      result = -1;
+      }")
+
+#-----------------------------------------------------------------------------
+# Select a streams library.
+
+INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkSelectStreamsLibrary.cmake)
+VTK_SELECT_STREAMS_LIBRARY(VTK_USE_ANSI_STDLIB ${VTK_SOURCE_DIR})
+
+# Check the severity of EOF bugs in the streams library.
+SET(VTK_TEST_STREAM_EOF_CXX ${VTK_SOURCE_DIR}/CMake/vtkTestStreamEOF.cxx.in)
+CONFIGURE_FILE(${VTK_SOURCE_DIR}/CMake/vtkTestStreamEOF.cxx.in
+  ${VTK_BINARY_DIR}/CMake/vtkTestStreamEOF.cxx @ONLY IMMEDIATE)
+IF(VTK_USE_ANSI_STDLIB)
+  IF("VTK_ANSI_STREAM_EOF_RESULT" MATCHES "^VTK_ANSI_STREAM_EOF_RESULT$")
+    MESSAGE(STATUS "Checking ANSI streams end-of-file bug level")
+    TRY_RUN(VTK_ANSI_STREAM_EOF_RESULT VTK_ANSI_STREAM_EOF_COMPILED
+      ${VTK_BINARY_DIR}/CMakeTmp
+      ${VTK_BINARY_DIR}/CMake/vtkTestStreamEOF.cxx)
+    IF(VTK_ANSI_STREAM_EOF_COMPILED)
+      MESSAGE(STATUS "Checking ANSI streams end-of-file bug level - ${VTK_ANSI_STREAM_EOF_RESULT}")
+    ELSE(VTK_ANSI_STREAM_EOF_COMPILED)
+      SET(VTK_ANSI_STREAM_EOF_RESULT 0)
+      MESSAGE(STATUS "Checking ANSI streams end-of-file bug level - failed to compile test")
+    ENDIF(VTK_ANSI_STREAM_EOF_COMPILED)
+  ENDIF("VTK_ANSI_STREAM_EOF_RESULT" MATCHES "^VTK_ANSI_STREAM_EOF_RESULT$")
+  SET(VTK_STREAM_EOF_SEVERITY ${VTK_ANSI_STREAM_EOF_RESULT})
+ELSE(VTK_USE_ANSI_STDLIB)
+  IF("VTK_OLD_STREAM_EOF_RESULT" MATCHES "^VTK_OLD_STREAM_EOF_RESULT$")
+    MESSAGE(STATUS "Checking old streams end-of-file bug level")
+    TRY_RUN(VTK_OLD_STREAM_EOF_RESULT VTK_OLD_STREAM_EOF_COMPILED
+      ${VTK_BINARY_DIR}/CMakeTmp
+      ${VTK_BINARY_DIR}/CMake/vtkTestStreamEOF.cxx)
+    IF(VTK_OLD_STREAM_EOF_COMPILED)
+      MESSAGE(STATUS "Checking old streams end-of-file bug level - ${VTK_OLD_STREAM_EOF_RESULT}")
+    ELSE(VTK_OLD_STREAM_EOF_COMPILED)
+      SET(VTK_OLD_STREAM_EOF_RESULT 0)
+      MESSAGE(STATUS "Checking old streams end-of-file bug level - failed to compile test")
+    ENDIF(VTK_OLD_STREAM_EOF_COMPILED)
+  ENDIF("VTK_OLD_STREAM_EOF_RESULT" MATCHES "^VTK_OLD_STREAM_EOF_RESULT$")
+  SET(VTK_STREAM_EOF_SEVERITY ${VTK_OLD_STREAM_EOF_RESULT})
+ENDIF(VTK_USE_ANSI_STDLIB)
+
+IF(VTK_SIZEOF_LONG_LONG)
+  CONFIGURE_FILE(${VTK_SOURCE_DIR}/CMake/vtkTestStreamLongLong.cxx.in
+    ${VTK_BINARY_DIR}/CMake/vtkTestStreamLongLong.cxx @ONLY IMMEDIATE)
+  IF("VTK_OSTREAM_SUPPORTS_LONG_LONG" MATCHES "^VTK_OSTREAM_SUPPORTS_LONG_LONG$")
+    MESSAGE(STATUS "Checking if ostream supports long long")
+    TRY_COMPILE(VTK_OSTREAM_SUPPORTS_LONG_LONG
+      ${VTK_BINARY_DIR}
+      ${VTK_BINARY_DIR}/CMake/vtkTestStreamLongLong.cxx
+      COMPILE_DEFINITIONS -DVTK_TEST_OSTREAM_LONG_LONG
+      OUTPUT_VARIABLE OUTPUT)
+    IF(VTK_OSTREAM_SUPPORTS_LONG_LONG)
+      MESSAGE(STATUS "Checking if ostream supports long long -- yes")
+      SET(VTK_OSTREAM_SUPPORTS_LONG_LONG 1 CACHE INTERNAL "Whether ostream supports long long")
+      WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+        "Determining if ostream supports long long "
+        "passed with the following output:\n"
+        "${OUTPUT}\n" APPEND)
+    ELSE(VTK_OSTREAM_SUPPORTS_LONG_LONG)
+      MESSAGE(STATUS "Checking if ostream supports long long -- no")
+      SET(VTK_OSTREAM_SUPPORTS_LONG_LONG 0 CACHE INTERNAL "Whether ostream supports long long")
+      WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+        "Determining if ostream supports long long "
+        "failed with the following output:\n"
+        "${OUTPUT}\n" APPEND)
+    ENDIF(VTK_OSTREAM_SUPPORTS_LONG_LONG)
+  ENDIF("VTK_OSTREAM_SUPPORTS_LONG_LONG" MATCHES "^VTK_OSTREAM_SUPPORTS_LONG_LONG$")
+  IF("VTK_ISTREAM_SUPPORTS_LONG_LONG" MATCHES "^VTK_ISTREAM_SUPPORTS_LONG_LONG$")
+    MESSAGE(STATUS "Checking if istream supports long long")
+    TRY_COMPILE(VTK_ISTREAM_SUPPORTS_LONG_LONG
+      ${VTK_BINARY_DIR}
+      ${VTK_BINARY_DIR}/CMake/vtkTestStreamLongLong.cxx
+      COMPILE_DEFINITIONS -DVTK_TEST_ISTREAM_LONG_LONG
+      OUTPUT_VARIABLE OUTPUT)
+    IF(VTK_ISTREAM_SUPPORTS_LONG_LONG)
+      MESSAGE(STATUS "Checking if istream supports long long -- yes")
+      SET(VTK_ISTREAM_SUPPORTS_LONG_LONG 1 CACHE INTERNAL "Whether istream supports long long")
+      WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+        "Determining if istream supports long long "
+        "passed with the following output:\n"
+        "${OUTPUT}\n" APPEND)
+    ELSE(VTK_ISTREAM_SUPPORTS_LONG_LONG)
+      MESSAGE(STATUS "Checking if istream supports long long -- no")
+      SET(VTK_ISTREAM_SUPPORTS_LONG_LONG 0 CACHE INTERNAL "Whether istream supports long long")
+      WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+        "Determining if istream supports long long "
+        "failed with the following output:\n"
+        "${OUTPUT}\n" APPEND)
+    ENDIF(VTK_ISTREAM_SUPPORTS_LONG_LONG)
+  ENDIF("VTK_ISTREAM_SUPPORTS_LONG_LONG" MATCHES "^VTK_ISTREAM_SUPPORTS_LONG_LONG$")
+ENDIF(VTK_SIZEOF_LONG_LONG)
+
+IF(VTK_USE_RENDERING AND WIN32)
+  # Check for vfw32 support
+  IF("VTK_USE_VIDEO_FOR_WINDOWS" MATCHES "^VTK_USE_VIDEO_FOR_WINDOWS$")
+    MESSAGE(STATUS "Checking if vfw32 is available")
+    TRY_COMPILE(VTK_USE_VIDEO_FOR_WINDOWS_DEFAULT
+      ${VTK_BINARY_DIR}/CMakeTmp
+      ${VTK_SOURCE_DIR}/CMake/vtkTestvfw32.cxx
+      CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=vfw32"
+      OUTPUT_VARIABLE OUTPUT)
+    IF(VTK_USE_VIDEO_FOR_WINDOWS_DEFAULT)
+      MESSAGE(STATUS "Checking if vfw32 is available -- yes")
+      OPTION(VTK_USE_VIDEO_FOR_WINDOWS "Enable using Video for Windows (vfw32) for video input and output." ON)
+      WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+        "Checking if vfw32 is available "
+        "passed with the following output:\n"
+        "${OUTPUT}\n" APPEND)
+    ELSE(VTK_USE_VIDEO_FOR_WINDOWS_DEFAULT)
+      MESSAGE(STATUS "Checking if vfw32 is available -- no")
+      OPTION(VTK_USE_VIDEO_FOR_WINDOWS "Enable using Video for Windows (vfw32) for video input and output." OFF)
+      WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+        "Checking if vfw32 is available "
+        "failed with the following output:\n"
+        "${OUTPUT}\n" APPEND)
+    ENDIF(VTK_USE_VIDEO_FOR_WINDOWS_DEFAULT)
+    MARK_AS_ADVANCED(VTK_USE_VIDEO_FOR_WINDOWS)
+  ENDIF("VTK_USE_VIDEO_FOR_WINDOWS" MATCHES "^VTK_USE_VIDEO_FOR_WINDOWS$")
+
+  # Check if vfw32 supports the video capture functions
+  IF(VTK_USE_VIDEO_FOR_WINDOWS)
+    IF("VTK_VFW_SUPPORTS_CAPTURE" MATCHES "^VTK_VFW_SUPPORTS_CAPTURE$")
+      MESSAGE(STATUS "Checking if vfw32 supports video capture")
+      TRY_COMPILE(VTK_VFW_SUPPORTS_CAPTURE
+        ${VTK_BINARY_DIR}/CMakeTmp
+        ${VTK_SOURCE_DIR}/CMake/vtkTestvfw32Capture.cxx
+        CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=vfw32"
+        OUTPUT_VARIABLE OUTPUT)
+      IF(VTK_VFW_SUPPORTS_CAPTURE)
+        MESSAGE(STATUS "Checking if vfw32 supports video capture -- yes")
+        SET(VTK_VFW_SUPPORTS_CAPTURE 1 CACHE INTERNAL "Enable using Video for Windows (vfw32) for video capture.")
+        WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+          "Checking if vfw32 supports video capture "
+          "passed with the following output:\n"
+          "${OUTPUT}\n" APPEND)
+      ELSE(VTK_VFW_SUPPORTS_CAPTURE)
+        MESSAGE(STATUS "Checking if vfw32 supports video capture -- no")
+        SET(VTK_VFW_SUPPORTS_CAPTURE 0 CACHE INTERNAL "Enable using Video for Windows (vfw32) for video capture.")
+        WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+          "Checking if vfw32 supports video capture "
+          "failed with the following output:\n"
+          "${OUTPUT}\n" APPEND)
+      ENDIF(VTK_VFW_SUPPORTS_CAPTURE)
+    ENDIF("VTK_VFW_SUPPORTS_CAPTURE" MATCHES "^VTK_VFW_SUPPORTS_CAPTURE$")
+  ELSE(VTK_USE_VIDEO_FOR_WINDOWS)
+    SET(VTK_VFW_SUPPORTS_CAPTURE 0)
+  ENDIF(VTK_USE_VIDEO_FOR_WINDOWS)
+ENDIF(VTK_USE_RENDERING AND WIN32)
+
+#-----------------------------------------------------------------------------
+# Configure KWSys to be named "vtksys".
+SET(KWSYS_NAMESPACE vtksys)
+SET(KWSYS_USE_Process 1)
+SET(KWSYS_USE_SystemTools 1)
+SET(KWSYS_USE_RegularExpression 1)
+SET(KWSYS_USE_CommandLineArguments 1)
+SET(KWSYS_USE_Base64 1)
+SET(KWSYS_USE_Glob 1)
+SET(KWSYS_HEADER_ROOT ${VTK_BINARY_DIR}/Utilities)
+SET(KWSYS_PROPERTIES_CXX ${VTK_LIBRARY_PROPERTIES})
+IF(NOT VTK_USE_ANSI_STDLIB)
+  SET(KWSYS_IOS_FORCE_OLD 1)
+ENDIF(NOT VTK_USE_ANSI_STDLIB)
+IF(NOT VTK_INSTALL_NO_LIBRARIES)
+  SET(KWSYS_LIBRARY_INSTALL_DIR ${VTK_INSTALL_LIB_DIR})
+ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
+IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+  SET(KWSYS_HEADER_INSTALL_DIR ${VTK_INSTALL_INCLUDE_DIR})
+ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+
+#-----------------------------------------------------------------------------
+# Dispatch the build into the proper subdirectories.
+
+
+SET(VTK_HAS_EXODUS)
+IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.8)
+  SET(VTK_HAS_EXODUS 1)
+ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.8)
+  MESSAGE(STATUS "CMake older than 2.0 detected. NetCDF will be disabled")
+ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.8)
+
+# Utility libraries and executables.
+SUBDIRS(Wrapping Utilities)
+
+# Build the subdirector for each kit.
+
+SUBDIRS(
+  Common
+  Filtering
+  Imaging
+  Graphics
+  GenericFiltering
+  IO)
+IF(VTK_USE_RENDERING)
+  SUBDIRS(Rendering)
+  SUBDIRS(VolumeRendering)
+  SUBDIRS(Hybrid)
+  SUBDIRS(Widgets)
+ENDIF(VTK_USE_RENDERING)
+IF(VTK_USE_PARALLEL)
+  SUBDIRS(Parallel)
+ENDIF(VTK_USE_PARALLEL)
+IF(VTK_USE_GUISUPPORT)
+  SUBDIRS(GUISupport)
+ENDIF(VTK_USE_GUISUPPORT)
+
+# Wrapping.
+IF(VTK_WRAP_TCL)
+  SUBDIRS(Wrapping/Tcl)
+ENDIF(VTK_WRAP_TCL)
+IF(VTK_WRAP_PYTHON)
+  SUBDIRS(Wrapping/Python)
+ENDIF(VTK_WRAP_PYTHON)
+IF(VTK_WRAP_JAVA)
+  SUBDIRS(Wrapping/Java)
+ENDIF(VTK_WRAP_JAVA)
+
+# Testing.
+IF(BUILD_TESTING)
+  MAKE_DIRECTORY(${VTK_BINARY_DIR}/Testing/Temporary)
+  # Build scripts to convert tcl tests to python
+  SUBDIRS(Utilities/vtkTclTest2Py)
+  SUBDIRS(Common/Testing Filtering/Testing Graphics/Testing GenericFiltering/Testing Imaging/Testing
+          IO/Testing)
+  IF(VTK_USE_RENDERING)
+    SUBDIRS(Rendering/Testing)
+    SUBDIRS(VolumeRendering/Testing)
+    SUBDIRS(Hybrid/Testing)
+    SUBDIRS(Widgets/Testing)
+  ENDIF(VTK_USE_RENDERING)
+  IF(VTK_USE_PARALLEL)
+    SUBDIRS(Parallel/Testing)
+  ENDIF(VTK_USE_PARALLEL)
+ENDIF(BUILD_TESTING)
+
+
+# Include the examples if they are enabled.  Note that the in-tree
+# build adds tests and a custom target to build the examples project
+# in a separate build tree.  The examples are not directly included in
+# the VTK build.  Doing so will not work because they are designed to
+# be built out-of-tree.
+IF(BUILD_EXAMPLES)
+  SET(VTK_CMAKE_VERSION_FOR_EXAMPLES)
+  # The examples tree now requires CMake 2.0.4 or higher.
+  IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.9)
+    IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2.0$")
+      # Have version 2.0.  Check for the Modules/CMakeTestForFreeVC.cxx
+      # file which was added in 2.0.4 (this is a nasty hack).
+      IF(EXISTS ${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx)
+        SET(VTK_CMAKE_VERSION_FOR_EXAMPLES 1)
+      ENDIF(EXISTS ${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx)
+    ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2.0$")
+      # Have version 2.1 or higher.
+      SET(VTK_CMAKE_VERSION_FOR_EXAMPLES 1)
+    ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2.0$")
+  ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.9)
+  IF(VTK_CMAKE_VERSION_FOR_EXAMPLES)
+    SUBDIRS(Examples)
+  ELSE(VTK_CMAKE_VERSION_FOR_EXAMPLES)
+    MESSAGE(
+      "Warning: The BUILD_EXAMPLES option now requires CMake 2.0.4 or higher "
+      "and is being ignored.")
+  ENDIF(VTK_CMAKE_VERSION_FOR_EXAMPLES)
+ENDIF(BUILD_EXAMPLES)
+
+#-----------------------------------------------------------------------------
+# Provide a few configuration options.
+OPTION(BUILD_EXAMPLES "Build VTK examples." OFF)
+OPTION(VTK_USE_64BIT_IDS "Build VTK with 64 bit ids" OFF)
+OPTION(VTK_DEBUG_LEAKS "Build leak checking support into VTK." OFF)
+MARK_AS_ADVANCED(VTK_DEBUG_LEAKS VTK_USE_64BIT_IDS)
+
+VTK_DEPENDENT_OPTION(VTK_USE_MANGLED_MESA "Use mangled Mesa with OpenGL." OFF
+                     "VTK_USE_RENDERING" OFF)
+VTK_DEPENDENT_OPTION(VTK_OPENGL_HAS_OSMESA
+                     "The opengl library being used supports off screen Mesa calls." OFF
+                     "VTK_USE_RENDERING;UNIX" OFF)
+SET(VTK_CAN_DO_OFF_SCREEN)
+IF(VTK_USE_MANGLED_MESA OR VTK_OPENGL_HAS_OSMESA)
+  SET(VTK_CAN_DO_OFF_SCREEN 1)
+ENDIF(VTK_USE_MANGLED_MESA OR VTK_OPENGL_HAS_OSMESA)
+VTK_DEPENDENT_OPTION(VTK_USE_OFFSCREEN
+                     "The opengl library being used supports off screen Mesa calls." OFF
+                     "VTK_CAN_DO_OFF_SCREEN" OFF)
+VTK_DEPENDENT_OPTION(VTK_USE_MPI
+                     "Use Message Passing Interface (MPI) library for parallel support." OFF
+                     "VTK_USE_PARALLEL" OFF)
+VTK_DEPENDENT_OPTION(VTK_USE_MATROX_IMAGING
+                     "Use Matrox Imaging Library for video input." OFF
+                     "VTK_USE_RENDERING;WIN32" OFF)
+VTK_DEPENDENT_OPTION(VTK_USE_GL2PS "Build VTK with gl2ps support." OFF
+                     "VTK_USE_RENDERING" ON)
+
+SET(VTK_CAN_USE_TK)
+IF(VTK_WRAP_PYTHON 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)
+VTK_DEPENDENT_OPTION(VTK_USE_TK "Build VTK with Tk support" ON
+                     "VTK_CAN_USE_TK" OFF)
+
+MARK_AS_ADVANCED(VTK_OPENGL_HAS_OSMESA
+                 VTK_USE_OFFSCREEN
+                 VTK_USE_TK
+                 VTK_USE_GL2PS
+                 VTK_USE_MANGLED_MESA
+                 VTK_USE_MATROX_IMAGING
+                 VTK_USE_MPI)
+
+#-----------------------------------------------------------------------------
+# Provide options to use system versions of third-party libraries.
+VTK_THIRD_PARTY_OPTION(ZLIB zlib)
+VTK_THIRD_PARTY_OPTION(JPEG jpeg)
+VTK_THIRD_PARTY_OPTION(PNG  png)
+VTK_THIRD_PARTY_OPTION(TIFF tiff)
+VTK_THIRD_PARTY_OPTION(EXPAT expat)
+VTK_THIRD_PARTY_OPTION(FREETYPE freetype)
+
+#-----------------------------------------------------------------------------
+# Configure OpenGL support.
+IF(VTK_USE_RENDERING)
+  # At the moment CMake's FindOpenGL considers OpenGL should be found
+  # in the framework version on OSX. This is a reasonable assumption for
+  # few people are going to use X. The module warns that if X is to be
+  # used, one has to set the libs and include dir manually, which is
+  # exactly what we are going to do below.
+  IF(APPLE AND VTK_USE_X)
+    FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h 
+      /usr/X11R6/include)
+    FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h 
+      /usr/X11R6/include)
+    FIND_LIBRARY(OPENGL_gl_LIBRARY NAMES GL MesaGL 
+      PATHS /usr/lib /usr/local/lib /usr/X11R6/lib)
+    FIND_LIBRARY(OPENGL_glu_LIBRARY NAMES GLU MesaGLU 
+      PATHS ${OPENGL_gl_LIBRARY} /usr/lib /usr/local/lib /usr/X11R6/lib)
+  ENDIF(APPLE AND VTK_USE_X)
+  INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
+ENDIF(VTK_USE_RENDERING)
+
+VTK_PREPARE_CMAKEDEFINE("" OPENGL_LIBRARY VTK_USE_OPENGL_LIBRARY)
+
+#-----------------------------------------------------------------------------
+# Configure Mangled MESA support.
+IF(VTK_USE_MANGLED_MESA)
+  INCLUDE(${VTK_SOURCE_DIR}/CMake/FindMangledMesa.cmake)
+
+  MARK_AS_ADVANCED(MANGLED_MESA_INCLUDE_DIR MANGLED_MESA_LIBRARY
+                   MANGLED_OSMESA_INCLUDE_DIR MANGLED_OSMESA_LIBRARY)
+
+  IF(MANGLED_MESA_INCLUDE_DIR)
+    USE_MANGLED_MESA(${MANGLED_MESA_INCLUDE_DIR}/GL
+                     ${VTK_BINARY_DIR}/MangleMesaInclude)
+  ENDIF(MANGLED_MESA_INCLUDE_DIR)
+ENDIF(VTK_USE_MANGLED_MESA)
+
+#-----------------------------------------------------------------------------
+# Configure Off-Screen MESA support.
+IF(VTK_OPENGL_HAS_OSMESA)
+  INCLUDE(${VTK_SOURCE_DIR}/CMake/FindOSMesa.cmake)
+  MARK_AS_ADVANCED(OSMESA_INCLUDE_DIR OSMESA_LIBRARY)
+ENDIF(VTK_OPENGL_HAS_OSMESA)
+
+# Off-Screen MESA cannot be used with Mangled MESA.
+IF(VTK_OPENGL_HAS_OSMESA AND VTK_USE_MANGLED_MESA)
+  MESSAGE(SEND_ERROR
+    "Off-Screen MESA cannot be used with Mangled MESA.  Turn off either "
+    "VTK_OPENGL_HAS_OSMESA or VTK_USE_MANGLED_MESA.")
+ENDIF(VTK_OPENGL_HAS_OSMESA AND VTK_USE_MANGLED_MESA)
+
+#-----------------------------------------------------------------------------
+# Configure Matrox Imaging support.
+IF(VTK_USE_MATROX_IMAGING)
+  FIND_LIBRARY(MIL_LIBRARY MIL
+    "C:/Program Files/Matrox Imaging/mil/library/winnt/msc/dll"
+    "C:/Program Files/Matrox Imaging/mil/library/windows/msc/dll"
+    )
+  FIND_PATH(MIL_INCLUDE_PATH mil.h
+    "C:/Program Files/Matrox Imaging/mil/include"
+    )
+ENDIF(VTK_USE_MATROX_IMAGING)
+
+#-----------------------------------------------------------------------------
+# Configure MPI testing support.
+# FLAGS used and set for MPI testing
+# VTK_MPIRUN_EXE - full path to mpirun command
+# VTK_MPI_NUMPROC_FLAG - flag that is used to tell this mpirun how many procs to start
+# VTK_MPI_PREFLAGS - flags used directly before process to be run by mpirun
+# VTK_MPI_POSTFLAGS - flags used after all other flags by mpirun
+# So, tests will be run something like this:
+# ${VTK_MPIRUN_EXE} ${VTK_MPI_NUMPROC_FLAG} 2 ${VTK_MPI_PREFLAGS} executable ${VTK_MPI_POSTFLAGS}
+#
+IF(VTK_USE_MPI AND BUILD_TESTING)
+  FIND_PROGRAM(VTK_MPIRUN_EXE NAMES mpirun lamexec PATHS "C:/Program Files/MPICH/mpd/bin")
+  SET(VTK_MPI_NUMPROC_FLAG "-np" CACHE STRING "Flag used by mpi to specify the number of processes, the next option will be the number of processes. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)")
+  SET(VTK_MPI_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by VTK_MPIRUN_EXE. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)")
+  SET(VTK_MPI_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIRun.(see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)")
+  SET(VTK_MPI_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run parallel applications. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)")
+  MARK_AS_ADVANCED(
+    VTK_MPI_NUMPROC_FLAG VTK_MPIRUN_EXE VTK_MPI_PREFLAGS VTK_MPI_POSTFLAGS VTK_MPI_MAX_NUMPROCS)
+  SEPARATE_ARGUMENTS(VTK_MPI_PREFLAGS)
+  SEPARATE_ARGUMENTS(VTK_MPI_POSTFLAGS)
+ENDIF(VTK_USE_MPI AND BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Create STL header wrappers to block warnings in the STL headers.
+FOREACH(header algorithm deque iterator list map numeric queue set stack string
+               utility vector exception stdexcept)
+  SET(VTK_STL_HEADER "${header}")
+  CONFIGURE_FILE(${VTK_SOURCE_DIR}/Utilities/vtkstd.h.in
+                 ${VTK_BINARY_DIR}/vtkstd/${header} @ONLY IMMEDIATE)
+  IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+    INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR}/vtkstd
+                  FILES ${VTK_BINARY_DIR}/vtkstd/${header})
+  ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+ENDFOREACH(header)
+
+#-----------------------------------------------------------------------------
+# VTK utility script locations.
+SET(VTK_DOXYGEN_HOME ${VTK_SOURCE_DIR}/Utilities/Doxygen)
+SET(VTK_HEADER_TESTING_PY ${VTK_SOURCE_DIR}/Common/Testing/HeaderTesting.py)
+SET(VTK_FIND_STRING_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/FindString.tcl)
+SET(VTK_PRINT_SELF_CHECK_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/PrintSelfCheck.tcl)
+SET(VTK_RT_IMAGE_TEST_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/rtImageTest.tcl)
+IF(VTK_USE_PARALLEL)
+  SET(VTK_PRT_IMAGE_TEST_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/prtImageTest.tcl)
+ENDIF(VTK_USE_PARALLEL)
+
+#-----------------------------------------------------------------------------
+# Configure Tcl wrapping support.
+
+MACRO (VTK_INCLUDE_TCL_TK_MODULES)
+  INCLUDE(${CMAKE_ROOT}/Modules/FindTCL.cmake)
+  SET(VTK_TCL_LIBRARIES ${TCL_LIBRARY})
+  IF(UNIX)
+    # The tcl library needs the math library on unix.
+    SET(VTK_TCL_LIBRARIES ${VTK_TCL_LIBRARIES} m)
+  ENDIF(UNIX)
+  IF(VTK_USE_TK)
+    SET(VTK_TK_LIBRARIES ${TK_LIBRARY} ${VTK_TCL_LIBRARIES})
+  ENDIF(VTK_USE_TK)
+  INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkTclTkMacros.cmake)
+  # Hide useless settings provided by FindTCL.
+  FOREACH(entry 
+          TCL_LIBRARY_DEBUG
+          TK_LIBRARY_DEBUG
+                  TCL_STUB_LIBRARY
+                  TCL_STUB_LIBRARY_DEBUG
+                  TK_STUB_LIBRARY
+                  TK_STUB_LIBRARY_DEBUG
+          TK_WISH)
+    SET(${entry} "${${entry}}" CACHE INTERNAL "This value is not used by VTK.")
+  ENDFOREACH(entry)
+ENDMACRO (VTK_INCLUDE_TCL_TK_MODULES)
+
+IF(VTK_WRAP_TCL)
+  SET(VTK_WRAP_TCL3_INIT_DIR "${VTK_SOURCE_DIR}/Wrapping")
+  INCLUDE("${VTK_SOURCE_DIR}/CMake/vtkWrapTcl.cmake")
+
+  VTK_INCLUDE_TCL_TK_MODULES()
+
+  # Wrapping executables.
+  UTILITY_SOURCE(VTK_WRAP_TCL_EXE vtkWrapTcl Wrapping vtkWrapTcl.c)
+  UTILITY_SOURCE(VTK_WRAP_TCL_INIT_EXE vtkWrapTclInit 
+                 Wrapping vtkWrapTclInit.c)
+  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping)
+  MARK_AS_ADVANCED(VTK_WRAP_TCL_EXE VTK_WRAP_TCL_INIT_EXE VTK_WRAP_HINTS)
+
+  # VTK tcl executables.
+  SET(VTK_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/vtk)
+  IF(VTK_USE_PARALLEL AND VTK_USE_MPI)
+    SET(PVTK_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/pvtk)
+  ENDIF(VTK_USE_PARALLEL AND VTK_USE_MPI)
+
+  # Tcl package location.
+  SET(VTK_TCL_HOME ${VTK_BINARY_DIR}/Wrapping/Tcl)
+
+  OPTION(VTK_TCL_TK_STATIC "Build with static Tcl/Tk support. TCL_LIBRARY and TK_LIBRARY must point to the corresponding Tcl/Tk static libraries (example, tcl84sx.lib, tk84sx.lib)." OFF)
+  MARK_AS_ADVANCED(VTK_TCL_TK_STATIC)
+
+ENDIF(VTK_WRAP_TCL)
+
+IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+  INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR}/CMake FILES
+    ${VTK_SOURCE_DIR}/CMake/vtkTclTkMacros.cmake
+    ${VTK_SOURCE_DIR}/CMake/vtkWrapTcl.cmake
+    ${VTK_SOURCE_DIR}/CMake/vtkWrapJava.cmake
+    ${VTK_SOURCE_DIR}/CMake/vtkWrapPython.cmake
+    ${VTK_SOURCE_DIR}/Wrapping/vtkWrapperInit.data.in
+    )
+ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+
+#-----------------------------------------------------------------------------
+# Configure Python wrapping support.
+IF(VTK_WRAP_PYTHON)
+  SET(VTK_WRAP_PYTHON3_INIT_DIR "${VTK_SOURCE_DIR}/Wrapping")
+  INCLUDE("${VTK_SOURCE_DIR}/CMake/vtkWrapPython.cmake")
+  INCLUDE(${CMAKE_ROOT}/Modules/FindPythonLibs.cmake)
+
+  # Wrapping executables.
+  UTILITY_SOURCE(VTK_WRAP_PYTHON_EXE vtkWrapPython Wrapping vtkWrapPython.c)
+  UTILITY_SOURCE(VTK_WRAP_PYTHON_INIT_EXE vtkWrapPythonInit 
+                   Wrapping vtkWrapPythonInit.c)
+  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping)
+  MARK_AS_ADVANCED(VTK_WRAP_PYTHON_EXE VTK_WRAP_PYTHON_INIT_EXE VTK_WRAP_HINTS)
+
+  # VTK tcl executables.
+  SET(VTK_PYTHON_EXE ${EXECUTABLE_OUTPUT_PATH}/vtkpython)
+  IF(VTK_USE_PARALLEL AND VTK_USE_MPI)
+    SET(PVTK_PYTHON_EXE ${EXECUTABLE_OUTPUT_PATH}/pvtkpython)
+  ENDIF(VTK_USE_PARALLEL AND VTK_USE_MPI)
+
+  # Use separate debug/optimized libraries if they are different.
+  IF(PYTHON_DEBUG_LIBRARY)
+    STRING(COMPARE EQUAL "${PYTHON_DEBUG_LIBRARY}" "${PYTHON_LIBRARY}"
+      VTK_PYTHON_LIBRARIES_MATCH)
+    IF(VTK_PYTHON_LIBRARIES_MATCH)
+      SET(VTK_PYTHON_LIBRARIES ${PYTHON_LIBRARY})
+    ELSE(VTK_PYTHON_LIBRARIES_MATCH)
+      SET(VTK_PYTHON_LIBRARIES
+        optimized ${PYTHON_LIBRARY}
+        debug ${PYTHON_DEBUG_LIBRARY})
+    ENDIF(VTK_PYTHON_LIBRARIES_MATCH)
+    SET(VTK_WINDOWS_PYTHON_DEBUGGABLE 0)
+    IF(WIN32)
+      IF(PYTHON_DEBUG_LIBRARY MATCHES "_d")
+        SET(VTK_WINDOWS_PYTHON_DEBUGGABLE 1)
+      ENDIF(PYTHON_DEBUG_LIBRARY MATCHES "_d")
+    ENDIF(WIN32)
+  ELSE(PYTHON_DEBUG_LIBRARY)
+    SET(VTK_PYTHON_LIBRARIES ${PYTHON_LIBRARY})
+  ENDIF(PYTHON_DEBUG_LIBRARY)
+
+  # Some python installations on UNIX need to link to extra libraries
+  # such as zlib (-lz).  It is hard to automatically detect the needed
+  # libraries so instead just give the user an easy way to specify
+  # the libraries.  This should be needed only rarely.  It should
+  # also be moved to the CMake FindPython.cmake module at some point.
+  IF(UNIX)
+    IF(DEFINED PYTHON_EXTRA_LIBS)
+    ELSE(DEFINED PYTHON_EXTRA_LIBS)
+      SET(PYTHON_EXTRA_LIBS "" CACHE STRING
+        "Extra libraries to link when linking to python (such as \"z\" for zlib).  Separate multiple libraries with semicolons.")
+      MARK_AS_ADVANCED(PYTHON_EXTRA_LIBS)
+    ENDIF(DEFINED PYTHON_EXTRA_LIBS)
+  ENDIF(UNIX)
+
+  # Include any extra libraries for python.
+  SET(VTK_PYTHON_LIBRARIES ${VTK_PYTHON_LIBRARIES} ${PYTHON_EXTRA_LIBS})
+ENDIF(VTK_WRAP_PYTHON)
+
+#-----------------------------------------------------------------------------
+# Configure Java wrapping support.
+IF(VTK_WRAP_JAVA)
+  SET(VTK_WRAP_JAVA3_INIT_DIR "${VTK_SOURCE_DIR}/Wrapping")
+  INCLUDE("${VTK_SOURCE_DIR}/CMake/vtkWrapJava.cmake")
+  INCLUDE(${CMAKE_ROOT}/Modules/FindJava.cmake)
+  INCLUDE(${CMAKE_ROOT}/Modules/FindJNI.cmake)
+
+  # Wrapping executables.
+  UTILITY_SOURCE(VTK_WRAP_JAVA_EXE vtkWrapJava Wrapping vtkWrapJava.c)
+  UTILITY_SOURCE(VTK_PARSE_JAVA_EXE vtkParseJava Wrapping vtkParseJava.c)
+  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping)
+  MARK_AS_ADVANCED(VTK_WRAP_JAVA_EXE VTK_PARSE_JAVA_EXE VTK_WRAP_HINTS)
+
+  # Java package location.
+  SET(VTK_JAVA_JAR ${LIBRARY_OUTPUT_PATH}/vtk.jar)
+  SET(VTK_JAVA_HOME ${VTK_BINARY_DIR}/java/vtk)
+  MAKE_DIRECTORY(${VTK_JAVA_HOME})
+ENDIF(VTK_WRAP_JAVA)
+
+VTK_PREPARE_CMAKEDEFINE("" JAVA_AWT_INCLUDE_PATH VTK_USE_JAWT)
+
+#-----------------------------------------------------------------------------
+# Configure the Tk library for vtkRendering.
+IF(VTK_WRAP_TCL OR VTK_WRAP_PYTHON)
+  IF(VTK_USE_RENDERING OR VTK_WRAP_TCL)
+    SET(VTK_INCLUDE_NEED_TCL 1)
+  ENDIF(VTK_USE_RENDERING OR VTK_WRAP_TCL)
+  IF(VTK_USE_RENDERING)
+    IF(VTK_USE_TK)
+      SET(VTK_INCLUDE_NEED_TK 1)
+    ENDIF(VTK_USE_TK)
+  ENDIF(VTK_USE_RENDERING)
+ENDIF(VTK_WRAP_TCL OR VTK_WRAP_PYTHON)
+
+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
+  IF(NOT VTK_WRAP_TCL)
+    VTK_INCLUDE_TCL_TK_MODULES()
+  ENDIF(NOT VTK_WRAP_TCL)
+
+  # Need Tk sources on windows
+  IF(WIN32)
+    FIND_PATH(TK_XLIB_PATH
+              X11/Xlib.h ${TK_INCLUDE_PATH}
+              ${TK_INCLUDE_PATH}/../xlib)
+    MARK_AS_ADVANCED(TK_XLIB_PATH)
+  ENDIF(WIN32)
+ENDIF(VTK_INCLUDE_NEED_TK)
+
+# Need Tk internal headers for Tk initialization.
+
+SET(VTK_RENDERING_NEED_TK_INTERNAL ${VTK_INCLUDE_NEED_TK})
+
+IF(VTK_INCLUDE_NEED_TK)
+  # Need Tk Internal headers to include tk.h on Cocoa
+  IF(VTK_USE_RENDERING AND VTK_USE_COCOA)
+     SET(VTK_RENDERING_NEED_TK_INTERNAL 1)
+  ENDIF(VTK_USE_RENDERING AND VTK_USE_COCOA)
+ENDIF(VTK_INCLUDE_NEED_TK)
+
+IF (VTK_RENDERING_NEED_TK_INTERNAL AND TK_LIBRARY)
+  SET (try_file "tkInt.h")
+  IF (CYGWIN OR WIN32)
+    SET (try_file "tkWinPort.h")
+  ENDIF (CYGWIN OR WIN32)
+  IF (APPLE)
+    SET (try_file "tkMacOSXPort.h")
+  ENDIF (APPLE)
+  IF (try_file)
+    VTK_GET_TCL_TK_VERSION ("TCL_TK_MAJOR_VERSION" "TCL_TK_MINOR_VERSION")
+    SET (TCL_TK_VERSIOND "${TCL_TK_MAJOR_VERSION}.${TCL_TK_MINOR_VERSION}")
+    FIND_PATH(
+       TK_INTERNAL_PATH 
+       ${try_file} 
+       "${VTK_SOURCE_DIR}/Utilities/TclTk/internals/tk${TCL_TK_VERSIOND}"
+       DOC "The path to the Tk internal headers (${try_file}).")
+    MARK_AS_ADVANCED(TK_INTERNAL_PATH)
+  ENDIF (try_file)
+ENDIF(VTK_RENDERING_NEED_TK_INTERNAL AND TK_LIBRARY)
+
+#-----------------------------------------------------------------------------
+# Configure the python executable for use by testing.
+
+# Python executable is used by some tests whether VTK_WRAP_PYTHON is
+# on or not.  do not add a VTK_WRAP_PYTHON to this if.
+SET(VTK_NEED_PYTHON_EXECUTABLE 0)
+IF(BUILD_TESTING)
+  SET(VTK_NEED_PYTHON_EXECUTABLE 1)
+ENDIF(BUILD_TESTING)
+
+# If VTK_WRAP_PYTHON is on, then we need python executable to compile
+# scripts.
+IF(VTK_WRAP_PYTHON)
+  SET(VTK_NEED_PYTHON_EXECUTABLE 1)
+ENDIF(VTK_WRAP_PYTHON)
+
+IF(VTK_NEED_PYTHON_EXECUTABLE)
+  FIND_PROGRAM(PYTHON_EXECUTABLE
+    NAMES python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
+    PATHS
+    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
+    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
+    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]
+    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]
+    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]
+    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]
+    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
+)
+  MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
+ENDIF(VTK_NEED_PYTHON_EXECUTABLE)
+
+#-----------------------------------------------------------------------------
+# Configure the default VTK_DATA_ROOT for the location of VTKData.
+FIND_PATH(VTK_DATA_ROOT VTKData.readme
+  ${VTK_SOURCE_DIR}/../VTKData 
+  ${VTK_SOURCE_DIR}/../../VTKData 
+  $ENV{VTK_DATA_ROOT})
+
+#-----------------------------------------------------------------------------
+# MPEG2
+#
+# Portions of the mpeg2 library are patented. VTK does not enable linking to
+# this library by default so VTK can remain "patent free". Users who wish to
+# link in mpeg2 functionality must build that library separately and then
+# turn on VTK_USE_MPEG2_ENCODER when configuring VTK. After turning on
+# VTK_USE_MPEG2_ENCODER, you must also set the CMake variables
+# vtkMPEG2Encode_INCLUDE_PATH and vtkMPEG2Encode_LIBRARIES.
+#
+# To use the patented mpeg2 library, first build it, then set the following
+# CMake variables during the VTK configure step:
+#   VTK_USE_MPEG2_ENCODER = ON
+#   vtkMPEG2Encode_INCLUDE_PATH = /path/to/vtkmpeg2encode;/path/to/vtkmpeg2encode-bin
+#   vtkMPEG2Encode_LIBRARIES = /path/to/vtkmpeg2encode-bin/vtkMPEG2Encode.lib
+#
+# Or using -D args on the cmake/ccmake command line:
+#   -DVTK_USE_MPEG2_ENCODER:BOOL=ON
+#   "-DvtkMPEG2Encode_INCLUDE_PATH:PATH=/path/to/vtkmpeg2encode;/path/to/vtkmpeg2encode-bin"
+#   "-DvtkMPEG2Encode_LIBRARIES:STRING=/path/to/vtkmpeg2encode-bin/vtkMPEG2Encode.lib"
+#
+# You are solely responsible for any legal issues associated with using
+# patented code in your software.
+#
+OPTION (VTK_USE_MPEG2_ENCODER
+  "Enable use of the patented mpeg2 library. You are solely responsible for any legal issues associated with using patented code in your software."
+  OFF)
+IF (VTK_USE_MPEG2_ENCODER)
+  INCLUDE(${VTK_SOURCE_DIR}/CMake/FindMPEG2.cmake OPTIONAL)
+ENDIF (VTK_USE_MPEG2_ENCODER)
+
+#-----------------------------------------------------------------------------
+# Configure files with settings for use by the build.
+CONFIGURE_FILE(${VTK_SOURCE_DIR}/vtkConfigure.h.in
+               ${VTK_BINARY_DIR}/vtkConfigure.h @ONLY IMMEDIATE)
+
+CONFIGURE_FILE(${VTK_SOURCE_DIR}/UseVTK.cmake.in
+               ${VTK_BINARY_DIR}/UseVTK.cmake COPYONLY IMMEDIATE)
+
+CONFIGURE_FILE(${VTK_SOURCE_DIR}/vtkToolkits.h.in
+               ${VTK_BINARY_DIR}/vtkToolkits.h @ONLY)
+
+#-----------------------------------------------------------------------------
+# The entire VTK tree should use the same include path.
+
+# Create the list of include directories needed for VTK header files.
+INCLUDE(${VTK_SOURCE_DIR}/vtkIncludeDirectories.cmake)
+
+# This should be the only INCLUDE_DIRECTORIES command in the entire
+# tree, except for the CMake, Utilities, and Examples directories.  We
+# need to do this in one place to make sure the order is correct.
+INCLUDE_DIRECTORIES(
+  ${VTK_INCLUDE_DIRS_BUILD_TREE}
+  ${VTK_INCLUDE_DIRS_SOURCE_TREE}
+  ${VTK_INCLUDE_DIRS_BUILD_TREE_CXX}
+  ${VTK_INCLUDE_DIRS_SYSTEM}
+)
+
+#-----------------------------------------------------------------------------
+# Help other projects use VTK.
+
+IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+  # Install the instantiator headers.
+  INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h vtkCommonInstantiator
+                vtkFilteringInstantiator vtkIOInstantiator
+                vtkImagingInstantiator vtkGraphicsInstantiator
+                vtkGenericFilteringInstantiator)
+  IF(VTK_USE_RENDERING)
+    INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h vtkRenderingInstantiator)
+    INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h vtkVolumeRenderingInstantiator)
+    INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h vtkHybridInstantiator)
+    INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h vtkWidgetsInstantiator)
+  ENDIF(VTK_USE_RENDERING)
+  IF(VTK_USE_PARALLEL)
+    INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h vtkParallelInstantiator)
+  ENDIF(VTK_USE_PARALLEL)
+
+  # Install cmake extensions so user projects can load them.
+  INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR}/CMake FILES
+    ${VTK_SOURCE_DIR}/CMake/vtkLoadCMakeExtensions.cmake 
+    ${VTK_SOURCE_DIR}/CMake/vtkMakeInstantiator.cmake
+    ${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
+        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>
+        # to the full path to the actual module that was loaded.  Use
+        # this variable to find the module to install.
+        INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR}/CMake FILES ${CMAKE_LOADED_COMMAND_${cmd}})
+      ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.0)
+        # CMake 2.0 will not tell us what module was loaded.  Construct the
+        # name of the module for this platform.  If using a generator with
+        # multiple configurations the loaded commands are always built Debug.
+        IF(CMAKE_CONFIGURATION_TYPES)
+          INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR}/CMake FILES
+            "${VTK_BINARY_DIR}/CMake/Debug/${CMAKE_SHARED_MODULE_PREFIX}cm${cmd}${CMAKE_SHARED_MODULE_SUFFIX}")
+        ELSE(CMAKE_CONFIGURATION_TYPES)
+          INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR}/CMake FILES
+            "${VTK_BINARY_DIR}/CMake/${CMAKE_SHARED_MODULE_PREFIX}cm${cmd}${CMAKE_SHARED_MODULE_SUFFIX}")
+        ENDIF(CMAKE_CONFIGURATION_TYPES)
+      ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.0)
+    ENDFOREACH(cmd)
+  ENDIF (VTK_NEED_LOADED_COMMANDS)
+ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+
+# Save library dependencies.
+EXPORT_LIBRARY_DEPENDENCIES(${VTK_BINARY_DIR}/VTKLibraryDepends.cmake)
+
+# Install some files.
+IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+  INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h vtkConfigure vtkToolkits)
+  INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR} .cmake UseVTK VTKLibraryDepends)
+  IF(VTK_WRAP_HINTS)
+    INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR} FILES ${VTK_WRAP_HINTS})
+  ENDIF(VTK_WRAP_HINTS)
+ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+
+#-----------------------------------------------------------------------------
+# Build a CPack installer if CPack is available and this is a build of just
+# VTK (as opposed to a build of VTK included in some other project...)
+
+IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
+IF("${VTK_BINARY_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+
+# For now, only build the CPack installer if vtk(.exe) will be available for
+# installation:
+#
+IF(VTK_WRAP_TCL)
+  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "VTK - The Visualization Toolkit")
+  SET(CPACK_PACKAGE_VENDOR "Kitware, Inc.")
+  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
+  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
+  SET(CPACK_PACKAGE_VERSION_MAJOR "${VTK_MAJOR_VERSION}")
+  SET(CPACK_PACKAGE_VERSION_MINOR "${VTK_MINOR_VERSION}")
+  SET(CPACK_PACKAGE_VERSION_PATCH "${VTK_BUILD_VERSION}")
+  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "VTK ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
+  SET(CPACK_SOURCE_PACKAGE_FILE_NAME "vtk-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+  SET(CPACK_PACKAGE_EXECUTABLES
+    "vtk" "VTK"
+    )
+
+  IF(WIN32)
+    STRING(REGEX REPLACE "/" "\\\\\\\\" CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/Release/VTKInstall.bmp")
+
+    SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\vtk.exe")
+    SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+    SET(CPACK_NSIS_HELP_LINK "http://www.vtk.org")
+    SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.kitware.com")
+    SET(CPACK_NSIS_CONTACT "kitware@kitware.com")
+  ENDIF(WIN32)
+
+  INCLUDE(CPack)
+ENDIF(VTK_WRAP_TCL)
+
+ENDIF("${VTK_BINARY_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
+
+#-----------------------------------------------------------------------------
+# Allow local additions to this file without CVS conflicts.
+INCLUDE(${VTK_BINARY_DIR}/LocalUserOptions.cmake OPTIONAL)
+INCLUDE(${VTK_SOURCE_DIR}/LocalUserOptions.cmake OPTIONAL)
+
+#-----------------------------------------------------------------------------
+# The commands in this directory are intended to be executed as
+# the end of the whole configuration process, as a "last step".
+# This directory is typically the last SUBDIRS in the main CMakeLists.txt.
+SUBDIRS(Utilities/LastConfigureStep)
+
+# If the version of CMake was too old, complain and build nothing.
+# These should be the last lines in this file.
+ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.9)
+  MESSAGE(SEND_ERROR
+          "This version of CMake is too old to build VTK.  "
+          "Please upgrade to CMake 2.0.")
+ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.9)
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	2007-06-05 13:53:47.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	2007-06-05 13:53:47.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	2007-06-05 13:53:47.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	2007-06-05 13:53:47.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/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	2007-06-05 13:53:47.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/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	2007-06-05 13:53:47.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/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	2007-06-05 13:53:47.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/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	2007-06-05 13:53:47.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	2007-06-05 13:53:47.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)